/* ============================================================
   MF Analyser — Live Top Funds Explorer
   Shared design system
   ============================================================ */

:root {
  /* Colors — InvestVerdict navy + gold luxury system */
  --bg:    #05111f;   /* navy   */
  --bg2:   #081929;   /* navy-2 */
  --bg3:   #081929;   /* secondary surfaces / inputs */
  --card:  #0c2038;   /* navy-3 — elevated cards */
  --card2: #10294a;   /* navy-4 — hover / nested */
  --b1:    rgba(201,152,42,0.10);
  --b2:    rgba(201,152,42,0.20);
  --b3:    rgba(201,152,42,0.42);
  --a:     #c9982a;   /* gold     */
  --a2:    #e8b84b;   /* gold-2   */
  --gold-soft: rgba(201,152,42,0.13);
  --gold-glow: rgba(201,152,42,0.28);
  --green: #10b981;
  --red:   #ef4444;
  --gold:  #e8b84b;
  --t1:    #e4dfd0;   /* cream text   */
  --t2:    #7a8799;   /* muted        */
  --t3:    #576576;   /* muted-2      */

  /* Type — DM Sans body/UI, Bebas hero, Cormorant serif accents */
  --display: 'DM Sans', system-ui, sans-serif;
  --body:    'DM Sans', system-ui, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, monospace;
  --hero:    'Bebas Neue', 'DM Sans', sans-serif;
  --serif:   'Cormorant Garamond', Georgia, serif;

  /* Radius */
  --r6: 6px; --r8: 10px; --r12: 12px; --r14: 16px; --r16: 16px;

  /* Shadow */
  --shadow-cta:  0 4px 16px rgba(201,152,42,0.30);
  --shadow-lift: 0 8px 28px rgba(0,0,0,0.55);

  --maxw: 1400px;
  --header-h: 64px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* Premium chrome — gold grid + navy/gold glow, all as fixed bg layers
     (behind everything, no z-index/stacking issues) */
  background:
    linear-gradient(rgba(201,152,42,0.035) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, rgba(201,152,42,0.035) 1px, transparent 1px) 0 0 / 56px 56px,
    radial-gradient(1100px 640px at 82% -12%, rgba(201,152,42,0.12), transparent 60%),
    radial-gradient(900px 600px at 2% 10%, rgba(16,41,74,0.60), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--t1);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}

/* Optional full-screen overlay variants (kept for pages that use divs) */
.bg-texture { position: fixed; inset: 0; z-index: -2; pointer-events: none; }
.bg-grid {
  position: fixed; inset: 0; z-index: -2; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(rgba(201,152,42,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201,152,42,0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(900px 700px at 50% 0%, #000, transparent 75%);
          mask-image: radial-gradient(900px 700px at 50% 0%, #000, transparent 75%);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--a); color: var(--bg); }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201,152,42,0.18); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(201,152,42,0.34); background-clip: padding-box; }

/* ============================================================
   HEADER
   ============================================================ */
.header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 22px;
  background: rgba(5,17,31,0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--b1);
}
.header-inner {
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
}
.logo {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--display); font-weight: 600; font-size: 16px;
  letter-spacing: -0.01em; white-space: nowrap;
}
.logo .mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--a), var(--a2));
  display: grid; place-items: center; color: var(--bg);
  box-shadow: 0 2px 10px rgba(201,152,42,0.45);
}
.logo .mark svg { width: 15px; height: 15px; }
.logo .dot-sep { color: var(--t3); font-weight: 400; }

.header-center {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 12px;
  min-width: 0;
}
.header-title {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--display); font-weight: 500; font-size: 14px;
  color: var(--t1); white-space: nowrap;
}
.header-title .trophy { color: var(--gold); display: inline-flex; }

.live-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(16,185,129,0.10);
  border: 1px solid rgba(16,185,129,0.22);
  font-family: var(--mono); font-size: 11px; color: var(--green);
  white-space: nowrap;
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); position: relative; flex: none;
}
.pulse-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--green); animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%   { transform: scale(1);   opacity: 1; }
  50%  { transform: scale(1.3); opacity: 0.4; }
  100% { transform: scale(1);   opacity: 1; }
}

.header-right { display: flex; align-items: center; gap: 12px; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3); border: 1px solid var(--b1);
  border-radius: var(--r8); padding: 7px 11px; width: 220px;
  transition: border-color .18s, box-shadow .18s;
}
.search:focus-within { border-color: var(--b3); box-shadow: 0 0 0 3px rgba(201,152,42,0.10); }
.search svg { width: 15px; height: 15px; color: var(--t3); flex: none; }
.search input {
  background: none; border: none; outline: none; color: var(--t1);
  font-family: var(--body); font-size: 13px; width: 100%;
}
.search input::placeholder { color: var(--t3); }
.user-menu {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--a), var(--a2));
  display: grid; place-items: center; color: var(--bg);
  font-family: var(--display); font-weight: 700; font-size: 13px;
  border: 1px solid var(--b2);
}

/* ============================================================
   GENERIC
   ============================================================ */
.page { position: relative; z-index: 1; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

.card {
  background: var(--card);
  border: 1px solid var(--b1);
  border-radius: var(--r14);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--b2); background: var(--bg3); color: var(--t1);
  border-radius: var(--r8); padding: 8px 14px; font-size: 13px; font-weight: 500;
  transition: transform .14s, border-color .14s, background .14s, box-shadow .14s;
}
.btn:hover { border-color: var(--b3); transform: scale(1.02); }
.btn-primary {
  background: linear-gradient(135deg, var(--a), var(--a2));
  border: none; color: var(--bg); font-weight: 700; box-shadow: var(--shadow-cta);
}
.btn-primary:hover { box-shadow: 0 6px 22px rgba(201,152,42,0.45); }

.up   { color: var(--green); }
.down { color: var(--red); }

.stars { color: var(--gold); letter-spacing: 1px; font-size: 11px; white-space: nowrap; }
.stars .off { color: var(--t3); }

/* skeleton shimmer */
.sk {
  position: relative; overflow: hidden;
  background: rgba(201,152,42,0.07); border-radius: 6px;
}
.sk::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(228,223,208,0.10), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* entrance */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .5s cubic-bezier(.2,.7,.3,1) both; }

@keyframes flipIn {
  from { opacity: 0; transform: translateY(6px) scale(.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.flip-in { animation: flipIn .42s cubic-bezier(.2,.7,.3,1) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
