/* ═══════════════════════════════════════════════════════════
   BinaryTrader OS — Design System
   ilovepdf-inspired: clean, card-based, professional
═══════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties (Color Variables) ─────────────── */
:root {
  /* Light mode defaults */
  --bg:          #f5f6fa;
  --bg-nav:      rgba(255,255,255,0.96);
  --bg-card:     #ffffff;
  --bg-input:    #f8f9fb;
  --bg-surface:  rgba(0,0,0,0.03);
  --border:      rgba(0,0,0,0.09);
  --border-card: rgba(0,0,0,0.08);
  --text-1:      #111827;
  --text-2:      #6b7280;
  --text-3:      #9ca3af;
  --text-inv:    #ffffff;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg:   0 10px 40px rgba(0,0,0,.12);

  /* Brand colors (same in both modes) */
  --brand:       #4a90e2;
  --profit:      #16a34a;
  --warn:        #ea580c;
  --danger:      #dc2626;
  --accent:      #7c3aed;

  /* Chart/stat colors */
  --green:       #00e676;
  --blue:        #64b5f6;
  --orange:      #ff9800;
  --red:         #f44336;
  --purple:      #ce93d8;
  --teal:        #4dd0e1;
}

html.dark {
  --bg:          #06060b;
  --bg-nav:      rgba(6,6,11,0.93);
  --bg-card:     rgba(255,255,255,0.028);
  --bg-input:    rgba(255,255,255,0.045);
  --bg-surface:  rgba(255,255,255,0.035);
  --border:      rgba(255,255,255,0.07);
  --border-card: rgba(255,255,255,0.07);
  --text-1:      #e8eaf0;
  --text-2:      #9098a8;
  --text-3:      #555e6e;
  --text-inv:    #06060b;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.4);
  --shadow-md:   0 4px 20px rgba(0,0,0,.5);
  --shadow-lg:   0 10px 40px rgba(0,0,0,.6);
}

/* ── Base Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
a { text-decoration: none; color: inherit; }
::selection { background: rgba(74,144,226,0.25); }

/* ── Body — uses CSS variables, NOT Tailwind arbitrary values */
body {
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  font-family: 'Inter', 'JetBrains Mono', -apple-system, BlinkMacSystemFont, sans-serif;
  transition: background 0.25s, color 0.25s;
  -webkit-font-smoothing: antialiased;
}

/* Numbers, code, calculator outputs → keep monospace */
.mono, input[type="number"], .result-value, .calc-num, canvas + * {
  font-family: 'JetBrains Mono', monospace;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Number input: hide spinners ─────────────────────────── */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
input[type=number] { -moz-appearance: textfield; }

/* ═══════════════════════════════════════════════════════════
   NAVIGATION — ilovepdf style
═══════════════════════════════════════════════════════════ */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  height: 56px;
  display: flex;
  align-items: center;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 15px;
  color: var(--text-1);
  margin-right: 16px;
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
}
.nav-logo-dot { color: #ff9800; font-size: 16px; }

.nav-link {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  transition: all 0.15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}
.nav-link:hover { background: var(--bg-surface); color: var(--text-1); }
.nav-link.active { background: var(--bg-surface); color: var(--text-1); }

.nav-spacer { flex: 1; }

/* ═══════════════════════════════════════════════════════════
   CARDS — ilovepdf style
═══════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-tool { background: var(--bg-card); border: 1px solid var(--border-card); border-radius: 14px; padding: 1.5rem; box-shadow: var(--shadow-sm); }

/* Tool grid layout */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* Tool cards (ilovepdf grid style) */
.tool-grid-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
}
.tool-grid-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--brand);
}
.tool-card-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.tool-icon-box {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.tool-card-name { font-size: 13px; font-weight: 700; color: var(--text-1); margin-bottom: 3px; }
.tool-card-desc { font-size: 11px; color: var(--text-2); line-height: 1.6; }

/* ═══════════════════════════════════════════════════════════
   FORMS & INPUTS
═══════════════════════════════════════════════════════════ */
.form-input, .input-row input[type="number"], .input-row input[type="text"], .inp-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-1);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 13px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: 'JetBrains Mono', monospace;
}
.form-input:focus, .input-row input:focus, .inp-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(74,144,226,0.12);
}
.form-input::placeholder, .input-row input::placeholder { color: var(--text-3); }

.input-row { display: flex; flex-direction: column; gap: 5px; }
.input-row label { font-size: 11px; color: var(--text-2); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: 10px; font-size: 13px; font-weight: 700; cursor: pointer; border: none; transition: all 0.15s; font-family: inherit; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(74,144,226,.35); }
.btn-danger { background: rgba(220,38,38,0.1); color: #dc2626; border: 1px solid rgba(220,38,38,0.25); }
.btn-danger:hover { background: rgba(220,38,38,0.18); }
.btn-ghost { background: var(--bg-surface); color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text-1); background: var(--bg-card); }
.btn-success { background: rgba(22,163,74,0.12); color: #16a34a; border: 1px solid rgba(22,163,74,0.25); }
.btn-success:hover { background: rgba(22,163,74,0.2); }

/* ═══════════════════════════════════════════════════════════
   RESULT CARDS (calculator outputs)
═══════════════════════════════════════════════════════════ */
.result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 0.2s;
}
.result-label { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; font-weight: 600; }
.result-value { font-size: 1.2rem; font-weight: 800; color: var(--text-1); font-family: 'JetBrains Mono', monospace; }
.tool-title { font-size: 1rem; font-weight: 800; color: var(--text-1); margin-bottom: 4px; }
.tool-desc  { font-size: 11px; color: var(--text-2); line-height: 1.6; }

/* ═══════════════════════════════════════════════════════════
   BADGES & TAGS
═══════════════════════════════════════════════════════════ */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 5px; font-size: 10px; font-weight: 700; letter-spacing: .03em; }
.badge-green  { background: rgba(22,163,74,0.12);  color: #16a34a; }
.badge-red    { background: rgba(220,38,38,0.12);  color: #dc2626; }
.badge-blue   { background: rgba(74,144,226,0.12); color: #4a90e2; }
.badge-orange { background: rgba(234,88,12,0.12);  color: #ea580c; }

/* ═══════════════════════════════════════════════════════════
   CALCULATOR TABS (ilovepdf-style category pills)
═══════════════════════════════════════════════════════════ */
.tool-pill-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 24px; }
.tool-pill {
  padding: 7px 16px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  color: var(--text-2);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; gap: 5px;
  box-shadow: var(--shadow-sm);
}
.tool-pill:hover { border-color: var(--brand); color: var(--brand); }
.tool-pill.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(74,144,226,.3); }

/* ═══════════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════════ */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { padding: 8px 12px; text-align: left; color: var(--text-3); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); font-weight: 700; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg-surface); }

/* ═══════════════════════════════════════════════════════════
   WIDGETS (dashboard)
═══════════════════════════════════════════════════════════ */
.widget {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.widget-title { font-size: 12px; font-weight: 700; color: var(--text-1); margin-bottom: 16px; }

/* Progress bars */
.progress-bar { height: 6px; background: var(--bg-surface); border-radius: 3px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; border-radius: 3px; transition: width .5s cubic-bezier(.4,0,.2,1); }

/* ═══════════════════════════════════════════════════════════
   STRATEGY RADIO BUTTONS
═══════════════════════════════════════════════════════════ */
.strategy-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; padding: 8px; border-radius: 8px;
  border: 1.5px solid var(--border); font-size: 10px; color: var(--text-2);
  transition: all 0.15s; text-align: center;
  background: var(--bg-input);
}
.strategy-btn:has(input:checked) { border-color: var(--brand); background: rgba(74,144,226,0.08); color: var(--brand); }
.strategy-btn input { display: none; }

/* ═══════════════════════════════════════════════════════════
   TOASTS
═══════════════════════════════════════════════════════════ */
#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 12px 18px; border-radius: 12px; font-size: 12px; font-weight: 600; pointer-events: all; animation: slideUp 0.2s ease; min-width: 200px; max-width: 320px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-lg); border: 1px solid transparent; }
.toast-success { background: var(--bg-card); border-color: rgba(22,163,74,.3); color: #16a34a; }
.toast-error   { background: var(--bg-card); border-color: rgba(220,38,38,.3); color: #dc2626; }
.toast-info    { background: var(--bg-card); border-color: rgba(74,144,226,.3); color: #4a90e2; }
.toast-warn    { background: var(--bg-card); border-color: rgba(234,88,12,.3); color: #ea580c; }

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════════════════════ */
@keyframes slideUp { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn  { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }
.tool-panel:not(.hidden) { animation: fadeIn 0.2s ease; }

/* ═══════════════════════════════════════════════════════════
   HERO SECTION
═══════════════════════════════════════════════════════════ */
.hero-section {
  text-align: center;
  padding: 72px 16px 60px;
  background: linear-gradient(180deg, var(--bg-surface) 0%, transparent 100%);
}
.hero-section h1 { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 800; color: var(--text-1); line-height: 1.2; margin-bottom: 16px; }
.hero-section p  { font-size: 15px; color: var(--text-2); max-width: 520px; margin: 0 auto 32px; line-height: 1.7; }

/* ═══════════════════════════════════════════════════════════
   SECTION HEADERS (like ilovepdf category labels)
═══════════════════════════════════════════════════════════ */
.section-eyebrow { font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin-bottom: 6px; }
.section-title   { font-size: 1.4rem; font-weight: 800; color: var(--text-1); margin-bottom: 8px; }
.section-sub     { font-size: 13px; color: var(--text-2); }

/* ═══════════════════════════════════════════════════════════
   UPDATER MODULE
═══════════════════════════════════════════════════════════ */
.updater-drop {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-surface);
}
.updater-drop:hover, .updater-drop.drag-over {
  border-color: var(--brand);
  background: rgba(74,144,226,0.05);
}

/* ═══════════════════════════════════════════════════════════
   PAGE WRAPPER
═══════════════════════════════════════════════════════════ */
.page-wrap { max-width: 1200px; margin: 0 auto; padding: 28px 20px 60px; }

/* ═══════════════════════════════════════════════════════════
   MOBILE
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .hero-section { padding: 40px 16px 32px; }
  .btn { padding: 10px 14px; font-size: 12px; }
  .result-value { font-size: 1rem !important; }
  .tool-card-name { font-size: 12px; }
}

/* ═══════════════════════════════════════════════════════════
   PLAN GATE (locked feature overlay)
═══════════════════════════════════════════════════════════ */
.plan-gate {
  position: relative;
}
.plan-gate-overlay {
  position: absolute; inset: 0; z-index: 10;
  background: rgba(var(--bg), 0.85);
  backdrop-filter: blur(4px);
  border-radius: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
}
