/* =========================================================================
   GoldMind v2 — Unified Design System
   Single CSS shared by the public site, chart page and admin panel
   ========================================================================= */

:root {
  /* —— Color tokens (dark + gold) —— */
  --bg-0:        #0a0e16;   /* page background */
  --bg-1:        #0f141d;   /* card background */
  --bg-2:        #161c27;   /* hover / secondary surface */
  --bg-3:        #1f2734;   /* input / border surface */
  --line:        #232c3b;
  --line-2:      #2d3748;

  --text:        #e6eaf2;
  --text-muted:  #94a3b8;
  --text-faint:  #64748b;

  --gold:        #d4af37;
  --gold-soft:   rgba(212,175,55,.16);
  --gold-line:   rgba(212,175,55,.35);

  --green:       #10b981;
  --red:         #ef4444;
  --blue:        #38bdf8;
  --orange:      #f59e0b;
  --purple:      #a855f7;

  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   14px;

  --shadow-sm:   0 1px 2px rgba(0,0,0,.4);
  --shadow:      0 6px 24px rgba(0,0,0,.45);

  --font-sans:   "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono:   "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* —— SVG Icons (Lucide-style, currentColor) —— */
.icon {
  display: inline-block;
  vertical-align: -0.125em;
  flex-shrink: 0;
}
/* When an icon is the leading element of a button / heading / link, give it a tiny right margin */
.btn .icon, h1 .icon, h2 .icon, h3 .icon, .badge .icon { margin-right: 6px; }
.icon-lg { width: 28px !important; height: 28px !important; }
.icon-xl { width: 40px !important; height: 40px !important; }
/* Round gold-tinted icon container — replaces the old emoji "feature-icon" hack */
.icon-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(212,175,55,.18), rgba(212,175,55,.04));
  border: 1px solid var(--gold-line);
  color: var(--gold);
  margin-bottom: 16px;
}
.icon-circle .icon { width: 28px; height: 28px; }
/* Replace .feature-icon emoji blob with svg-friendly version */
.feature-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(212,175,55,.18), rgba(212,175,55,.04));
  border: 1px solid var(--gold-line);
  color: var(--gold);
  margin-bottom: 16px;
  font-size: 0; /* hide any leftover emoji text */
}
.feature-icon .icon { width: 28px; height: 28px; }

/* —— Header user dropdown —— */
.gm-user { position: relative; }
.gm-user-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px 12px 6px 6px;
  color: var(--text); cursor: pointer; font-family: inherit; font-size: 13px;
  transition: border-color .15s;
}
.gm-user-btn:hover { border-color: var(--gold-line); }
.gm-user-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #b8941f);
  color: #1a1a1a; font-weight: 700; font-size: 12px;
}
.gm-user-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 200px;
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px; z-index: 100;
  display: none;
}
.gm-user.open .gm-user-menu { display: block; }
.gm-user-menu a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--text); font-size: 13px; text-decoration: none;
}
.gm-user-menu a:hover { background: var(--bg-2); text-decoration: none; }

/* —— Reset —— */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body {
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* —— Layout primitives —— */
.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.row  { display: flex; gap: 16px; flex-wrap: wrap; }
.col  { flex: 1 1 0; min-width: 0; }
.grid { display: grid; gap: 16px; }
.gap-sm { gap: 8px; } .gap-lg { gap: 24px; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; } .mb-4 { margin-bottom: 32px; }
.flex-center { display:flex; align-items:center; justify-content:center; }
.flex-between { display:flex; align-items:center; justify-content:space-between; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-gold  { color: var(--gold); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.mono       { font-family: var(--font-mono); }

/* —— Header / Nav —— */
.gm-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,14,22,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.gm-header .nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 20px; max-width: 1280px; margin: 0 auto;
}
.gm-logo {
  font-weight: 700; font-size: 18px; letter-spacing: 0.5px;
  display:flex; align-items:center; gap:8px;
}
.gm-logo .dot { width:10px; height:10px; border-radius:50%;
  background: var(--gold); box-shadow: 0 0 12px var(--gold); }
.gm-logo strong { color: var(--gold); }
.gm-nav-links { display:flex; gap:28px; }
.gm-nav-links a {
  color: var(--text-muted); font-weight: 500; padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.gm-nav-links a:hover, .gm-nav-links a.active {
  color: var(--gold); border-color: var(--gold);
  text-decoration: none;
}
.gm-nav-actions { display: flex; gap: 10px; align-items:center; }

/* —— Footer —— */
.gm-footer {
  margin-top: 60px;
  border-top: 1px solid var(--line);
  background: var(--bg-1);
  color: var(--text-muted);
  font-size: 13px;
}
.gm-footer .footer-grid {
  max-width: 1280px; margin: 0 auto; padding: 40px 20px 20px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px;
}
.gm-footer h4 { color: var(--text); font-size: 13px;
  text-transform: uppercase; letter-spacing: 1px; margin: 0 0 12px; }
.gm-footer ul { list-style:none; padding:0; margin:0; display:grid; gap:8px; }
.gm-footer ul a { color: var(--text-muted); }
.gm-footer ul a:hover { color: var(--gold); text-decoration:none; }
.gm-footer .copyright {
  text-align:center; padding: 18px; border-top: 1px solid var(--line);
  color: var(--text-faint); font-size: 12px;
}
@media (max-width: 720px) {
  .gm-footer .footer-grid { grid-template-columns: 1fr 1fr; }
  .gm-nav-links { display:none; }
}

/* —— Buttons —— */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding: 9px 18px; border-radius: var(--radius);
  font-weight: 600; font-size: 14px; line-height: 1; cursor: pointer;
  border: 1px solid transparent; transition: all .15s ease;
  white-space: nowrap; user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--gold); color: #1a1206; }
.btn-primary:hover { background: #e6c14a; }
.btn-ghost   { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--bg-2); }
.btn-danger  { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }

/* —— Card —— */
.card {
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display:flex; align-items:center; justify-content:space-between;
  margin: -20px -20px 16px; padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.card-header h3 { margin:0; font-size: 15px; font-weight: 600; }
.card-title-gold { color: var(--gold); }

/* —— Form —— */
.form-row { display: grid; gap: 6px; margin-bottom: 14px; }
.form-row label {
  font-size: 12px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
}
.input, select.input, textarea.input {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 14px;
  font-family: var(--font-sans);
  width: 100%; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
textarea.input { resize: vertical; min-height: 80px; font-family: var(--font-mono); font-size: 12px; }
.checkbox { display:inline-flex; align-items:center; gap:8px; cursor:pointer;
  font-size: 13px; color: var(--text); user-select: none; }
.checkbox input { accent-color: var(--gold); width:16px; height:16px; }

/* —— Tables —— */
.table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 13px;
}
.table th, .table td {
  padding: 10px 12px; text-align: left;
  border-bottom: 1px solid var(--line);
}
.table thead th {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  background: var(--bg-2); font-weight: 600;
}
.table tbody tr:hover { background: var(--bg-2); }
.table .num, .table .mono { font-family: var(--font-mono); }

/* —— Badges —— */
.badge {
  display:inline-flex; align-items:center; gap:4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--bg-3); color: var(--text-muted);
  border: 1px solid var(--line-2);
}
.badge-green  { background: rgba(16,185,129,.15);  color: var(--green); border-color: rgba(16,185,129,.3); }
.badge-red    { background: rgba(239,68,68,.15);   color: var(--red);   border-color: rgba(239,68,68,.3); }
.badge-gold   { background: var(--gold-soft);      color: var(--gold);  border-color: var(--gold-line); }
.badge-blue   { background: rgba(56,189,248,.15);  color: var(--blue);  border-color: rgba(56,189,248,.3); }

/* —— Hero (landing page / hero block) —— */
.hero {
  padding: 80px 0 60px; text-align: center;
  background: radial-gradient(ellipse at top, rgba(212,175,55,.12), transparent 60%);
}
.hero h1 {
  font-size: 48px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 16px;
  background: linear-gradient(135deg, var(--text), var(--gold) 70%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { font-size: 17px; color: var(--text-muted); max-width: 640px; margin: 0 auto 28px; }
@media (max-width: 720px) {
  .hero { padding:50px 0 30px; }
  .hero h1 { font-size: 28px; line-height: 1.2; }
  .hero p { font-size: 15px; }
  .container { padding: 0 14px; }
  .row { gap: 10px; }
  body { font-size: 13px; }
  h1 { font-size: 26px; } h2 { font-size: 22px; } h3 { font-size: 16px; }
  .btn { padding: 10px 16px; font-size: 14px; }
  .btn-sm { padding: 6px 12px; font-size: 12px; }
  /* prevent iOS auto-zoom on form inputs */
  input.input, textarea.input, select.input { font-size: 16px; }
}

/* —— Feature cards —— */
.features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px; margin: 40px 0;
}
.feature-card {
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 24px;
  transition: transform .2s, border-color .2s;
}
.feature-card:hover { transform: translateY(-3px); border-color: var(--gold-line); }
.feature-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  background: var(--gold-soft); color: var(--gold);
  display:flex; align-items:center; justify-content:center;
  font-size: 22px; margin-bottom: 16px;
}
.feature-card h3 { margin: 0 0 8px; font-size: 16px; }
.feature-card p { margin: 0; color: var(--text-muted); font-size: 13px; }

/* —— Admin layout —— */
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-sidebar {
  background: var(--bg-1); border-right: 1px solid var(--line);
  padding: 22px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-sidebar .brand {
  padding: 0 22px 18px; font-weight: 700; font-size: 16px;
  display:flex; align-items:center; gap:8px; color: var(--gold);
  border-bottom: 1px solid var(--line); margin-bottom: 12px;
}
.admin-sidebar a {
  display:flex; align-items:center; gap:10px;
  padding: 10px 22px; color: var(--text-muted); font-size: 13px;
  border-left: 3px solid transparent; cursor: pointer;
}
.admin-sidebar a:hover { background: var(--bg-2); color: var(--text); text-decoration: none; }
.admin-sidebar a.active {
  background: var(--bg-2); color: var(--gold);
  border-left-color: var(--gold);
}
.admin-sidebar .section {
  font-size: 11px; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 18px 22px 6px;
}
.admin-main { padding: 28px 32px; min-width: 0; }
.admin-page-title {
  font-size: 22px; font-weight: 700; margin: 0 0 24px;
  display:flex; align-items:center; gap:10px;
}
/* Admin / Member sidebar → slide-in drawer on tablet/phone */
@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: fixed; top: 60px; left: 0; bottom: 0;
    width: 260px; z-index: 95;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 8px 0 24px rgba(0,0,0,.5);
    overflow-y: auto;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { padding: 16px; padding-top: 56px; }    /* leave room for burger */
  .admin-burger { display: inline-flex; }              /* show burger */

  /* tables → horizontal scroll instead of overflowing */
  .table { display: block; overflow-x: auto; white-space: nowrap; }
  .row  { gap: 10px; }
  .features { grid-template-columns: 1fr !important; }
  .card { padding: 14px; }
  .card-header { flex-wrap: wrap; gap: 6px; }
}

/* Phone — extra compaction */
@media (max-width: 640px) {
  .admin-shell { min-height: calc(100vh - 56px); }
  .admin-sidebar { top: 56px; width: min(280px, 88vw); }
  .admin-side-backdrop { top: 56px; }
  .admin-burger { top: 64px; }
  .admin-main { padding: 12px 10px; }
  .admin-page-title { font-size: 16px; margin-bottom: 12px; }
  .auth-card { padding: 18px; }
  .form-row .input { font-size: 16px; }   /* prevent iOS zoom */
}

/* —— Toast / notification —— */
.toast-stack { position:fixed; top:20px; right:20px; z-index:9999; display:grid; gap:8px; }
.toast {
  background: var(--bg-2); border: 1px solid var(--line-2);
  border-left: 4px solid var(--gold);
  padding: 10px 16px; border-radius: var(--radius);
  font-size: 13px; box-shadow: var(--shadow);
  animation: slideIn .25s ease;
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
@keyframes slideIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }

/* —— Chart container —— */
.chart-shell {
  display: grid;
  grid-template-columns: 70px 1fr 320px;
  height: calc(100vh - 60px);
  background: var(--bg-0);
}
.chart-symbols { background: var(--bg-1); border-right: 1px solid var(--line);
  overflow-y: auto; padding: 8px 0; }
.chart-symbols .item {
  padding: 10px 8px; text-align:center; cursor:pointer;
  font-size: 11px; color: var(--text-muted);
  border-left: 3px solid transparent;
}
.chart-symbols .item:hover { background: var(--bg-2); color: var(--text); }
.chart-symbols .item.active {
  color: var(--gold); border-left-color: var(--gold); background: var(--bg-2);
}
.chart-stage { display:flex; flex-direction:column; min-width:0; }
.chart-toolbar {
  display:flex; align-items:center; gap: 12px; padding: 10px 16px;
  background: var(--bg-1); border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.chart-toolbar .tf-group { display:flex; gap: 2px; background: var(--bg-3);
  padding: 2px; border-radius: var(--radius-sm); }
.chart-toolbar .tf-group button {
  background: transparent; color: var(--text-muted); border: none;
  padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 12px;
  font-family: var(--font-mono);
}
.chart-toolbar .tf-group button.active {
  background: var(--gold); color: #1a1206; font-weight: 700;
}
.chart-toolbar .price-tape {
  display:flex; gap: 14px; align-items: center; margin-left: auto;
  font-family: var(--font-mono); font-size: 12px;
}
.chart-toolbar .price-tape .last { font-size: 16px; font-weight: 700; color: var(--gold); }
.chart-canvas { flex: 1; position: relative; min-height: 0; }
.chart-canvas .lwc-pane { position: absolute; inset: 0; }
.chart-side { background: var(--bg-1); border-left: 1px solid var(--line);
  overflow-y: auto; padding: 14px; }
.chart-side h3 { margin: 0 0 10px; font-size: 13px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px; }
.indicator-toggle {
  display:flex; justify-content:space-between; align-items:center;
  padding: 8px 0; border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.switch { position: relative; width: 36px; height: 20px;
  background: var(--bg-3); border-radius: 10px; cursor: pointer;
  transition: background .2s; }
.switch::after {
  content:''; position: absolute; left: 2px; top: 2px;
  width: 16px; height: 16px; background: var(--text-muted);
  border-radius: 50%; transition: all .2s;
}
.switch.on { background: var(--gold-soft); }
.switch.on::after { left: 18px; background: var(--gold); }
/* ===== Mobile / tablet UI controls — pre-styled, hidden on desktop ===== */
.chart-side-toggle {
  position: fixed; right: 14px; bottom: 80px; z-index: 96;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--gold); color: #1a1206;
  border: none; cursor: pointer; font-weight: 800;
  box-shadow: 0 4px 16px rgba(212,175,55,.4);
  align-items: center; justify-content: center;
  font-size: 22px;
  display: none;
}
.chart-side-toggle:hover { transform: scale(1.05); }
.chart-side-backdrop {
  position: fixed; inset: 60px 0 0 0; z-index: 94;
  background: rgba(0,0,0,.4);
  display: none;
}
.chart-side-backdrop.open { display: block; }
.admin-burger {
  position: fixed; top: 72px; left: 12px; z-index: 96;
  background: var(--bg-2); border: 1px solid var(--gold-line);
  color: var(--gold); width: 40px; height: 40px; border-radius: 8px;
  align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer;
  display: none;
}
.admin-burger:hover { background: var(--gold); color: #1a1206; }
.admin-side-backdrop {
  position: fixed; inset: 60px 0 0 0; z-index: 94;
  background: rgba(0,0,0,.5);
  display: none;
}
.admin-side-backdrop.open { display: block; }

/* Tablet (≤1200px): hide left favorites, right chart side becomes drawer */
@media (max-width: 1200px) {
  .chart-shell { grid-template-columns: 1fr; }
  .chart-symbols { display: none !important; }

  .chart-side {
    position: fixed;
    top: 60px; bottom: 0; right: 0;
    width: min(360px, 92vw);
    z-index: 95;
    transform: translateX(100%);
    transition: transform .25s ease;
    box-shadow: -8px 0 24px rgba(0,0,0,.5);
    display: block !important;        /* override prior display:none rules */
  }
  .chart-side.open { transform: translateX(0); }

  .chart-side-toggle { display: flex; }
  .chart-side-backdrop { display: none; }     /* still hidden until .open */
  .chart-side-backdrop.open { display: block; }

  /* toolbar wraps + horizontal scroll for tf buttons */
  .chart-toolbar {
    flex-wrap: wrap; gap: 8px; padding: 8px 10px; font-size: 12px;
  }
  .chart-toolbar .price-tape { margin-left: 0; gap: 8px; flex-wrap: wrap; font-size: 11px; }
  .chart-toolbar .price-tape .last { font-size: 14px; }
}

/* Phone (≤640px): toolbar tighter; resonance label hides; sub-charts shrink */
@media (max-width: 640px) {
  .chart-shell { height: calc(100vh - 56px); }
  .chart-toolbar { padding: 6px 8px; gap: 6px; }
  .chart-toolbar .tf-group button { padding: 4px 8px; font-size: 11px; }
  .chart-toolbar .price-tape > span:not(.last):not(.text-faint) { display: none; }
  .draw-tools { order: 99; width: 100%; justify-content: center; }
  #resonance + .text-faint { display: none; }
  .chart-side { top: 56px; width: 100vw; }
  .chart-side-backdrop { top: 56px; }
}

/* Header: collapse nav links into hamburger on tablet/phone */
@media (max-width: 980px) {
  .gm-nav-links { display: none; }
  .gm-nav-links.open {
    display: flex; flex-direction: column;
    position: fixed; top: 60px; left: 0; right: 0;
    background: var(--bg-1); border-bottom: 1px solid var(--line);
    padding: 12px 20px; gap: 4px; z-index: 90;
  }
  .gm-nav-links.open a { padding: 10px 12px; border-radius: 6px; }
  .gm-nav-links.open a:hover { background: var(--bg-2); }
  .gm-burger { display: inline-flex; }
  .gm-user-email { display: none; }   /* avatar only on small screens */
  .nav { padding: 0 14px; }
}
.gm-burger {
  display: none;
  background: transparent; border: 1px solid var(--line); border-radius: 6px;
  width: 36px; height: 36px; align-items: center; justify-content: center;
  color: var(--text); cursor: pointer; font-size: 18px;
}
.gm-burger:hover { border-color: var(--gold-line); color: var(--gold); }

/* —— Login card (admin / user) —— */
.auth-shell { min-height: 100vh; display:flex; align-items:center; justify-content:center;
  padding: 20px; background: radial-gradient(ellipse at center, rgba(212,175,55,.08), transparent 70%); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .auth-brand {
  text-align:center; margin-bottom: 24px;
  font-size: 22px; font-weight: 700; color: var(--gold);
}
