/* ============================================================
   LERNWERK - Modern Learning Platform Styles
   ============================================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #475569;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --bg: #f1f5f9;
  --bg-white: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --radius: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ============ HEADER ============ */
.header {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-brand .icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-nav a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.875rem;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s;
}

.header-nav a:hover, .header-nav a.active {
  color: white;
  background: rgba(255,255,255,0.1);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
  color: #94a3b8;
}

.btn-logout {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #94a3b8;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.2);
  color: white;
}

/* ============ LOGIN ============ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.login-card {
  background: white;
  padding: 48px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
}

.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  text-align: center;
}

.login-card .subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 0.875rem;
}

/* ============ FORMS ============ */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
  color: var(--text);
}

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

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

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

.form-error {
  color: var(--danger);
  font-size: 0.8125rem;
  margin-top: 4px;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #15803d;
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

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

.btn-outline:hover {
  background: var(--bg);
  border-color: var(--text-secondary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 12px 28px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============ LAYOUT ============ */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.page-wide {
  max-width: 1400px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 4px;
}

/* ============ CARDS ============ */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.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: 1rem;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}

/* ============ GRID ============ */
.grid {
  display: grid;
  gap: 20px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ============ STAT CARDS ============ */
.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-card .stat-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

.stat-card .stat-sub {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* ============ SESSION CARDS ============ */
.session-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  border-left: 4px solid var(--primary);
}

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

.session-card .sc-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.session-card .sc-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.session-card .sc-theme {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* ============ PROGRESS BAR ============ */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width 0.3s ease;
}

.progress-bar .progress-fill.green { background: var(--success); }
.progress-bar .progress-fill.yellow { background: var(--warning); }

/* ============ TABLE ============ */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f8fafc;
}

tr:hover td {
  background: #f8fafc;
}

/* ============ BADGES ============ */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green { background: var(--success-light); color: var(--success); }
.badge-yellow { background: var(--warning-light); color: var(--warning); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-gray { background: #f1f5f9; color: var(--text-secondary); }

/* ============ TRAFFIC LIGHT ============ */
.traffic-light {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

.traffic-light.green { background: var(--success); box-shadow: 0 0 6px rgba(22,163,74,0.4); }
.traffic-light.yellow { background: var(--warning); box-shadow: 0 0 6px rgba(217,119,6,0.4); }
.traffic-light.red { background: var(--danger); box-shadow: 0 0 6px rgba(220,38,38,0.4); }

/* ============ TASK AREA ============ */
.task-container {
  max-width: 700px;
  margin: 0 auto;
}

.task-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.task-header {
  padding: 16px 24px;
  background: linear-gradient(135deg, #1e293b, #334155);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.task-header .task-module {
  font-size: 0.8125rem;
  opacity: 0.7;
}

.task-header .task-progress {
  font-size: 0.8125rem;
}

.task-body {
  padding: 32px 24px;
}

.task-question {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 24px;
  line-height: 1.5;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.no-copy {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.copy-warning {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #dc2626;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  z-index: 9999;
  animation: fadeInOut 2.5s ease forwards;
  pointer-events: none;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

.task-difficulty {
  display: flex;
  gap: 3px;
  margin-bottom: 16px;
}

.task-difficulty .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}

.task-difficulty .dot.active { background: var(--primary); }

.task-points {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.task-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

/* ============ TASK OPTIONS ============ */
.option-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-item {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9375rem;
}

.option-item:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option-item.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.option-item.wrong {
  border-color: var(--danger);
  background: var(--danger-light);
}

.option-radio {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-item.selected .option-radio {
  border-color: var(--primary);
}

.option-item.selected .option-radio::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}

.option-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.option-item.selected .option-checkbox {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

/* ============ ORDERING TASK ============ */
.ordering-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ordering-item {
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  cursor: grab;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9375rem;
  transition: all 0.2s;
}

.ordering-item:active { cursor: grabbing; }

.ordering-item .order-handle {
  color: var(--text-light);
  font-size: 1.2rem;
}

.ordering-item .order-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.ordering-item.dragging {
  opacity: 0.5;
  border-color: var(--primary);
}

.ordering-item.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.ordering-item .order-text { flex: 1; }

.ordering-item .order-buttons {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: auto;
}

.ordering-item .btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.65rem;
  padding: 2px 8px;
  color: var(--text-light);
  line-height: 1;
  touch-action: manipulation;
}

.ordering-item .btn-icon:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* ============ MATCHING TASK ============ */
.matching-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
}

.match-left {
  background: var(--primary-light);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-weight: 500;
  text-align: right;
}

.match-arrow {
  color: var(--text-light);
  font-size: 1.2rem;
}

.match-select {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  background: white;
  cursor: pointer;
}

.match-select:focus {
  border-color: var(--primary);
  outline: none;
}

/* ============ HINTS ============ */
.hint-area {
  margin-top: 20px;
}

.hint-btn {
  color: var(--primary);
  background: none;
  border: 1px dashed var(--primary);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8125rem;
  transition: all 0.2s;
}

.hint-btn:hover {
  background: var(--primary-light);
}

.hint-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 10px;
  font-size: 0.875rem;
  color: #92400e;
}

/* ============ FEEDBACK ============ */
.feedback {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-top: 20px;
  font-weight: 500;
}

.feedback.correct {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid #bbf7d0;
}

.feedback.wrong {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #fecaca;
}

/* ============ RANKING / BEAMER VIEW ============ */
.ranking-page {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  min-height: 100vh;
  color: white;
  padding: 40px;
}

.ranking-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 8px;
}

.ranking-subtitle {
  text-align: center;
  color: #64748b;
  margin-bottom: 40px;
}

.ranking-list {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ranking-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-lg);
  transition: all 0.3s;
}

.ranking-row:nth-child(1) {
  background: rgba(234,179,8,0.15);
  border: 1px solid rgba(234,179,8,0.3);
}

.ranking-row:nth-child(2) {
  background: rgba(148,163,184,0.15);
  border: 1px solid rgba(148,163,184,0.3);
}

.ranking-row:nth-child(3) {
  background: rgba(180,83,9,0.15);
  border: 1px solid rgba(180,83,9,0.2);
}

.ranking-pos {
  font-size: 1.5rem;
  font-weight: 700;
  width: 40px;
  text-align: center;
}

.ranking-pos.gold { color: #eab308; }
.ranking-pos.silver { color: #94a3b8; }
.ranking-pos.bronze { color: #b45309; }

.ranking-name {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 500;
}

.ranking-points {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.ranking-bar {
  width: 200px;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}

.ranking-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  transition: width 0.5s ease;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 { font-size: 1.1rem; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
}

.modal-body { padding: 24px; }

.modal-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============ MISC ============ */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-sm { font-size: 0.8125rem; }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.w-full { width: 100%; }
.hidden { display: none !important; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.9375rem;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  font-size: 0.875rem;
  animation: slideIn 0.3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============ COMPLETED SCREEN ============ */
.completed-screen {
  text-align: center;
  padding: 60px 24px;
}

.completed-screen .big-check {
  width: 80px;
  height: 80px;
  background: var(--success-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 2.5rem;
  color: var(--success);
}

.completed-screen h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.completed-screen p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.completed-stats {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 32px;
}

.completed-stats .cs-item {
  text-align: center;
}

.completed-stats .cs-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
}

.completed-stats .cs-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ============ TABS ============ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 20px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
}

.tab:hover { color: var(--text); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Stats Grid (used in support detail) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Support / Stuetzlehrer */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.card-hover:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
  transition: all 0.15s ease;
}
.stat-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.stat-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8125rem;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-cards { grid-template-columns: 1fr; }
}

/* ============ SEASONS ============ */
.season-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.season-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  transition: all 0.2s;
}

.season-card.season-active {
  border-left: 4px solid var(--success);
  background: #f0fdf4;
}

.season-card.season-ended {
  border-left: 4px solid var(--text-light);
  background: #f8fafc;
}

/* ============ MILESTONES ============ */
.milestone-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 16px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  font-size: 0.8125rem;
}

.milestone-badge.earned {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-color: #f59e0b;
  color: #92400e;
}

.milestone-icon {
  font-size: 1.1rem;
}

.milestone-name {
  font-weight: 500;
}

/* ============ STREAK COUNTER ============ */
.streak-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 80px;
}

.streak-flame {
  font-size: 2rem;
  line-height: 1;
}

.streak-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--warning);
}

.streak-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ============ OVERRIDE BUTTONS ============ */
.override-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.override-btn {
  padding: 3px 8px !important;
  font-size: 0.7rem !important;
  white-space: nowrap;
}

/* ============ BEHAVIOR COLOR BADGES ============ */
.behavior-green {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--success-light);
  color: var(--success);
}

.behavior-yellow {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--warning-light);
  color: var(--warning);
}

.behavior-red {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--danger-light);
  color: var(--danger);
}

/* ============ BEHAVIOR REPORT BAR ============ */
.behavior-bar-container {
  display: flex;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
}

.behavior-bar-green { background: var(--success); transition: width 0.3s; }
.behavior-bar-yellow { background: var(--warning); transition: width 0.3s; }
.behavior-bar-red { background: var(--danger); transition: width 0.3s; }

/* ============ ANALYTICS BAR CHARTS ============ */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  min-width: 100px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar {
  flex: 1;
  height: 20px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}

.bar-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.bar-fill-green { background: var(--success); }
.bar-fill-red { background: var(--danger); }
.bar-fill-blue { background: var(--primary); }

.bar-value {
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 60px;
  white-space: nowrap;
}

/* ============ REPORT LAYOUT ============ */
.report-summary {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.report-summary-item {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px 20px;
  text-align: center;
  min-width: 100px;
}

.report-summary-item .val {
  font-size: 1.5rem;
  font-weight: 700;
}

.report-summary-item .lbl {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ============ PHASE 3: BONUS BREAKDOWN ============ */
.bonus-breakdown {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px auto 24px;
  max-width: 300px;
}

.bonus-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.875rem;
}

.bonus-item span:last-child {
  font-weight: 600;
  color: var(--success);
}

.bonus-total {
  display: flex;
  justify-content: space-between;
  padding: 8px 0 0;
  margin-top: 8px;
  border-top: 1px solid #bbf7d0;
  font-weight: 700;
  font-size: 1rem;
}

.bonus-total span:last-child {
  color: var(--success);
}

/* ============ PHASE 3: CROWN / WINNER ============ */
.crown {
  font-size: 1.2rem;
  margin-left: 4px;
}

.winner-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
  color: #92400e;
}

/* ============ PHASE 3: BEAMER RANKING ============ */
.beamer-ranking-page {
  background: #0f172a;
  min-height: 100vh;
  color: white;
  padding: 60px 40px;
}

.beamer-ranking-page .ranking-title {
  font-size: 3rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: -1px;
}

.beamer-ranking-page .ranking-subtitle {
  font-size: 1.25rem;
  text-align: center;
  color: #64748b;
  margin-bottom: 60px;
}

.beamer-ranking-page .ranking-list {
  max-width: 900px;
  margin: 0 auto;
  gap: 16px;
}

.beamer-ranking-page .ranking-row {
  padding: 20px 32px;
  font-size: 1.25rem;
  transition: all 0.5s ease;
}

.beamer-ranking-page .ranking-pos {
  font-size: 2rem;
  width: 60px;
}

.beamer-ranking-page .ranking-name {
  font-size: 1.5rem;
  font-weight: 600;
}

.beamer-ranking-page .ranking-points {
  font-size: 1.75rem;
  font-weight: 800;
}

.beamer-ranking-page .ranking-crown {
  font-size: 2rem;
}

/* ============ PHASE 3: HELP REQUEST ============ */
.help-request-btn {
  margin-top: 12px;
  color: var(--warning);
  border-color: var(--warning);
}

.help-request-btn:hover {
  background: var(--warning-light);
}

.help-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 4px;
}

.help-bell {
  position: relative;
  display: inline-block;
  cursor: pointer;
  font-size: 1.1rem;
}

.help-bell .help-count {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============ PHASE 3: SORTABLE TABLE ============ */
th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 24px;
}

th.sortable:hover {
  color: var(--primary);
  background: #eef2ff;
}

th.sortable::after {
  content: '\2195';
  position: absolute;
  right: 8px;
  opacity: 0.3;
  font-size: 0.75rem;
}

th.sortable.sort-asc::after {
  content: '\2191';
  opacity: 1;
  color: var(--primary);
}

th.sortable.sort-desc::after {
  content: '\2193';
  opacity: 1;
  color: var(--primary);
}

/* ============ PHASE 3: INFO MODAL ============ */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 700;
  transition: all 0.2s;
  margin-left: 8px;
}

.info-btn:hover {
  background: var(--primary);
  color: white;
}

.formula-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
  font-family: 'Courier New', monospace;
  font-size: 0.8125rem;
  line-height: 1.8;
}

.milestone-tier {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.milestone-tier:last-child {
  border-bottom: none;
}

.milestone-tier .tier-icon {
  font-size: 1.5rem;
}

.milestone-tier .tier-info {
  flex: 1;
}

.milestone-tier .tier-info strong {
  display: block;
  font-size: 0.875rem;
}

.milestone-tier .tier-info span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ============ PHASE 3: INACTIVITY WARNING ============ */
.inactivity-warning {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--warning-light);
  color: var(--warning);
  font-size: 0.7rem;
  font-weight: 600;
  animation: pulse 2s infinite;
}

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

/* ============ PHASE 3: PERSONAL BESTS ============ */
.personal-best-card {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #93c5fd;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  text-align: center;
}

.personal-best-card .pb-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.personal-best-card .pb-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ============ PHASE 3: WEBHOOK / ADMIN SECTION ============ */
.admin-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.admin-section h4 {
  margin-bottom: 12px;
  font-size: 0.9375rem;
}

.admin-section p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ============ PHASE 3: HEADER NAV OVERFLOW ============ */
.header-nav {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.header-nav::-webkit-scrollbar {
  display: none;
}

@media (max-width: 1200px) {
  .header-nav a {
    font-size: 0.75rem;
    padding: 4px 8px;
  }
  .header-nav {
    gap: 4px;
  }
}

/* ============ SESSION REVIEW ============ */
.review-card { border-left: 4px solid; margin-bottom: 1rem; padding: 1rem; border-radius: 8px; background: var(--bg-white); }
.review-card.correct { border-left-color: var(--success); background: var(--success-light); }
.review-card.wrong { border-left-color: var(--danger); background: var(--danger-light); }
.review-answer { padding: 0.5rem 0.75rem; border-radius: 4px; margin: 0.25rem 0; font-size: 0.95rem; }
.review-answer.student { background: #e5e7eb; }
.review-answer.correct-answer { background: #dcfce7; font-weight: 600; }
.review-meta { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.5rem; }
.review-option { padding: 0.4rem 0.75rem; border-radius: 4px; margin: 0.2rem 0; border: 1px solid #e5e7eb; }
.review-option.selected { border-color: var(--primary); background: var(--primary-light); }
.review-option.correct-option { border-color: var(--success); background: var(--success-light); }
.review-option.selected.wrong-option { border-color: var(--danger); background: var(--danger-light); }
.review-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.review-summary .stat-card { text-align: center; }

/* ============ AI GENERATOR ============ */
.ai-preview-banner {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: white;
  padding: 16px 24px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-loading {
  text-align: center;
  padding: 48px;
}

.ai-loading .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.ai-module-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}

.ai-module-header {
  padding: 12px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.ai-module-header:hover { background: #f1f5f9; }

.ai-module-body { padding: 0; }

.ai-task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.ai-task-row:last-child { border-bottom: none; }

.ai-task-row .task-q { flex: 1; }

.ai-task-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* ============ PRINT STYLES ============ */
@media print {
  .header, .header-nav, .header-user, .btn-logout,
  .tabs, .no-print { display: none !important; }
  .page { padding: 0; max-width: 100%; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  body { background: white; color: #000; }
  .review-card, .session-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
  .review-summary { break-inside: avoid; }
  .stat-card { box-shadow: none; border: 1px solid #ddd; }
  a { color: #000; text-decoration: none; }
}
