@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&display=swap');

/* ─────────────────────────────────────────
   Design Tokens
───────────────────────────────────────── */
:root {
  --accent:       #D97757;
  --accent-dark:  #B85E3C;
  --accent-light: #F0A080;
  --accent-glow:  rgba(217, 119, 87, 0.25);

  --bg:           #0A0A0A;
  --surface:      #141414;
  --surface-2:    #1E1E1E;
  --surface-3:    #282828;

  --text:         #F2F2F2;
  --text-muted:   #8A8A8A;
  --text-subtle:  #555555;

  --border:       rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.14);

  --sidebar-w:    260px;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    16px;

  --shadow:       0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg:    0 8px 48px rgba(0, 0, 0, 0.6);
  --shadow-accent: 0 4px 24px rgba(217, 119, 87, 0.2);
}

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

html { scroll-behavior: smooth; }

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

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-light); }

img { max-width: 100%; height: auto; }
input, textarea, select { font-family: inherit; }

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

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-wrapper {
  flex: 1;
  padding: 32px;
  max-width: 1200px;
}

/* ─────────────────────────────────────────
   Sidebar
───────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo img {
  height: 36px;
  width: auto;
}

.sidebar-logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
  font-family: 'Syne', sans-serif;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 8px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
}

.sidebar-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-link.active {
  background: rgba(217, 119, 87, 0.12);
  color: var(--accent);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

.sidebar-link .nav-icon,
.sidebar-link .nav-icon svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px; color: var(--text-muted);
}

/* ─────────────────────────────────────────
   Header  
───────────────────────────────────────── */
.header {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 32px;
  gap: 16px;
  position: sticky;
  top: 0; z-index: 50;
}

.header-title {
  font-size: 16px; font-weight: 600;
  flex: 1;
  font-family: 'Syne', sans-serif;
}

.header-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-premium {
  background: linear-gradient(135deg, rgba(217,119,87,0.2), rgba(240,160,128,0.15));
  border: 1px solid rgba(217,119,87,0.4);
  color: var(--accent-light);
}

.badge-free {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.badge-admin {
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3);
  color: #a5b4fc;
}

/* ─────────────────────────────────────────
   Buttons
───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  text-decoration: none;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(217,119,87,0.3);
}
.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(217,119,87,0.4);
}

.btn-glass {
  background: rgba(217, 119, 87, 0.1);
  border: 1px solid rgba(217, 119, 87, 0.35);
  backdrop-filter: blur(12px);
  color: var(--accent);
}
.btn-glass:hover {
  background: rgba(217, 119, 87, 0.2);
  border-color: rgba(217, 119, 87, 0.6);
  color: var(--accent-light);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--text-muted);
}
.btn-outline:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.btn-danger {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #f87171;
}
.btn-danger:hover {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.5);
  color: #fca5a5;
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn-icon { padding: 8px; }

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

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-body { padding: 20px; }
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 {
  font-size: 15px; font-weight: 600;
}

.card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--surface-2);
}

.card-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  color: var(--accent);
}
.card-thumb-placeholder svg { width: 32px; height: 32px; }

/* Training card grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.training-card .card-body h3 {
  font-size: 15px; font-weight: 600; margin-bottom: 6px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.training-card .card-body p {
  font-size: 13px; color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.training-card .card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ─────────────────────────────────────────
   Forms
───────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control::placeholder { color: var(--text-subtle); }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A8A8A' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
}

textarea.form-control { min-height: 100px; resize: vertical; }

.form-check {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
}
.form-check input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* ─────────────────────────────────────────
   Auth Pages
───────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(217,119,87,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.auth-page::after {
  content: '';
  position: absolute;
  bottom: -200px; left: -200px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(217,119,87,0.04) 0%, transparent 70%);
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

.auth-logo {
  text-align: center;
  margin-bottom: 8px;
}

.auth-logo-text {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -1px;
}

.auth-tagline {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────
   Flash Messages
───────────────────────────────────────── */
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
  animation: slideDown 0.3s ease;
}

.flash-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  color: #86efac;
}

.flash-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  color: #fca5a5;
}

.flash-info {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  color: #93c5fd;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────
   Tables
───────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead tr {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

tbody td {
  padding: 12px 16px;
  color: var(--text);
  vertical-align: middle;
}

/* ─────────────────────────────────────────
   Video Player
───────────────────────────────────────── */
.video-wrapper {
  position: relative;
  padding-top: 56.25%;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.video-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* ─────────────────────────────────────────
   Lesson Layout
───────────────────────────────────────── */
.lesson-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}

.lesson-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.lesson-sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600;
  background: var(--surface-2);
}

.lesson-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  text-decoration: none;
}

.lesson-item:hover { background: var(--surface-2); color: var(--text); }
.lesson-item.active { color: var(--accent); background: rgba(217,119,87,0.06); }

.lesson-item-check {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-hover);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px;
}

.lesson-item-check.done {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ─────────────────────────────────────────
   Q&A
───────────────────────────────────────── */
.qa-section { margin-top: 32px; }

.qa-title {
  font-size: 18px; font-weight: 700;
  margin-bottom: 20px;
}

.qa-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
}

.qa-meta {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
  font-size: 12px; color: var(--text-muted);
}

.qa-author { font-weight: 600; color: var(--text); }

.qa-body { font-size: 14px; line-height: 1.7; }

.qa-replies { margin-left: 24px; margin-top: 10px; }
.qa-reply {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  margin-bottom: 8px;
  font-size: 13px;
}

/* ─────────────────────────────────────────
   Premium Popup
───────────────────────────────────────── */
.premium-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.premium-overlay.is-open {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.premium-popup {
  background: var(--surface);
  border: 1px solid rgba(217,119,87,0.3);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8), 0 0 0 1px rgba(217,119,87,0.15);
  animation: popupIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}

@keyframes popupIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.premium-popup-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

.premium-popup h2 {
  font-size: 22px; font-weight: 700;
  margin-bottom: 10px;
}

.premium-popup p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
  line-height: 1.7;
}

.premium-popup .btn-glass {
  width: 100%;
  justify-content: center;
  font-size: 15px;
  padding: 13px;
  margin-bottom: 10px;
}

/* ─────────────────────────────────────────
   Page Headings
───────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 26px; font-weight: 800;
  letter-spacing: -0.5px;
}

.page-header h1 span { color: var(--accent); }

/* ─────────────────────────────────────────
   Stats Cards (Admin)
───────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s, transform 0.2s;
}

.stat-card:hover {
  border-color: rgba(217,119,87,0.3);
  transform: translateY(-2px);
}

.stat-card-icon {
  margin-bottom: 10px;
  display: block;
  color: var(--accent);
}
.stat-card-icon svg {
  width: 24px;
  height: 24px;
}

.stat-card-value {
  font-size: 32px; font-weight: 800;
  color: var(--accent);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ─────────────────────────────────────────
   Progress bar
───────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 100px;
  transition: width 0.5s ease;
}

/* ─────────────────────────────────────────
   Quill Editor styles
───────────────────────────────────────── */
.quill-container .ql-toolbar {
  background: var(--surface-2);
  border-color: var(--border-hover) !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.quill-container .ql-container {
  background: var(--surface-2);
  border-color: var(--border-hover) !important;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  min-height: 200px;
}

.quill-container .ql-editor { color: var(--text); min-height: 200px; }
.ql-toolbar .ql-stroke { stroke: var(--text-muted) !important; }
.ql-toolbar .ql-fill { fill: var(--text-muted) !important; }
.ql-toolbar .ql-picker { color: var(--text-muted) !important; }
.ql-toolbar button:hover .ql-stroke { stroke: var(--accent) !important; }
.ql-toolbar button.ql-active .ql-stroke { stroke: var(--accent) !important; }

/* ─────────────────────────────────────────
   Post content rendering
───────────────────────────────────────── */
.post-content h1, .post-content h2, .post-content h3 {
  font-weight: 700; margin: 20px 0 10px; color: var(--text);
}
.post-content p { margin-bottom: 14px; line-height: 1.8; }
.post-content ul, .post-content ol { margin: 12px 0 12px 24px; }
.post-content li { margin-bottom: 6px; }
.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 16px 0;
  color: var(--text-muted);
}
.post-content code {
  background: var(--surface-3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--accent-light);
}
.post-content pre {
  background: var(--surface-3);
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 16px 0;
}
.post-content img { border-radius: var(--radius-sm); margin: 16px 0; }

/* ─────────────────────────────────────────
   Empty state
───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; display: block; color: var(--accent); }
.empty-state-icon svg { width: 48px; height: 48px; }
.empty-state h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 14px; }

/* ─────────────────────────────────────────
   Utilities
───────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ─────────────────────────────────────────
   Mobile sidebar toggle / close buttons
───────────────────────────────────────── */
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.sidebar-close:hover {
  background: var(--surface-2);
  color: var(--text);
}
.sidebar-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}
.sidebar-toggle:hover { background: var(--surface-2); }
.sidebar-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: background 0.2s;
}
.sidebar-toggle:hover span { background: var(--text); }

/* Overlay behind the sidebar on mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ─────────────────────────────────────────
   Responsive
───────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }
  .sidebar-overlay { display: block; }
  .sidebar-close { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
    z-index: 100;
  }
  .sidebar.open { transform: translateX(0); }

  .main-content { margin-left: 0; }
  .lesson-layout { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }
  .page-wrapper { padding: 20px; }
}
