/* =============================================
   SUDO-CODINGTEACHER — Global Stylesheet
   ============================================= */

:root {
  --bg:          #0f1117;
  --bg2:         #1a1d27;
  --bg3:         #22263a;
  --border:      #2e3349;
  --text:        #e2e8f0;
  --text-muted:  #8892a4;
  --primary:     #6c63ff;
  --primary-h:   #5a52e0;
  --success:     #22c55e;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --info:        #38bdf8;
  --ps-color:    #2563eb;
  --py-color:    #16a34a;
  --php-color:   #7c3aed;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 4px 24px rgba(0,0,0,.4);
  --transition:  .18s ease;
  --font:        'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

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

h1,h2,h3,h4 { font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- LAYOUT ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.page-wrap  { padding: 2rem 0; }

/* ---- APP SHELL (sidebar layout) ---- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.app-sidebar {
  width: 220px;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, #0f172a 0%, #1a2744 55%, #0a0f1e 100%);
  border-right: 1px solid rgba(255,255,255,0.07);
}
/* Grid pattern overlay */
.app-sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* Logo area */
.sidebar-logo {
  position: relative;
  z-index: 1;
  padding: .75rem .25rem .75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}
.sidebar-logo-img {
  display: block;
  width: 110%;
  margin-left: -5%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.6);
}

/* User info */
.sidebar-user {
  position: relative;
  z-index: 1;
  padding: .75rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.sidebar-username {
  font-size: .8rem;
  font-weight: 600;
  color: rgba(255,255,255,.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-role-badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  border-radius: 99px;
  font-size: .67rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  width: fit-content;
}
.role-user       { background: rgba(100,116,139,.2); color: #94a3b8; border: 1px solid rgba(100,116,139,.3); }
.role-admin      { background: rgba(37,99,235,.2);   color: #60a5fa; border: 1px solid rgba(37,99,235,.3); }
.role-superadmin { background: rgba(220,38,38,.2);   color: #f87171; border: 1px solid rgba(220,38,38,.3); }

/* Nav links */
.sidebar-nav {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: .6rem .5rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .8rem;
  border-radius: 10px;
  font-size: .82rem;
  font-weight: 500;
  color: rgba(255,255,255,.55);
  text-decoration: none !important;
  transition: all .15s ease;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 2px 6px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.05);
}
.sidebar-link:hover {
  color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.09);
  transform: translateY(-1px);
}
.sidebar-link.active {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  box-shadow: 0 4px 16px rgba(79,70,229,.55), inset 0 1px 0 rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.18);
}
.sidebar-link-icon { font-size: 1rem; flex-shrink: 0; width: 18px; text-align: center; }
.sidebar-section-label {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.25);
  padding: .5rem .8rem .15rem;
  font-weight: 600;
}

/* Sidebar footer */
.sidebar-footer {
  position: relative;
  z-index: 1;
  padding: .6rem .5rem;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .5rem .8rem;
  border-radius: 10px;
  font-size: .82rem;
  color: rgba(255,255,255,.4);
  background: none;
  border: none;
  cursor: pointer;
  transition: all .15s ease;
  font-family: var(--font);
}
.sidebar-logout:hover { color: #f87171; background: rgba(239,68,68,.1); }

/* Mobile toggle */
.sidebar-mobile-toggle {
  display: none;
  position: fixed;
  top: .75rem; left: .75rem;
  z-index: 60;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  border: none;
  border-radius: 8px;
  color: #fff;
  width: 38px; height: 38px;
  cursor: pointer;
  font-size: 1.1rem;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(79,70,229,.5);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 45;
  backdrop-filter: blur(2px);
}

/* ---- APP MAIN ---- */
.app-main {
  margin-left: 220px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.app-main::before {
  content: '';
  position: fixed;
  top: 50%;
  left: calc(50% + 110px);
  transform: translate(-50%, -50%);
  width: 720px;
  aspect-ratio: 680/300;
  background-image: url('/assets/mss-logo.svg');
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.09;
  pointer-events: none;
  z-index: 0;
}

/* ---- MAIN CONTENT ---- */
.main-content { max-width: 1200px; margin: 0 auto; padding: 1.5rem; width: 100%; }

/* ---- RESPONSIVE SIDEBAR ---- */
@media (max-width: 768px) {
  .app-sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .app-sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; padding-top: 56px; }
  .sidebar-mobile-toggle { display: flex; }
  .sidebar-overlay.open { display: block; }
}

/* ---- LEGACY NAVBAR (solo login page) ---- */
.navbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.navbar-user { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.user-name { color: var(--text); font-weight: 500; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  transition: var(--transition);
  font-family: var(--font);
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); }

.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #16a34a; }

.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

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

.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-outline:hover:not(:disabled) { background: var(--bg3); color: var(--text); border-color: var(--primary); }
.btn-outline.active { border-color: var(--primary); color: var(--primary); background: rgba(108,99,255,.08); }

.btn-sm { padding: .3rem .75rem; font-size: .8rem; }
.btn-lg { padding: .7rem 1.5rem; font-size: 1rem; }
.btn-full, .btn-block { width: 100%; justify-content: center; }

/* ---- CARDS ---- */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.card-sm { padding: 1rem; }
.card-title { margin-bottom: 1.25rem; font-size: 1.1rem; }
.card-hover {
  cursor: pointer;
  transition: var(--transition);
}
.card-hover:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(108,99,255,.15);
}

/* ---- FORMS ---- */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: .4rem;
}
.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: .55rem .9rem;
  font-size: .9rem;
  font-family: var(--font);
  transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,.15); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.badge-primary  { background: rgba(108,99,255,.18); color: var(--primary); }
.badge-success, .badge-green  { background: rgba(34,197,94,.15);  color: var(--success); }
.badge-warning, .badge-yellow { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-danger,  .badge-red    { background: rgba(239,68,68,.15);  color: var(--danger); }
.badge-info,    .badge-blue   { background: rgba(56,189,248,.15); color: var(--info); }
.badge-purple   { background: rgba(124,58,237,.18); color: #c084fc; }
.badge-muted    { background: var(--bg3); color: var(--text-muted); }

/* Linguaggi */
.badge-ps  { background: rgba(37,99,235,.18);  color: #60a5fa; }
.badge-py  { background: rgba(22,163,74,.18);  color: #4ade80; }
.badge-php { background: rgba(124,58,237,.18); color: #c084fc; }

/* Livelli */
.badge-beginner     { background: rgba(34,197,94,.12);  color: var(--success); }
.badge-intermediate { background: rgba(245,158,11,.12); color: var(--warning); }
.badge-advanced     { background: rgba(239,68,68,.12);  color: var(--danger); }

/* ---- PROGRESS BAR ---- */
.progress-wrap { background: var(--bg3); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-bar-wrap { background: var(--bg3); border-radius: 99px; height: 5px; overflow: hidden; margin-bottom: .3rem; }
.progress-bar  {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), #a78bfa);
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.progress-bar.green  { background: linear-gradient(90deg, var(--success), #4ade80); }
.progress-bar.orange { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.progress-text { font-size: .75rem; color: var(--text-muted); }
.progress-label { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; display: block; }

/* ---- ALERTS ---- */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  margin-bottom: 1rem;
}
.alert-danger  { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.1);  border: 1px solid rgba(34,197,94,.3);  color: #86efac; }
.alert-info    { background: rgba(56,189,248,.1); border: 1px solid rgba(56,189,248,.3); color: #7dd3fc; }
.alert-warning { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3); color: #fcd34d; }

/* ---- TABS ---- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn {
  padding: .6rem 1.1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  transition: var(--transition);
  font-family: var(--font);
  margin-bottom: -1px;
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  text-align: left;
  padding: .65rem 1rem;
  background: var(--bg3);
  color: var(--text-muted);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: .65rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg3); }

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
  animation: modal-in .18s ease;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-close  { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; }
.modal-footer { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; }
@keyframes modal-in { from { opacity:0; transform:scale(.96) } to { opacity:1; transform:scale(1) } }

/* ---- SPINNER ---- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ---- TOAST ---- */
#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  padding: .75rem 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: .875rem;
  max-width: 320px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
#toast.toast-success { border-left: 3px solid var(--success); }
#toast.toast-danger  { border-left: 3px solid var(--danger); }
#toast.toast-info    { border-left: 3px solid var(--primary); }
#toast.toast-warning { border-left: 3px solid var(--warning); }

/* ---- STATS GRID ---- */
.stats-section { margin-bottom: 2rem; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 1rem; }
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.stat-icon  { font-size: 1.5rem; margin-bottom: .4rem; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }

/* ---- COURSES SECTION ---- */
.courses-section { }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.section-header h2 { font-size: 1.15rem; }
.filter-bar { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---- COURSE CARDS ---- */
.courses-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 1.25rem; }
.course-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.course-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 32px rgba(108,99,255,.15); }
.course-card-header { margin-bottom: .75rem; }
.course-card-badges { display: flex; gap: .4rem; flex-wrap: wrap; }
.course-card-title { font-size: 1rem; margin-bottom: .4rem; }
.course-card-desc { font-size: .82rem; color: var(--text-muted); margin-bottom: .75rem; line-height: 1.5; flex: 1; }
.course-card-footer { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: auto; }
.course-progress { flex: 1; }

/* Lang accent bar */
.course-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #a78bfa);
}

/* ---- BREADCRUMB ---- */
.breadcrumb { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb-sep { opacity: .4; }

/* ---- COURSE HEADER BLOCK ---- */
.course-header-block {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.course-header-info { flex: 1; }
.course-header-badges { display: flex; gap: .4rem; margin-bottom: .6rem; flex-wrap: wrap; }
.course-header-title { font-size: 1.4rem; margin-bottom: .4rem; }
.course-header-desc { color: var(--text-muted); font-size: .875rem; }
.course-header-progress { min-width: 150px; text-align: center; }
.progress-ring-label { display: flex; flex-direction: column; align-items: center; }
.progress-big { font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1; }
.progress-sub { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; }

/* ---- COURSE LAYOUT ---- */
.course-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* ---- LESSON SIDEBAR ---- */
.lesson-sidebar {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem .75rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 1;
}
.sidebar-header h3 { font-size: .875rem; font-weight: 600; }
.sidebar-progress-label { font-size: .78rem; color: var(--text-muted); }
.lesson-list { padding: .5rem; }
.lesson-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.lesson-item:hover { background: var(--bg3); }
.lesson-item.active { background: rgba(108,99,255,.12); }
.lesson-item.completed .lesson-check { color: var(--success); }
.lesson-num { font-size: .7rem; color: var(--text-muted); width: 20px; flex-shrink: 0; text-align: right; }
.lesson-item-title { flex: 1; font-size: .82rem; line-height: 1.3; }
.lesson-check { font-size: .85rem; flex-shrink: 0; color: var(--border); }

/* ---- LESSON CONTENT AREA ---- */
.lesson-content-area {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 500px;
  overflow: hidden;
}
.lesson-content-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
  min-height: 400px;
}
.placeholder-icon { font-size: 3.5rem; margin-bottom: 1rem; opacity: .4; }

/* ---- LESSON VIEW ---- */
.lesson-view { padding: 1.5rem; }
.lesson-view-header { margin-bottom: 1.5rem; }
.lesson-view-badges { display: flex; gap: .4rem; margin-bottom: .6rem; flex-wrap: wrap; align-items: center; }
.lesson-view-title { font-size: 1.2rem; margin-bottom: .4rem; }
.lesson-theory { margin-bottom: 2rem; }
.lesson-exercises-section { margin-bottom: 2rem; }
.section-label {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: .75rem;
  font-weight: 600;
  display: block;
}
.theory-content { line-height: 1.8; font-size: .9rem; }
.theory-content h1, .theory-content h2, .theory-content h3 { margin: 1.25rem 0 .5rem; color: var(--text); }
.theory-content code {
  background: var(--bg3);
  padding: .15rem .4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: .85em;
  color: var(--info);
}
.theory-content pre.code-block {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  overflow-x: auto;
  margin: .75rem 0;
}
.theory-content pre.code-block code { background: none; padding: 0; color: var(--text); font-size: .85rem; }

/* ---- EXERCISE CARD ---- */
.exercise-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  margin-bottom: 1rem;
}
.exercise-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.exercise-num { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.exercise-title { font-size: .95rem; margin-bottom: .4rem; }
.exercise-desc { font-size: .82rem; color: var(--text-muted); margin-bottom: .75rem; line-height: 1.5; }

/* ---- LESSON NAV ---- */
.lesson-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ---- LOGIN PAGE ---- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 60% 30%, rgba(108,99,255,.12) 0%, transparent 70%),
              var(--bg);
}
.login-container { width: 100%; max-width: 860px; padding: 1rem; }
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.logo-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  margin: 0 auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.45), 0 3px 10px rgba(0,0,0,0.25);
}
.login-logo p { color: var(--text-muted); font-size: .875rem; margin-top: .5rem; }
.login-footer { text-align: center; color: var(--text-muted); font-size: .78rem; margin-top: 1.25rem; }

/* ---- STREAK BADGE ---- */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: rgba(245,158,11,.12);
  color: var(--warning);
  border-radius: 99px;
  padding: .25rem .7rem;
  font-size: .8rem;
  font-weight: 600;
}

/* ---- SIDEBAR LAYOUT (generic) ---- */
.sidebar-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1.5rem; align-items: start; }
.sidebar {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.sidebar h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 1rem; }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; display: block; opacity: .4; }
.empty-state p { margin-top: .5rem; font-size: .9rem; }

/* ---- CODE EDITOR AREA (FASE 4) ---- */
.editor-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg3);
}
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .75rem;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  font-size: .78rem;
  color: var(--text-muted);
}
.code-editor {
  width: 100%;
  min-height: 220px;
  background: var(--bg3);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .875rem;
  border: none;
  outline: none;
  padding: 1rem;
  resize: vertical;
  line-height: 1.6;
  tab-size: 4;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .course-layout { grid-template-columns: 1fr; }
  .lesson-sidebar { position: static; max-height: 300px; }
  .course-header-block { flex-direction: column; }
  .sidebar-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
}
@media (max-width: 768px) {
  .courses-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  h1 { font-size: 1.4rem; }
}
@media (max-width: 600px) {
  .navbar-links { display: none; }
  .lesson-nav { flex-direction: column; align-items: stretch; }
  .lesson-nav button, .lesson-nav a { width: 100%; text-align: center; justify-content: center; }
}

/* ---- UTILS ---- */
.flex   { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1  { gap: .5rem; }
.gap-2  { gap: 1rem; }
.mt-1   { margin-top: .5rem; }
.mt-2   { margin-top: 1rem; }
.mt-3   { margin-top: 1.5rem; }
.mb-1   { margin-bottom: .5rem; }
.mb-2   { margin-bottom: 1rem; }
.mb-3   { margin-bottom: 1.5rem; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: .85rem; }
.text-xs     { font-size: .75rem; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.font-mono   { font-family: var(--font-mono); }
.hidden { display: none !important; }
.w-full { width: 100%; }
