/* ============================================================
   MySQL Learning Lab — Core Styles
   Dark developer aesthetic. Amber/teal accents on deep slate.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=JetBrains+Mono:wght@400;500;700&family=Manrope:wght@400;500;600;700&display=swap');

:root {
  --bg: #0c0f17;
  --bg-2: #11151f;
  --bg-3: #161b27;
  --panel: #171c29;
  --panel-2: #1d2433;
  --border: #232b3d;
  --border-2: #2e394f;
  --text: #e6ebf5;
  --text-dim: #9aa6bd;
  --text-faint: #66728c;
  --accent: #ffb454;        /* amber (MySQL-dolphin warmth) */
  --accent-2: #38d6c4;      /* teal */
  --accent-3: #7aa2ff;      /* blue */
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
  --kw: #ff9e64;
  --str: #9ece6a;
  --num: #7dcfff;
  --comment: #5a6b8a;
  --shadow: 0 18px 50px -12px rgba(0,0,0,.6);
  --radius: 14px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Manrope', system-ui, sans-serif;
  --display: 'Sora', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); }
kbd {
  font-family: var(--mono); font-size: .78em; background: var(--bg-3);
  border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px;
}
::selection { background: rgba(255,180,84,.3); }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a4660; }

/* ---------- Loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 9999;
  background: radial-gradient(circle at 50% 40%, #141a28, #0a0d14);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  transition: opacity .5s, visibility .5s;
}
#loader.hidden { opacity: 0; visibility: hidden; }
.loader-logo { font-family: var(--display); font-size: 2rem; font-weight: 800; color: var(--accent); letter-spacing: -.02em; }
.loader-spin {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid var(--border-2); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.loader-sub { color: var(--text-dim); font-size: .9rem; }
.loader-err { color: var(--err); max-width: 380px; text-align: center; font-size: .92rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Top nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 28px;
  padding: 14px 26px;
  background: rgba(12,15,23,.82); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topnav .brand { font-family: var(--display); font-weight: 800; font-size: 1.18rem; letter-spacing: -.02em; }
.topnav .brand span { color: var(--accent); }
.topnav nav { display: flex; gap: 6px; margin-left: auto; }
.topnav nav a {
  padding: 8px 15px; border-radius: 9px; color: var(--text-dim); font-weight: 600; font-size: .92rem;
  transition: .18s;
}
.topnav nav a:hover { color: var(--text); background: var(--panel); }
.topnav nav a.active { color: var(--accent); background: rgba(255,180,84,.1); }
#burger { display: none; background: none; border: 1px solid var(--border-2); color: var(--text); border-radius: 8px; padding: 7px 11px; cursor: pointer; }

/* ---------- Layout ---------- */
#app { display: flex; min-height: calc(100vh - 59px); }
#sidebar { display: none; }
body.with-sidebar #sidebar {
  display: flex; flex-direction: column;
  width: 280px; flex-shrink: 0;
  background: var(--bg-2); border-right: 1px solid var(--border);
  position: sticky; top: 59px; height: calc(100vh - 59px); overflow-y: auto;
}
#view { flex: 1; min-width: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 12px 22px; border-radius: 11px; font-weight: 700; font-size: .95rem;
  cursor: pointer; border: 1px solid transparent; transition: .2s; font-family: var(--sans);
}
.btn-primary { background: linear-gradient(135deg, var(--accent), #ff8c42); color: #1a1206; box-shadow: 0 8px 24px -6px rgba(255,140,66,.5); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -6px rgba(255,140,66,.65); }
.btn-ghost { background: var(--panel); color: var(--text); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--panel-2); border-color: var(--accent-2); }
.btn-lg { padding: 15px 32px; font-size: 1.05rem; }
.btn-mini {
  font-family: var(--sans); font-size: .82rem; font-weight: 600; padding: 6px 13px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border-2);
  border-radius: 8px; cursor: pointer; transition: .15s;
}
.btn-mini:hover { border-color: var(--accent-2); color: var(--accent-2); }

/* ---------- HOME ---------- */
.home { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.hero {
  position: relative; display: grid; grid-template-columns: 1.1fr .9fr; gap: 50px; align-items: center;
  padding: 70px 0 60px; min-height: 540px;
}
.hero-bg {
  position: absolute; inset: -100px -200px auto; height: 600px; z-index: -1;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,180,84,.14), transparent 45%),
    radial-gradient(circle at 80% 20%, rgba(56,214,196,.12), transparent 45%);
  filter: blur(10px);
}
.hero-badge {
  display: inline-block; padding: 6px 14px; border-radius: 30px;
  background: var(--panel); border: 1px solid var(--border-2); color: var(--accent-2);
  font-size: .82rem; font-weight: 600; margin-bottom: 22px;
}
.hero-title { font-family: var(--display); font-size: clamp(2.6rem, 6vw, 4.3rem); line-height: 1.03; font-weight: 800; letter-spacing: -.03em; }
.grad { background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--text-dim); font-size: 1.12rem; margin: 22px 0 30px; max-width: 520px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 34px; margin-top: 44px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-family: var(--display); font-size: 1.7rem; color: var(--text); }
.hero-stats span { color: var(--text-faint); font-size: .85rem; }

.hero-terminal {
  background: var(--bg-3); border: 1px solid var(--border-2); border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow); transform: perspective(1000px) rotateY(-6deg) rotateX(2deg);
}
.ht-bar {
  display: flex; align-items: center; gap: 7px; padding: 12px 16px;
  background: var(--bg-2); border-bottom: 1px solid var(--border); color: var(--text-faint);
  font-family: var(--mono); font-size: .8rem;
}
.ht-bar span { width: 11px; height: 11px; border-radius: 50%; background: var(--border-2); }
.ht-bar span:nth-child(1) { background: #ff5f57; } .ht-bar span:nth-child(2) { background: #febc2e; } .ht-bar span:nth-child(3) { background: #28c840; }
.ht-code { padding: 22px 20px; font-family: var(--mono); font-size: .92rem; line-height: 1.8; color: var(--text); overflow-x: auto; }

.sec-title { font-family: var(--display); font-size: 2rem; font-weight: 800; text-align: center; margin: 70px 0 36px; letter-spacing: -.02em; }
.features { padding: 30px 0; }
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feat-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 24px;
  transition: .25s;
}
.feat-card:hover { transform: translateY(-4px); border-color: var(--border-2); box-shadow: var(--shadow); }
.feat-ic { font-size: 1.9rem; margin-bottom: 12px; }
.feat-card h3 { font-family: var(--display); font-size: 1.15rem; margin-bottom: 8px; }
.feat-card p { color: var(--text-dim); font-size: .94rem; }

.roadmap { padding: 20px 0; }
.road { display: flex; flex-direction: column; gap: 16px; max-width: 820px; margin: 0 auto; }
.road-step { display: flex; gap: 20px; align-items: flex-start; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; position: relative; }
.road-step::before { content: ""; position: absolute; left: 41px; top: 100%; height: 16px; width: 2px; background: var(--border-2); }
.road-step:last-child::before { display: none; }
.road-num { width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 1.3rem; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #15110a; }
.road-body h3 { font-family: var(--display); font-size: 1.15rem; }
.road-body p { color: var(--text-dim); font-size: .9rem; margin: 4px 0; }
.road-count { font-size: .8rem; color: var(--accent-2); font-weight: 600; }

.testimonials { padding: 20px 0; }
.test-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.test-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 24px; }
.test-card p { font-size: 1rem; color: var(--text); margin-bottom: 18px; font-style: italic; }
.test-who { display: flex; flex-direction: column; }
.test-who b { color: var(--accent); } .test-who span { color: var(--text-faint); font-size: .85rem; }

.cta-final { text-align: center; padding: 80px 0 60px; }
.cta-final h2 { font-family: var(--display); font-size: 2.2rem; font-weight: 800; margin-bottom: 26px; letter-spacing: -.02em; }
.footer { text-align: center; color: var(--text-faint); padding: 40px 0; border-top: 1px solid var(--border); font-size: .88rem; }

/* ---------- Sidebar ---------- */
.side-top { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.side-logo { font-family: var(--display); font-weight: 800; font-size: 1.1rem; }
.side-logo span, .side-logo { color: var(--accent); }
.side-progress { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.sp-row { display: flex; justify-content: space-between; font-size: .82rem; color: var(--text-dim); margin-bottom: 8px; font-weight: 600; }
.sp-bar { height: 7px; background: var(--bg-3); border-radius: 5px; overflow: hidden; }
.sp-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s; }
.sp-streak { font-size: .78rem; color: var(--text-faint); margin-top: 9px; }
.side-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.side-group { margin-bottom: 8px; }
.side-group-h { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); padding: 10px 20px 6px; font-weight: 700; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 20px; font-size: .88rem; color: var(--text-dim);
  transition: .15s; border-left: 2px solid transparent;
}
.side-link:hover { color: var(--text); background: var(--panel); }
.side-link.active { color: var(--accent); border-left-color: var(--accent); background: rgba(255,180,84,.07); }
.sl-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-2); flex-shrink: 0; }
.side-link.done .sl-dot { background: var(--ok); }
.side-link.active .sl-dot { background: var(--accent); }
.side-foot { padding: 14px 12px; border-top: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.side-link2 { padding: 9px 12px; font-size: .82rem; color: var(--text-dim); border-radius: 8px; transition: .15s; text-align: center; background: var(--panel); }
.side-link2:hover { color: var(--accent-2); background: var(--panel-2); }

/* ---------- Dashboard ---------- */
.dash, .page { max-width: 1020px; margin: 0 auto; padding: 36px 30px 80px; }
.dash-title, .page-title { font-family: var(--display); font-size: 2rem; font-weight: 800; letter-spacing: -.02em; }
.dash-sub, .page-sub { color: var(--text-dim); margin: 8px 0 30px; }
.dash-level { margin-bottom: 36px; }
.dl-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.dl-head h2 { font-family: var(--display); font-size: 1.25rem; }
.dl-head span { color: var(--accent-2); font-weight: 700; font-size: .9rem; }
.dl-bar { height: 6px; background: var(--bg-3); border-radius: 4px; overflow: hidden; margin-bottom: 16px; }
.dl-bar div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.dl-card {
  display: flex; align-items: center; gap: 11px; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 11px; transition: .18s;
}
.dl-card:hover { border-color: var(--accent-2); transform: translateY(-2px); }
.dl-card.done { border-color: rgba(74,222,128,.3); }
.dl-ic { font-size: 1.1rem; }
.dl-name { font-size: .9rem; font-weight: 600; }

/* ---------- Lesson ---------- */
.lesson { max-width: 880px; margin: 0 auto; padding: 36px 30px 90px; }
.lesson-head { margin-bottom: 30px; }
.lesson-level { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-2); font-weight: 700; }
.lesson-head h1 { font-family: var(--display); font-size: 2.1rem; font-weight: 800; margin-top: 8px; letter-spacing: -.02em; }
.lesson-theory { font-size: 1.04rem; color: var(--text); }
.lesson-theory p { margin: 14px 0; }
.lesson-theory ul, .lesson-theory ol { margin: 14px 0 14px 22px; }
.lesson-theory li { margin: 7px 0; color: var(--text-dim); }
.lesson-theory li b { color: var(--text); }
.lesson-theory b { color: var(--text); }
.lesson-theory h4 { font-family: var(--display); font-size: 1.05rem; margin: 22px 0 8px; color: var(--accent-2); }
.lesson-theory h3 { font-family: var(--display); font-size: 1.3rem; margin: 26px 0 10px; color: var(--text); }
.lesson-theory code { background: var(--bg-3); padding: 2px 7px; border-radius: 5px; font-size: .9em; color: var(--accent); }
.lesson-theory pre {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 11px; padding: 18px 20px;
  overflow-x: auto; margin: 18px 0;
}
.lesson-theory pre code { background: none; padding: 0; color: var(--text); font-size: .9rem; line-height: 1.7; }
.lesson-theory .note { background: rgba(56,214,196,.08); border-left: 3px solid var(--accent-2); padding: 12px 16px; border-radius: 8px; color: var(--text-dim); font-size: .92rem; }
.lesson-theory .warn { background: rgba(248,113,113,.08); border-left: 3px solid var(--err); padding: 12px 16px; border-radius: 8px; color: #fca5a5; font-size: .92rem; }
.theory-table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: .9rem; }
.theory-table th, .theory-table td { text-align: left; padding: 10px 14px; border: 1px solid var(--border); }
.theory-table th { background: var(--bg-3); color: var(--accent-2); font-weight: 700; }
.theory-table td { color: var(--text-dim); }

.block-h { font-family: var(--display); font-size: 1.15rem; margin: 36px 0 16px; padding-top: 10px; }
.lesson-actions { margin: 40px 0 20px; }
.btn-done { padding: 12px 24px; border-radius: 11px; background: var(--panel); border: 1px solid var(--border-2); color: var(--text); font-weight: 700; cursor: pointer; transition: .2s; }
.btn-done:hover { border-color: var(--ok); color: var(--ok); }
.btn-done.is-done { background: rgba(74,222,128,.12); border-color: var(--ok); color: var(--ok); }
.lesson-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--border); }
.ln-prev, .ln-next { padding: 12px 18px; background: var(--panel); border: 1px solid var(--border); border-radius: 11px; font-weight: 600; font-size: .9rem; color: var(--text-dim); transition: .18s; max-width: 46%; }
.ln-prev:hover, .ln-next:hover { color: var(--accent); border-color: var(--accent-2); }

/* ---------- Exercises (Topshiriqlar) ---------- */
.ex-intro { color: var(--text-dim); font-size: .92rem; margin-bottom: 16px; }
.ex-block { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; transition: border-color .2s; }
.ex-block.solved { border-color: rgba(74,222,128,.4); }
.ex-task { font-weight: 600; margin-bottom: 8px; display: flex; gap: 10px; align-items: baseline; }
.ex-num { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #1a1206; font-weight: 800; font-size: .8rem; display: inline-grid; place-items: center; font-family: var(--display); }
.ex-block.solved .ex-num { background: var(--ok); }
.ex-hint { font-size: .85rem; color: var(--text-faint); margin: 0 0 12px 34px; font-style: italic; }
.ex-status { margin-top: 10px; min-height: 22px; font-size: .9rem; font-weight: 600; }
.ex-pass { color: var(--ok); } .ex-fail { color: var(--err); }

/* ---------- Page bits ---------- */
.back-link { color: var(--text-dim); font-size: .9rem; font-weight: 600; }
.back-link:hover { color: var(--accent); }
.sec-title2 { font-family: var(--display); font-size: 1.4rem; margin: 36px 0 18px; }

/* ---------- Toasts ---------- */
#toast-host { position: fixed; bottom: 24px; right: 24px; z-index: 9000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--border-2); color: var(--text);
  padding: 13px 20px; border-radius: 12px; font-weight: 600; font-size: .9rem; box-shadow: var(--shadow);
  transform: translateX(120%); opacity: 0; transition: .3s;
}
.toast.show { transform: translateX(0); opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-terminal { transform: none; }
  .feat-grid, .test-grid { grid-template-columns: 1fr; }
  #burger { display: block; }
  .topnav nav { display: none; }
  body.with-sidebar #sidebar {
    position: fixed; left: 0; top: 59px; z-index: 200; transform: translateX(-100%); transition: transform .3s;
  }
  body.with-sidebar #sidebar.open { transform: translateX(0); }
}
