/* ================================================================
   DesertRise CRM — Application Stylesheet
   Author: Rover Cyber Software Design L.L.C.
   Version: 1.0
   ================================================================ */
@import "theme-core";

/* ------------------------
   Root Theme Variables
   ------------------------ */
:root {
  --color-bg-dark: #0f172a;
  --color-bg-accent: #134e4a;
  --color-primary: #0d9488;
  --color-primary-light: #14b8a6;
  --color-text: #e2e8f0;
  --color-muted: #94a3b8;
  --color-white: #ffffff;
  --radius: 12px;
  --shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  --transition: all 0.25s ease;
}

/* ------------------------
   Global Reset
   ------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--color-bg-dark);
  color: var(--color-text);
  line-height: 1.5;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 4px;
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

/* ------------------------
   Loader Page
   ------------------------ */
#loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: radial-gradient(circle at 30% 30%, var(--color-primary) 0%, var(--color-bg-accent) 80%);
  color: var(--color-white);
  animation: fadeIn 0.8s ease-in-out;
}

#loader .logo {
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
#loader .logo img {
  width: 48px;
  height: 48px;
}
#loader .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--color-white);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-top: 1rem;
}
#loader p {
  opacity: 0.85;
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

/* ------------------------
   App Layout
   ------------------------ */
#app-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--color-bg-dark);
}

/* Header */
.app-header {
  background: var(--color-bg-accent);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header h1 {
  font-size: 1.25rem;
  color: var(--color-white);
  letter-spacing: 0.3px;
}

.app-header nav a {
  color: var(--color-text);
  margin-left: 1.2rem;
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}
.app-header nav a:hover {
  color: var(--color-primary-light);
}

/* Main Content */
main {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  background: var(--color-bg-dark);
}

/* Footer */
footer {
  text-align: center;
  background: var(--color-bg-accent);
  color: var(--color-text);
  padding: 0.75rem;
  font-size: 0.85rem;
}

/* ------------------------
   Dashboard and Sections
   ------------------------ */
.view {
  display: none;
  animation: fadeIn 0.5s ease-in-out;
}
.view.active {
  display: block;
}

.view h2 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  color: var(--color-primary-light);
}

.view p {
  color: var(--color-muted);
  font-size: 0.95rem;
}

/* ------------------------
   Cards & Panels
   ------------------------ */
.card {
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: var(--transition);
}
.card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.06);
}

.card h3 {
  color: var(--color-primary-light);
  margin-bottom: 0.75rem;
}
.card p {
  color: var(--color-text);
  opacity: 0.85;
}

/* ------------------------
   Buttons
   ------------------------ */
.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--color-white);
  background: var(--color-primary);
  font-weight: 500;
  transition: var(--transition);
}
.btn:hover {
  background: var(--color-primary-light);
  transform: translateY(-1px);
}

/* ------------------------
   Tables
   ------------------------ */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius);
  overflow: hidden;
}

.table th,
.table td {
  padding: 0.75rem 1rem;
  text-align: left;
}
.table th {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-primary-light);
  font-weight: 600;
}
.table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}
.table tr:hover {
  background: rgba(255, 255, 255, 0.06);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.metric {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 1.2rem 1rem;
  text-align: center;
}
.metric span {
  display: block;
  font-size: 1.8rem;
  font-weight: 600;
  color: #5eead4;
}
.metric label {
  display: block;
  font-size: 0.9rem;
  color: #a5b4fc;
  margin-top: 0.25rem;
}

/* ===============================================================
   DesertRise CRM — Dashboard Visual Enhancements
   =============================================================== */

/* --- Metrics Grid (responsive & animated) --- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.2rem;
  margin: 1.5rem 0;
}

.metric {
  background: linear-gradient(145deg, rgba(19,78,74,0.8), rgba(15,23,42,0.95));
  border: 1px solid rgba(94,234,212,0.2);
  border-radius: 12px;
  padding: 1.2rem 1rem;
  text-align: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s;
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 120%, rgba(94,234,212,0.15), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s;
}

.metric:hover {
  transform: translateY(-4px);
  border-color: rgba(94,234,212,0.4);
  box-shadow: 0 0 12px rgba(94,234,212,0.25);
}

.metric:hover::before {
  opacity: 1;
}

.metric span {
  display: block;
  font-size: 2rem;
  font-weight: 600;
  color: #5eead4;
  text-shadow: 0 0 8px rgba(94,234,212,0.3);
  transition: color 0.3s ease;
}

.metric label {
  display: block;
  font-size: 0.9rem;
  color: #a5b4fc;
  margin-top: 0.3rem;
  letter-spacing: 0.02em;
}

/* --- Chart Container --- */
#trendsChart {
  width: 100%;
  max-height: 340px;
  margin-top: 2rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  padding: 1rem;
  box-shadow: inset 0 0 20px rgba(94,234,212,0.05);
  transition: box-shadow 0.4s ease;
}

#trendsChart:hover {
  box-shadow: inset 0 0 25px rgba(94,234,212,0.12);
}

/* --- Fade-in animation for cards --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.metric {
  animation: fadeUp 0.5s ease forwards;
}

@media (max-width: 640px) {
  .metric span { font-size: 1.6rem; }
  .metric label { font-size: 0.85rem; }
}

/* ------------------------
   Forms
   ------------------------ */
input,
select,
textarea {
  width: 100%;
  padding: 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-white);
  margin-top: 0.25rem;
  font-family: inherit;
  transition: var(--transition);
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary-light);
  outline: none;
}

/* ------------------------
   Animations
   ------------------------ */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ------------------------
   Responsive
   ------------------------ */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-header nav {
    margin-top: 0.5rem;
  }

  main {
    padding: 1.25rem;
  }
}

@media (max-width: 480px) {
  h1, h2, h3 {
    font-size: 90%;
  }
  .btn {
    padding: 0.5rem 1rem;
  }
}