/* ============================================================
   TOOLBOX PRO — Shared Design System
   Premium UI for 2 billion users
   ============================================================ */

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

:root {
  /* Brand */
  --brand:        #6c63ff;
  --brand-2:      #48d1cc;
  --brand-grad:   linear-gradient(135deg, #6c63ff 0%, #48d1cc 100%);
  --brand-soft:   rgba(108,99,255,.12);

  /* Surfaces */
  --bg:           #0d0f1a;
  --bg-2:         #13172a;
  --bg-3:         #1a1f36;
  --card:         #1e2340;
  --card-hover:   #242a4a;
  --border:       rgba(255,255,255,.08);
  --border-focus: rgba(108,99,255,.6);

  /* Text */
  --text:         #f0f2ff;
  --text-2:       #a0a8cc;
  --text-3:       #6b74a0;

  /* Status */
  --green:        #22c55e;
  --red:          #ef4444;
  --yellow:       #f59e0b;
  --blue:         #3b82f6;

  /* Sizing */
  --radius:       14px;
  --radius-sm:    8px;
  --radius-lg:    20px;
  --shadow:       0 4px 24px rgba(0,0,0,.4);
  --shadow-lg:    0 8px 48px rgba(0,0,0,.5);

  /* Motion */
  --ease:         cubic-bezier(.4,0,.2,1);
  --dur:          .2s;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; }
p  { color: var(--text-2); }
a  { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { color: var(--text); }
code { font-family: 'Fira Code', monospace; font-size: .9em; background: var(--bg-3); padding: 2px 6px; border-radius: 4px; }

/* ── Layout ───────────────────────────────────────────────── */
.page-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 80px;
}
.page-wrap--wide { max-width: 1100px; }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,15,26,.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.topbar-brand svg { flex-shrink: 0; }
.topbar-brand strong { font-size: 1.05rem; color: var(--text); }
.topbar-brand span  { font-size: .78rem; color: var(--text-3); display: block; }
.topbar-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  color: var(--text-2);
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
  transition: all var(--dur) var(--ease);
}
.topbar-back:hover { background: var(--card-hover); color: var(--text); text-decoration: none; }

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-soft);
  border: 1px solid rgba(108,99,255,.3);
  color: #a89fff;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.hero h1 { margin-bottom: 14px; }
.hero h1 span { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 1.05rem; max-width: 580px; margin: 0 auto 28px; }
.hero-meta { display: flex; align-items: center; justify-content: center; gap: 20px; flex-wrap: wrap; }
.hero-meta-item { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--text-3); }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.card:hover { border-color: rgba(108,99,255,.3); box-shadow: var(--shadow); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: .95rem;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}
.btn-primary {
  background: var(--brand-grad);
  color: #fff;
  box-shadow: 0 4px 16px rgba(108,99,255,.35);
}
.btn-primary:hover { opacity: .9; box-shadow: 0 6px 24px rgba(108,99,255,.5); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--card); color: var(--text); border-color: rgba(108,99,255,.4); }
.btn-danger {
  background: rgba(239,68,68,.12);
  color: #f87171;
  border: 1px solid rgba(239,68,68,.3);
}
.btn-danger:hover { background: rgba(239,68,68,.22); }
.btn-sm { padding: 8px 18px; font-size: .85rem; }
.btn-lg { padding: 16px 40px; font-size: 1.05rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }

/* ── Inputs & Controls ────────────────────────────────────── */
.input-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.input-group label { font-size: .85rem; font-weight: 600; color: var(--text-2); }
input[type="text"], input[type="number"], input[type="email"],
input[type="url"], input[type="password"], input[type="range"],
select, textarea {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
  padding: 11px 14px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  outline: none;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(108,99,255,.15);
}
textarea { resize: vertical; min-height: 140px; }
input[type="range"] {
  padding: 0;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-3);
  border: none;
  cursor: pointer;
  accent-color: var(--brand);
}
select option { background: var(--card); }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  cursor: pointer;
  user-select: none;
}
.checkbox-row input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
  flex-shrink: 0;
}
.checkbox-row span { font-size: .92rem; color: var(--text-2); }

/* ── Drop Zone ────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 28px;
  text-align: center;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  background: var(--bg-2);
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.drop-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-icon {
  width: 56px; height: 56px;
  background: var(--brand-soft);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 16px;
}
.drop-zone h3 { margin-bottom: 8px; }
.drop-zone p  { font-size: .88rem; }

/* ── Progress ─────────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-3);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--brand-grad);
  border-radius: 999px;
  transition: width .4s var(--ease);
}

/* ── Chips / Badges ───────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.chip-green  { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.3); color: #4ade80; }
.chip-red    { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); color: #f87171; }
.chip-yellow { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: #fbbf24; }
.chip-brand  { background: var(--brand-soft); border-color: rgba(108,99,255,.3); color: #a89fff; }

/* ── Result / Stats grid ──────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.stat-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
}
.stat-card .stat-val {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  margin-bottom: 6px;
}
.stat-card .stat-lbl { font-size: .78rem; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }

/* ── Section divider ──────────────────────────────────────── */
.section-gap { margin-top: 40px; }
.section-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Toast notifications ──────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-size: .9rem;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  animation: toast-in .3s var(--ease);
  pointer-events: auto;
  max-width: 340px;
}
.toast.toast-success { border-left: 3px solid var(--green); }
.toast.toast-error   { border-left: 3px solid var(--red); }
.toast.toast-info    { border-left: 3px solid var(--brand); }
@keyframes toast-in  { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform: translateY(0); } }
@keyframes toast-out { from { opacity:1; } to { opacity:0; transform: translateY(20px); } }

/* ── Ads ──────────────────────────────────────────────────── */
.ad-slot {
  width: 100%;
  min-height: 100px;
  background: var(--bg-2);
  border: 1px dashed rgba(255,255,255,.06);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: .75rem;
  margin: 28px 0;
  overflow: hidden;
}
.ad-slot ins { display: block; width: 100%; }

/* ── FAQ ──────────────────────────────────────────────────── */
.faq { margin-top: 48px; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-q {
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-size: .97rem;
  font-weight: 600;
  text-align: left;
  padding: 18px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: inherit;
}
.faq-q svg { flex-shrink: 0; transition: transform var(--dur) var(--ease); color: var(--brand); }
.faq-q[aria-expanded="true"] svg { transform: rotate(180deg); }
.faq-a { display: none; padding: 0 0 18px; color: var(--text-2); font-size: .92rem; line-height: 1.7; }
.faq-a.open { display: block; }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 40px 24px;
  text-align: center;
}
.site-footer p { font-size: .85rem; color: var(--text-3); margin-bottom: 8px; }
.footer-links { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.footer-links a { font-size: .82rem; color: var(--text-3); }
.footer-links a:hover { color: var(--text-2); }

/* ── BG orbs ──────────────────────────────────────────────── */
.bg-orbs { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bg-orbs::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(108,99,255,.12) 0%, transparent 70%);
  top: -200px; left: -200px;
  border-radius: 50%;
}
.bg-orbs::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(72,209,204,.08) 0%, transparent 70%);
  bottom: -100px; right: -100px;
  border-radius: 50%;
}
main { position: relative; z-index: 1; }

/* ── File list ────────────────────────────────────────────── */
.file-list { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.file-item-icon { font-size: 1.4rem; flex-shrink: 0; }
.file-item-info { flex: 1; min-width: 0; }
.file-item-info strong { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item-info span  { font-size: .78rem; color: var(--text-3); }
.file-item-status { flex-shrink: 0; }

/* ── Results box ──────────────────────────────────────────── */
.result-box {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-top: 24px;
  display: none;
}
.result-box.visible { display: block; }

/* ── Gauge (BMI / health) ─────────────────────────────────── */
.gauge-wrap { position: relative; margin: 0 auto; width: 220px; height: 120px; overflow: hidden; }
.gauge-svg { width: 100%; height: 100%; }
.gauge-label {
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

/* ── Grid utilities ───────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── Separator ────────────────────────────────────────────── */
hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

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

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .topbar { padding: 12px 16px; }
  .hero { padding: 40px 0 28px; }
  .card { padding: 20px; }
  .page-wrap { padding: 0 14px 60px; }
}
@media (max-width: 480px) {
  .btn { padding: 10px 20px; }
  .btn-lg { padding: 13px 28px; }
}
