/* ===== GLOBAL — Light Theme: Ag / Qirmizi / Qara ===== */
:root {
  --primary: #dc2626;
  --primary-light: #ef4444;
  --primary-dark: #991b1b;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --success: #10b981;
  --success-light: #34d399;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 6px rgba(0,0,0,.08), 0 10px 30px rgba(0,0,0,.06);
  --radius: 12px;
  --radius-lg: 16px;
  --transition: .2s ease;
}

* { box-sizing: border-box; }

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

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

/* ===== NAVBAR ===== */
.navbar-custom {
  background: linear-gradient(135deg, #0a0a0a, #1a1a1a);
  border-bottom: 3px solid var(--primary);
  box-shadow: 0 2px 16px rgba(220,38,38,.15);
  padding: .75rem 0;
}
.navbar-custom .navbar-brand {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -.5px;
  color: #fff !important;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.navbar-custom .navbar-brand .brand-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.navbar-custom .nav-link {
  color: rgba(255,255,255,.85) !important;
  font-weight: 500;
  padding: .5rem .85rem !important;
  border-radius: 8px;
  transition: var(--transition);
  font-size: .9rem;
}
.navbar-custom .nav-link:hover {
  color: #fff !important;
  background: rgba(220,38,38,.2);
}
.navbar-custom .user-badge {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  padding: .35rem .75rem;
  border-radius: 20px;
  color: #fff;
  font-size: .85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.navbar-custom .user-badge .avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: #fff;
}
.navbar-custom .btn-logout {
  background: rgba(220,38,38,.15);
  border: 1px solid rgba(220,38,38,.3);
  color: #fff;
  font-size: .85rem;
  padding: .35rem .75rem;
  border-radius: 8px;
  transition: var(--transition);
}
.navbar-custom .btn-logout:hover {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
}
.navbar-custom .navbar-toggler {
  border: 1px solid rgba(255,255,255,.2);
}
.navbar-custom .navbar-toggler-icon {
  filter: invert(1);
}

/* ===== CONTAINER OVERRIDE ===== */
.main-content { padding: 2rem 0 3rem; }

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: var(--transition);
  color: var(--text);
}
.card:hover { box-shadow: var(--shadow-lg); }

.card-header-gradient {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
  padding: 1.25rem 1.5rem;
  border: none;
}
.card-header-gradient h4,
.card-header-gradient h5 { margin: 0; font-weight: 700; }
.card-header-gradient small { opacity: .85; }

.card-header-warning {
  background: linear-gradient(135deg, #b45309, #f59e0b);
  color: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
  padding: 1.25rem 1.5rem;
  border: none;
}
.card-header-warning h4 { margin: 0; font-weight: 700; }
.card-header-warning small { opacity: .8; }

.card-header-success {
  background: linear-gradient(135deg, #059669, var(--success-light));
  color: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
  padding: 1.25rem 1.5rem;
  border: none;
}
.card-header-success h4 { margin: 0; font-weight: 700; }

/* ===== AUTH PAGES (Login / Register) ===== */
.auth-wrapper {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  animation: fadeUp .4s ease;
}
.auth-card.wide { max-width: 680px; }
.auth-card .card { border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.auth-card .auth-header {
  text-align: center;
  padding: 2rem 2rem 0;
}
.auth-card .auth-header .auth-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: 14px;
  display: inline-flex;
  align-items: center; justify-content: center;
  margin-bottom: .75rem;
  font-size: 1.5rem; color: #fff;
}
.auth-card .auth-header h3 {
  font-weight: 800;
  font-size: 1.5rem;
  margin-bottom: .25rem;
  color: var(--text);
}
.auth-card .auth-header p {
  color: var(--text-muted);
  font-size: .9rem;
}
.auth-card .card-body { padding: 1.5rem 2rem 2rem; }

/* ===== FORM CONTROLS ===== */
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: .6rem .85rem;
  font-size: .9rem;
  transition: var(--transition);
  background-color: #ffffff;
  color: var(--text);
}
.form-control::placeholder { color: #9ca3af; }
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(220,38,38,.12);
  background-color: #ffffff;
  color: var(--text);
}
.form-select {
  background-color: #ffffff;
  color: var(--text);
}
.form-select option {
  background: #fff;
  color: var(--text);
}
.form-label {
  font-weight: 600;
  font-size: .85rem;
  color: var(--text);
  margin-bottom: .35rem;
}

/* ===== BUTTONS ===== */
.btn { border-radius: 10px; font-weight: 600; font-size: .9rem; padding: .6rem 1.25rem; transition: var(--transition); }

.btn-primary-custom {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border: none; color: #fff;
  box-shadow: 0 2px 8px rgba(220,38,38,.3);
}
.btn-primary-custom:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  box-shadow: 0 4px 12px rgba(220,38,38,.4);
  color: #fff;
  transform: translateY(-1px);
}

.btn-warning-custom {
  background: linear-gradient(135deg, #b45309, #f59e0b);
  border: none; color: #fff;
  box-shadow: 0 2px 8px rgba(245,158,11,.3);
}
.btn-warning-custom:hover {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  box-shadow: 0 4px 12px rgba(245,158,11,.4);
  color: #fff;
  transform: translateY(-1px);
}

.btn-success-custom {
  background: linear-gradient(135deg, #059669, var(--success));
  border: none; color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,.3);
}
.btn-success-custom:hover {
  background: linear-gradient(135deg, var(--success), var(--success-light));
  box-shadow: 0 4px 12px rgba(16,185,129,.4);
  color: #fff;
  transform: translateY(-1px);
}

.btn-danger-custom {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border: none; color: #fff;
  box-shadow: 0 2px 8px rgba(220,38,38,.3);
}
.btn-danger-custom:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  box-shadow: 0 4px 12px rgba(220,38,38,.4);
  color: #fff;
}

.btn-outline-custom {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}
.btn-outline-custom:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(220,38,38,.05);
}

/* ===== RATING BUTTONS ===== */
.rating-group {
  display: flex;
  gap: .5rem;
}
.rating-group .rating-btn {
  width: 48px; height: 48px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: #f9fafb;
  display: flex;
  align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s ease;
  position: relative;
}
.rating-group .rating-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(220,38,38,.05);
  transform: translateY(-2px);
}
.rating-group input[type="radio"] { display: none; }
.rating-group input[type="radio"]:checked + .rating-btn {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(220,38,38,.3);
  transform: translateY(-2px);
}
.rating-group .rating-label-text {
  font-size: .7rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: .25rem;
}

/* ===== SURVEY QUESTION ===== */
.survey-question {
  background: #f9fafb;
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.survey-question:hover { border-color: var(--primary); }
.survey-question .q-number {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: .8rem;
  margin-right: .5rem;
}
.survey-question .q-text {
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: .75rem;
  color: var(--text);
}

/* ===== ALERT / NOTICE ===== */
.notice {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  font-size: .9rem;
  margin-bottom: 1.25rem;
}
.notice-info {
  background: rgba(59,130,246,.06);
  border: 1px solid rgba(59,130,246,.2);
  color: #2563eb;
}
.notice-warning {
  background: rgba(245,158,11,.06);
  border: 1px solid rgba(245,158,11,.2);
  color: #b45309;
}
.notice-success {
  background: rgba(16,185,129,.06);
  border: 1px solid rgba(16,185,129,.2);
  color: #059669;
}
.notice-danger {
  background: rgba(239,68,68,.06);
  border: 1px solid rgba(239,68,68,.2);
  color: #dc2626;
}
.notice-icon { font-size: 1.25rem; flex-shrink: 0; margin-top: .1rem; }

/* ===== STUDENT DASHBOARD ===== */
.welcome-banner {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: var(--radius-lg);
  padding: 2rem;
  color: #fff;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 20px rgba(220,38,38,.2);
}
.welcome-banner h2 { font-weight: 800; margin-bottom: .25rem; }
.welcome-banner p { opacity: .85; margin: 0; }

.lesson-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}
.lesson-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.lesson-card .lesson-num {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem;
  flex-shrink: 0;
}
.lesson-card .lesson-info { flex: 1; min-width: 0; }
.lesson-card .lesson-info h6 {
  font-weight: 700;
  margin-bottom: .15rem;
  font-size: .95rem;
  color: var(--text);
}
.lesson-card .lesson-info .lesson-meta {
  font-size: .8rem;
  color: var(--text-muted);
}
.lesson-card .lesson-actions {
  display: flex;
  gap: .5rem;
  flex-shrink: 0;
}

.status-badge {
  padding: .3rem .7rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.status-done {
  background: rgba(16,185,129,.1);
  color: #059669;
  border: 1px solid rgba(16,185,129,.25);
}
.status-pending {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.status-pending:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(220,38,38,.3);
}
.status-pending-warn {
  background: transparent;
  color: #b45309;
  border: 1.5px solid var(--accent);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.status-pending-warn:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(245,158,11,.3);
}
.status-locked {
  background: rgba(0,0,0,.03);
  color: #9ca3af;
  border: 1px solid #d1d5db;
  cursor: not-allowed;
}
.status-wait {
  background: rgba(245,158,11,.06);
  color: #b45309;
  border: 1px solid rgba(245,158,11,.2);
  cursor: not-allowed;
}
.status-file {
  background: rgba(59,130,246,.06);
  color: #2563eb;
  border: 1.5px solid rgba(59,130,246,.25);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.status-file:hover {
  background: #2563eb;
  color: #fff;
  transform: translateY(-1px);
}
.status-file-done {
  background: rgba(16,185,129,.08);
  color: #059669;
  border: 1px solid rgba(16,185,129,.25);
}

/* ===== TEACHER SIDEBAR ===== */
.sidebar-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--card-bg);
}
.sidebar-card .sidebar-header {
  background: linear-gradient(135deg, #1a1a1a, #333);
  color: #fff;
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: .95rem;
}
.sidebar-card .list-group-item {
  border: none;
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.25rem;
  font-size: .9rem;
  transition: var(--transition);
  background: var(--card-bg);
  color: var(--text);
}
.sidebar-card .list-group-item:hover {
  background: #f9fafb;
}
.sidebar-card .list-group-item.active {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-color: transparent;
  color: #fff;
}
.sidebar-card .list-group-item .badge {
  font-size: .7rem;
  padding: .25rem .5rem;
}

/* ===== TEACHER TABLE ===== */
.modern-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}
.modern-table thead th {
  background: #f9fafb;
  padding: .75rem 1rem;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.modern-table tbody td {
  padding: .75rem 1rem;
  font-size: .9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.modern-table tbody tr { transition: var(--transition); }
.modern-table tbody tr:hover { background: #f9fafb; }
.modern-table tbody tr:last-child td { border-bottom: none; }

/* ===== CONFIRM TABLE ===== */
.confirm-table td {
  padding: .65rem .5rem;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  color: var(--text);
}
.confirm-table td:first-child {
  color: var(--text-muted);
  font-weight: 500;
  width: 40%;
}
.confirm-table tr:last-child td { border-bottom: none; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: .75rem;
  opacity: .5;
}
.empty-state h5 { font-weight: 700; color: var(--text); }
.empty-state p { font-size: .9rem; }

/* ===== MODUL SECTION ===== */
.modul-section {
  margin-bottom: 2rem;
}
.modul-header {
  background: linear-gradient(135deg, #1a1a1a, #333);
  color: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: .75rem 1.25rem;
  font-weight: 700;
  font-size: .95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modul-header .modul-count {
  background: rgba(255,255,255,.2);
  padding: .15rem .6rem;
  border-radius: 12px;
  font-size: .75rem;
}

/* ===== QUESTIONS PANEL ===== */
.questions-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.questions-panel .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.questions-panel .panel-header h5 {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
}
.questions-panel .panel-body {
  padding: 1rem 1.25rem;
  max-height: 400px;
  overflow-y: auto;
}
.question-item {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: .5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  transition: opacity .3s;
}
.question-item .q-content {
  flex: 1;
  font-size: .9rem;
}
.question-item .q-time {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .25rem;
}
.question-item .q-dismiss {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  font-size: 1rem;
  padding: 0;
}
.question-item .q-dismiss:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.question-item .q-dismiss i {
  pointer-events: none;
}

/* ===== QUESTION COUNT BADGE ===== */
.count-badge {
  background: var(--primary);
  color: #fff;
  padding: .15rem .55rem;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
}

/* ===== UPLOAD MODAL / DRAG DROP ===== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  background: #f9fafb;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: rgba(220,38,38,.03);
}
.upload-zone .upload-icon {
  font-size: 2.5rem;
  color: var(--text-muted);
  margin-bottom: .5rem;
}
.upload-zone.drag-over .upload-icon { color: var(--primary); }
.upload-zone p { color: var(--text-muted); margin: 0; font-size: .9rem; }
.upload-zone .upload-hint { font-size: .8rem; color: #9ca3af; margin-top: .5rem; }

.upload-progress {
  margin-top: 1rem;
  display: none;
}
.upload-progress .progress {
  height: 8px;
  border-radius: 4px;
  background: #e5e7eb;
}
.upload-progress .progress-bar {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: 4px;
  transition: width .3s;
}

.upload-result {
  margin-top: .75rem;
  font-size: .85rem;
  display: none;
}

/* ===== STUDENT QUESTION FORM ===== */
.question-form-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 1.5rem;
  box-shadow: var(--shadow);
}
.question-form-card h5 {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: .75rem;
}

/* ===== TABS FOR MODULES ===== */
.modul-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.modul-tab {
  padding: .5rem 1.25rem;
  border-radius: 20px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
}
.modul-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.modul-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ===== LESSON MANAGEMENT ===== */
.lesson-manage-item {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.lesson-manage-item .lm-info h6 {
  margin: 0;
  font-weight: 600;
  font-size: .9rem;
}
.lesson-manage-item .lm-info small {
  color: var(--text-muted);
  font-size: .8rem;
}
.lesson-manage-item .lm-actions {
  display: flex;
  gap: .5rem;
}

/* ===== MODAL ===== */
.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-lg);
}
.modal-header {
  border-bottom: 1px solid var(--border);
}
.modal-footer {
  border-top: 1px solid var(--border);
}

/* ===== SIDEBAR MODUL DIVIDER ===== */
.sidebar-modul-divider {
  padding: .5rem 1rem;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  background: #f9fafb;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}

/* ===== MISC ===== */
.text-muted { color: var(--text-muted) !important; }
.badge.bg-success { background: var(--success) !important; }
.badge.bg-danger { background: var(--primary) !important; }

/* ===== ANIMATION ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .4s ease; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

/* ===== NEW QUESTION FLASH ===== */
@keyframes flashNew {
  0% { background: rgba(220,38,38,.1); }
  100% { background: #f9fafb; }
}
.question-new {
  animation: flashNew 1s ease;
}

/* ===== CHAT LIST ===== */
.chat-list-item {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: var(--transition);
}
.chat-list-item:hover {
  background: #f9fafb;
  color: var(--text);
}
.chat-list-item:last-child { border-bottom: none; }
.chat-list-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
  flex-shrink: 0;
}
.chat-list-info { flex: 1; min-width: 0; }
.chat-list-name {
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.chat-list-preview {
  font-size: .8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: .1rem;
}
.chat-list-time {
  font-size: .75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.chat-unread-count {
  background: var(--primary);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* ===== CHAT PAGE ===== */
.chat-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 70px - 4rem);
  max-height: 800px;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  flex-shrink: 0;
}
.chat-back-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.04);
  color: var(--text);
  font-size: 1.1rem;
  transition: var(--transition);
  text-decoration: none;
}
.chat-back-btn:hover { background: rgba(0,0,0,.08); color: var(--text); }
.chat-header-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
  flex-shrink: 0;
}
.chat-header-info { flex: 1; }
.chat-header-name { font-weight: 700; font-size: .95rem; }
.chat-header-status { font-size: .75rem; color: var(--text-muted); }

/* ===== CHAT MESSAGES ===== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #f0f0f0;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: .9rem;
  gap: .5rem;
}
.chat-msg {
  display: flex;
  max-width: 75%;
}
.chat-msg-own {
  align-self: flex-end;
}
.chat-msg-other {
  align-self: flex-start;
}
.chat-bubble {
  padding: .5rem .75rem;
  border-radius: 12px;
  font-size: .9rem;
  line-height: 1.4;
  word-break: break-word;
  position: relative;
}
.chat-msg-own .chat-bubble {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg-other .chat-bubble {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-time {
  font-size: .65rem;
  opacity: .7;
  margin-top: .25rem;
  text-align: right;
}
.chat-text { white-space: pre-wrap; }

/* Chat image */
.chat-img {
  max-width: 280px;
  max-height: 300px;
  border-radius: 8px;
  display: block;
  cursor: pointer;
}
.chat-img:hover { opacity: .9; }

/* Chat file link */
.chat-file-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .5rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
}
.chat-msg-own .chat-file-link {
  background: rgba(255,255,255,.15);
  color: #fff;
}
.chat-msg-other .chat-file-link {
  background: rgba(59,130,246,.08);
  color: #2563eb;
}
.chat-file-link i { font-size: 1.25rem; }
.chat-file-link span {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chat code block */
.chat-code {
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: 8px;
  padding: .6rem .75rem;
  font-size: .8rem;
  overflow-x: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}
.chat-msg-own .chat-code {
  background: rgba(0,0,0,.3);
  color: #e5e7eb;
}

/* ===== CHAT INPUT ===== */
.chat-input-area {
  padding: .6rem .75rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  flex-shrink: 0;
}
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
}
.chat-attach-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.04);
  color: var(--text-muted);
  font-size: 1.15rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.chat-attach-btn:hover { background: rgba(0,0,0,.08); color: var(--text); }
.chat-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: .5rem .85rem;
  font-size: .9rem;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  background: #f9fafb;
  color: var(--text);
  transition: var(--transition);
  font-family: inherit;
}
.chat-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(220,38,38,.08);
  background: #fff;
}
.chat-input::placeholder { color: #9ca3af; }
.chat-send-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(220,38,38,.3);
}
.chat-send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(220,38,38,.4);
}

/* ===== NAVBAR CHAT BADGE ===== */
.chat-nav-link { position: relative; }
.chat-unread-badge {
  background: var(--primary);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  padding: .1rem .35rem;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
  margin-left: .25rem;
  vertical-align: top;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .lesson-card { flex-direction: column; align-items: flex-start; }
  .lesson-card .lesson-actions { width: 100%; }
  .lesson-card .lesson-actions a,
  .lesson-card .lesson-actions span { flex: 1; text-align: center; }
  .rating-group .rating-btn { width: 42px; height: 42px; font-size: .9rem; }
  .welcome-banner { padding: 1.25rem; }
  .welcome-banner h2 { font-size: 1.25rem; }
  .auth-card .card-body { padding: 1.25rem; }
  .modul-tabs { gap: .35rem; }
  .modul-tab { padding: .4rem .85rem; font-size: .8rem; }
  .chat-page { height: calc(100vh - 60px - 2rem); max-height: none; }
  .chat-msg { max-width: 88%; }
  .chat-img { max-width: 220px; }
}
