/* ============================================================
   ALDEAPATH — Dashboard Loader & Header Brand Patch
   ------------------------------------------------------------
   Drop-in override that:
     • Aligns the dashboard handoff loader with splash.php timing
       and visual language (teal #00c9b7 + navy #1a3560)
     • Fixes brand text colors so "ALDEA" + "PATH" match the logo
     • Replaces the noisy 3-ring ripple with a single calm
       brand-colored pulse + monospace status line
     • Properly sizes & aligns the header logo + wordmark

   Include AFTER /user/assets/css/style.css and style-patch.css:
     <link rel="stylesheet" href="/user/assets/css/dashboard-loader.css?v=1">
   ============================================================ */

:root {
  --ap-teal: var(--brand, #00796b);
  --ap-teal-soft: rgba(0, 201, 183, 0.14);
  --ap-teal-glow: rgba(0, 201, 183, 0.45);
  --ap-navy: #1a3560;
  --ap-navy-soft: rgba(26, 53, 96, 0.10);
  --ap-ink: #0b1830;
}

[data-theme="dark"] {
  --ap-navy: #e6edf7;
  --ap-ink: #07101f;
}

/* ── FULL-SCREEN LOADER ───────────────────────────────────── */
/* IMPORTANT: base color MUST match splash.php's --bg exactly so the
   handoff between splash and dashboard has zero white flash.
   Splash light: #f6f5f1   Splash dark: #0a1424                       */
.full-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background:
    radial-gradient(1100px 700px at 50% 38%, rgba(0,201,183,0.07), transparent 65%),
    #f6f5f1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  padding: 1.5rem;
  /* Match splash fade-out cadence (400ms) */
  transition: opacity 0.4s ease, visibility 0.4s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] .full-loader,
.full-loader[data-theme="dark"] {
  background:
    radial-gradient(1100px 700px at 50% 38%, rgba(0,201,183,0.10), transparent 65%),
    #0a1424;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .full-loader {
    background:
      radial-gradient(1100px 700px at 50% 38%, rgba(0,201,183,0.10), transparent 65%),
      #0a1424;
  }
}

.full-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Subtle dot-grid backdrop, same texture as splash */
.full-loader::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(26,53,96,0.06) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
  mask-image: radial-gradient(circle at 50% 45%, #000 35%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 35%, transparent 75%);
}

[data-theme="dark"] .full-loader::before {
  background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
}

/* ── RIPPLE → REPLACED WITH SINGLE BRAND PULSE ─────────────── */
.ripple-loader-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 2;
}

/* Hide the original 2nd & 3rd rings — keep only one for a calmer feel */
.ripple-ring:nth-child(2),
.ripple-ring:nth-child(3) { display: none !important; }

.ripple-ring {
  position: absolute;
  inset: 0;
  width: 96px !important;
  height: 96px !important;
  border-radius: 50%;
  border: 1.5px solid var(--ap-teal) !important;
  animation: ap-ring 1.8s cubic-bezier(0.21, 0.61, 0.35, 1) infinite !important;
  animation-delay: 0s !important;
  box-shadow: none !important;
  background: transparent !important;
  will-change: transform, opacity;
}

@keyframes ap-ring {
  0%   { transform: scale(0.55); opacity: 0.85; }
  70%  { transform: scale(1.15); opacity: 0;    }
  100% { transform: scale(1.15); opacity: 0;    }
}

/* Center logo — clean disc with teal glow, no harsh blue shadow */
.ripple-logo-center {
  position: relative;
  z-index: 2;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--surface, #fff);
  box-shadow:
    0 0 0 1px rgba(0,201,183,0.18),
    0 8px 28px rgba(0,201,183,0.22),
    0 2px 6px rgba(11,24,48,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: ap-logo-breathe 2.4s ease-in-out infinite;
}

[data-theme="dark"] .ripple-logo-center {
  background: #0d1a32;
  box-shadow:
    0 0 0 1px rgba(0,201,183,0.28),
    0 8px 32px rgba(0,201,183,0.30),
    0 2px 6px rgba(0,0,0,0.4);
}

@keyframes ap-logo-breathe {
  0%, 100% { transform: scale(1);     }
  50%      { transform: scale(1.045); }
}

.ripple-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  display: block;
}

/* ── BRAND WORDMARK — fixed colors to match logo ───────────── */
.ripple-brand-text {
  position: relative;
  z-index: 2;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ap-navy);
  line-height: 1;
  margin-top: 0.15rem;
}

/* "Path" gets brand teal — matches the logo */
.ripple-brand-text span {
  color: var(--ap-teal) !important;
}

/* ── STATUS LINE — monospace, matches splash language ──────── */
.ripple-loader-text {
  position: relative;
  z-index: 2;
  font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, monospace;
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
  margin-top: 0.25rem;
  transition: opacity 0.3s ease;
  text-align: center;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.ripple-loader-text::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ap-teal);
  box-shadow: 0 0 0 0 var(--ap-teal-glow);
  animation: ap-pulse-dot 1.6s ease-in-out infinite;
}

@keyframes ap-pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 var(--ap-teal-glow); opacity: 1;   }
  50%      { box-shadow: 0 0 0 6px transparent;       opacity: 0.55; }
}

/* ── BOTTOM PROGRESS STRIP — matches splash 2px gradient ───── */
.full-loader::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--ap-teal) 0%, #1a3560 100%);
  box-shadow: 0 0 12px rgba(0,201,183,0.55);
  animation: ap-progress 1.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes ap-progress {
  0%   { width: 0%;   }
  35%  { width: 45%;  }
  70%  { width: 78%;  }
  100% { width: 100%; }
}

/* When loader is hiding, freeze progress at 100% */
.full-loader.hidden::after { width: 100%; }

/* ── HEADER BRAND — logo dominates, wordmark sits beside it ── */
.header-brand {
  flex-shrink: 0;
  display: inline-flex !important;
  align-items: center;
  gap: 0.6rem !important;
  max-width: none;
  text-decoration: none;
  line-height: 1;
}

/* Logo is the anchor — must read clearly and feel bigger than the wordmark */
.header-logo-img {
  height: 48px !important;
  width: 48px !important;
  max-width: 48px !important;
  object-fit: contain;
  display: block;
  border-radius: 9px;
  flex-shrink: 0;
}

/* Wordmark "Aldea" → navy. Kept smaller than the logo on purpose. */
.header-brand > span {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-weight: 800 !important;
  font-size: 0.95rem !important;
  letter-spacing: -0.02em !important;
  color: var(--ap-navy) !important;
  line-height: 1 !important;
  display: inline-flex;
  align-items: baseline;
}

/* Wordmark "Path" → teal */
.header-brand > span > span {
  color: var(--ap-teal) !important;
  font-weight: 800 !important;
}

/* Tighter on small phones so the bigger logo doesn't crowd the controls */
@media (max-width: 360px) {
  .header-logo-img {
    height: 42px !important;
    width: 42px !important;
    max-width: 42px !important;
  }
  .header-brand > span {
    font-size: 0.88rem !important;
  }
}

/* Reduced motion — kill all loops, just show steady state */
@media (prefers-reduced-motion: reduce) {
  .ripple-ring,
  .ripple-logo-center,
  .ripple-loader-text::before,
  .full-loader::after {
    animation: none !important;
  }
  .full-loader::after { width: 100%; }
  .ripple-ring { opacity: 0.4; transform: scale(1.05); }
}
