/* ============================================================
   Érettségi Felkészítő – Custom Design System
   ============================================================ */

:root {
  --primary:       #1d4ed8;
  --primary-light: #3b82f6;
  --primary-dark:  #1e3a8a;
  --accent:        #f59e0b;
  --success:       #10b981;
  --danger:        #ef4444;
  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --surface2:      #f8fafc;
  --border:        #e2e8f0;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --code-bg:       #0f172a;
  --sidebar-w:     260px;
  --radius:        10px;
  --shadow:        0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --transition:    .2s ease;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

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

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; }

/* ── Typography ── */
h1, h2, h3, h4, h5 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

p { margin-bottom: .75rem; }
p:last-child { margin-bottom: 0; }

/* ── Layout ── */
.page-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--primary-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1.25rem 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.12);
  text-decoration: none;
  color: #fff;
}
.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  background: var(--primary-light);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.nav-section-label {
  padding: .75rem 1.25rem .25rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.4);
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem 1.25rem;
  color: rgba(255,255,255,.78);
  font-size: .9rem;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.sidebar nav a .nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  font-size: .78rem;
  color: rgba(255,255,255,.35);
  border-top: 1px solid rgba(255,255,255,.1);
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.page-body { padding: 2rem; max-width: 1100px; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.card-body { padding: 1.5rem; }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 2.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 260px; height: 260px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
}
.hero::before {
  content: "";
  position: absolute;
  right: 60px; bottom: -60px;
  width: 180px; height: 180px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
}
.hero h1 { font-size: 1.9rem; margin-bottom: .5rem; }
.hero p { opacity: .88; max-width: 520px; }

/* ── Score Grid ── */
.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.score-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}
.score-card:hover { transform: translateY(-2px); }

.score-card .score-num {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: .25rem;
}
.score-card .score-label { font-size: .82rem; color: var(--text-muted); }

.score-card.s-blue  .score-num { color: var(--primary); }
.score-card.s-amber .score-num { color: var(--accent); }
.score-card.s-green .score-num { color: var(--success); }
.score-card.s-red   .score-num { color: var(--danger); }

/* ── Nav Cards ── */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.nav-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  box-shadow: var(--shadow);
}
.nav-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(29,78,216,.15);
  transform: translateY(-3px);
  color: var(--text);
}
.nav-card .nav-card-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: .75rem;
}
.nav-card h3 { font-size: 1rem; margin-bottom: .25rem; }
.nav-card p  { font-size: .82rem; color: var(--text-muted); margin: 0; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-primary { background: #dbeafe; color: var(--primary-dark); }
.badge-amber   { background: #fef3c7; color: #92400e; }
.badge-green   { background: #d1fae5; color: #065f46; }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-gray    { background: #f1f5f9; color: var(--text-muted); }

/* ── Code Blocks ── */
.code-block {
  position: relative;
  margin: 1rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--code-bg);
}

.code-block .code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem 1rem;
  background: #1e293b;
  font-size: .75rem;
  color: rgba(255,255,255,.5);
}

.code-block .code-header .lang-label {
  color: #60a5fa;
  font-weight: 600;
}

.copy-btn {
  background: rgba(255,255,255,.1);
  border: none;
  color: rgba(255,255,255,.7);
  padding: .25rem .6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: .75rem;
  transition: background var(--transition);
}
.copy-btn:hover { background: rgba(255,255,255,.2); color: #fff; }

.code-block pre {
  margin: 0;
  padding: 1.25rem;
  overflow-x: auto;
  font-size: .87rem;
  line-height: 1.6;
}

/* ── Lesson Sections (Accordion) ── */
.lesson {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: .75rem;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.lesson-header {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  transition: background var(--transition);
}
.lesson-header:hover { background: var(--bg); }

.lesson-header .lesson-num {
  width: 28px; height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.lesson-header .chevron {
  margin-left: auto;
  transition: transform var(--transition);
  color: var(--text-muted);
  font-size: .85rem;
}
.lesson.open .lesson-header .chevron { transform: rotate(180deg); }

.lesson-body {
  display: none;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
}
.lesson.open .lesson-body { display: block; }

/* ── Tip/Warning/Info Boxes ── */
.callout {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  border-left: 4px solid;
  display: flex;
  gap: .75rem;
}
.callout-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: .05rem; }
.callout-content h4 { margin-bottom: .25rem; font-size: .9rem; }
.callout-content p  { font-size: .87rem; margin: 0; }

.callout-tip    { background: #eff6ff; border-color: var(--primary-light); }
.callout-tip    .callout-icon { color: var(--primary-light); }
.callout-tip    h4  { color: var(--primary); }

.callout-warn   { background: #fffbeb; border-color: var(--accent); }
.callout-warn   .callout-icon { color: var(--accent); }
.callout-warn   h4  { color: #92400e; }

.callout-success { background: #f0fdf4; border-color: var(--success); }
.callout-success .callout-icon { color: var(--success); }
.callout-success h4  { color: #065f46; }

.callout-danger { background: #fff1f2; border-color: var(--danger); }
.callout-danger .callout-icon { color: var(--danger); }
.callout-danger h4  { color: #991b1b; }

/* ── Exercise Box ── */
.exercise {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 1.25rem 0;
  overflow: hidden;
}

.exercise-header {
  background: linear-gradient(90deg, #1e3a8a, #1d4ed8);
  color: #fff;
  padding: .75rem 1.25rem;
  font-size: .9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.exercise-body { padding: 1.25rem; }

.solution-toggle {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: .5rem 1.1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  margin-top: 1rem;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  gap: .4rem;
}
.solution-toggle:hover { background: var(--primary-dark); }

.solution {
  display: none;
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.solution.visible { display: block; }

/* ── Table ── */
.table-wrap { overflow-x: auto; margin: 1rem 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
th {
  background: var(--primary-dark);
  color: #fff;
  padding: .6rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .85rem;
}
td { padding: .55rem 1rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: var(--surface2); }
tr:hover td { background: #eff6ff; }

/* ── Exam Paper Cards ── */
.year-group { margin-bottom: 2rem; }
.year-group h2 {
  font-size: 1.2rem;
  margin-bottom: .75rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.session-card h3 {
  font-size: .95rem;
  margin-bottom: .75rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: .4rem;
}

.file-links { display: flex; flex-direction: column; gap: .4rem; }

.file-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .75rem;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: .85rem;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition);
}
.file-link:hover {
  background: #dbeafe;
  border-color: var(--primary-light);
  color: var(--primary-dark);
}
.file-link .file-icon { font-size: 1rem; }
.file-link .file-type-badge {
  margin-left: auto;
  font-size: .7rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 4px;
}
.file-link .pdf-badge { background: #fee2e2; color: #991b1b; }
.file-link .zip-badge { background: #fef3c7; color: #92400e; }

/* ── Progress Bar ── */
.progress-bar-wrap {
  background: var(--border);
  border-radius: 999px;
  height: 8px;
  margin: .5rem 0;
}
.progress-bar-fill {
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  height: 100%;
  border-radius: 999px;
  transition: width .4s ease;
}

/* ── Pill Tabs ── */
.pill-tabs {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.pill-tab {
  padding: .4rem 1rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
}
.pill-tab:hover,
.pill-tab.active {
  border-color: var(--primary);
  color: var(--primary);
  background: #dbeafe;
}

/* ── Hamburger (mobile) ── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--text);
  padding: .25rem;
}

/* ── Miscellaneous ── */
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-green   { color: var(--success); }
.text-amber   { color: var(--accent); }
.text-red     { color: var(--danger); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.font-mono { font-family: 'Fira Code', 'Cascadia Code', monospace; }

.divider { height: 1px; background: var(--border); margin: 1.5rem 0; }

/* ── Responsive ── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: block; }

  .main-content { margin-left: 0; }
  .page-body { padding: 1rem; }

  .hero { padding: 1.5rem; }
  .hero h1 { font-size: 1.5rem; }

  .nav-cards { grid-template-columns: 1fr 1fr; }
  .score-grid { grid-template-columns: repeat(2, 1fr); }

  .topbar { padding: .75rem 1rem; }
}

@media (max-width: 480px) {
  .nav-cards { grid-template-columns: 1fr; }
}

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
.sidebar-overlay.visible { display: block; }
