/* My Learning Hub - Complete Stylesheet */

/* CSS Variables */
:root {
  --primary-color: #667eea;
  --primary-dark: #5568d3;
  --secondary-color: #764ba2;
  --success-color: #16a34a;
  --danger-color: #dc2626;
  --warning-color: #f59e0b;
  --text-dark: #1e293b;
  --text-light: #64748b;
  --bg-light: #f8fafc;
  --border-color: #e2e8f0;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 3px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 6px 20px rgba(0, 0, 0, 0.12);
}

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

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 15px;
  color: var(--text-dark);
  font-size: 14px;
}

body.quiz-mode {
  background: var(--bg-light);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Page Header (for login/register pages) */
.page-header {
  text-align: center;
  color: white;
  margin-bottom: 25px;
}

.page-header h1 {
  font-size: 28px;
  margin-bottom: 8px;
  font-weight: 700;
}

.page-header p {
  font-size: 14px;
  opacity: 0.9;
}

/* Header (for main pages) */
.header {
  background: white;
  padding: 15px 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.header h1 {
  color: var(--primary-color);
  font-size: 22px;
  font-weight: 700;
}

.user-info {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.user-info span {
  color: var(--text-dark);
  font-size: 13px;
}

.grade-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}

.grade-selector label {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 13px;
}

.grade-selector select {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  background: white;
}

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

/* Login Container */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 150px);
}

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

.login-card h2 {
  color: var(--primary-color);
  margin-bottom: 8px;
  font-size: 24px;
  text-align: center;
}

.login-card > p {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 20px;
  font-size: 13px;
}

/* Form Groups */
.form-group {
  margin-bottom: 16px;
}

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

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-group input:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
}

.forgot-password {
  text-align: right;
  margin-top: -6px;
  margin-bottom: 12px;
}

.forgot-password a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.forgot-password a:hover {
  text-decoration: underline;
}

.register-link {
  text-align: center;
  margin-top: 18px;
  color: var(--text-light);
  font-size: 13px;
}

.register-link a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}

.register-link a:hover {
  text-decoration: underline;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: var(--bg-light);
  color: var(--text-dark);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border-color);
}

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

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-flag {
  background: var(--danger-color);
  color: white;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-flag:hover:not(:disabled) {
  background: #b91c1c;
  transform: translateY(-2px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Content Area */
.content {
  background: white;
  padding: 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.content h2 {
  color: var(--text-dark);
  margin-bottom: 18px;
  font-size: 20px;
}

/* Subjects Grid - 4 PER ROW */
.subjects-grid {
  display: grid;
  /*grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));*/
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

/* ============================================
   BASE CARD COMPONENT
   ============================================ */

.card {
  background: linear-gradient(135deg, #7c8ff5 0%, #9d77e8 100%);
  /*padding: 24px 18px;*/
  padding: clamp(16px, 2vw, 28px) clamp(12px, 1.5vw, 22px);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
  color: white;
  border: 2px solid transparent;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 10px 24px rgba(102, 126, 234, 0.4);
  border-color: white;
}

.icon {
  font-size: 44px;
  margin-bottom: 12px;
  display: block;
}

.card h3 {
  font-size: 20px;
  margin-bottom: 8px;
  font-weight: 700;
  color: white;
}

.card p {
  font-size: 14px;
  opacity: 0.95;
  line-height: 1.4;
  color: white;
}

.subject-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
}

/* Modules Grid */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.module-info {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
  gap: 10px;
}

.grade-badge {
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
}

.review-badge {
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  background: var(--warning-color);
  color: white;
}

/* Question Container */
.question-container {
  max-width: 900px;
  margin: 0 auto;
}

.question-card {
  background: white;
  padding: 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--border-color);
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.question-header h3 {
  color: var(--primary-color);
  font-size: 15px;
  font-weight: 700;
}

/* Disabled Button State */
.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary:disabled:hover,
.btn-secondary:disabled:hover {
    transform: none;
    box-shadow: none;
}


.question-text {
  font-size: 17px;
  color: var(--text-dark);
  margin-bottom: 20px;
  line-height: 1.5;
  font-weight: 500;
}

.answer-area {
  margin-bottom: 18px;
}

/* Options */
.option-label {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s;
}

.option-label:hover:not(.correct-option):not(.wrong-option) {
  border-color: var(--primary-color);
  background: #f0f4ff;
  transform: translateX(3px);
}

.option-label input[type="radio"] {
  margin-right: 10px;
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.option-label span {
  font-size: 14px;
  color: var(--text-dark);
}

.option-label.correct-option {
  background: #d4edda;
  border-color: #28a745;
}

.option-label.wrong-option {
  background: #f8d7da;
  border-color: #dc3545;
}

.text-answer {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
}

.text-answer:focus {
  outline: none;
  border-color: var(--primary-color);
}

.text-answer:disabled {
  background: var(--bg-light);
  cursor: not-allowed;
}

/* Feedback */
.feedback {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin: 16px 0;
  line-height: 1.5;
  font-size: 13px;
}

.feedback.correct {
  background: #d4edda;
  border: 2px solid #28a745;
  color: #155724;
}

.feedback.incorrect {
  background: #f8d7da;
  border: 2px solid #dc3545;
  color: #721c24;
}

.feedback strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

/* Navigation Buttons */
.navigation-buttons {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 18px;
  flex-wrap: wrap;
}

.navigation-buttons .btn {
  flex: 1;
  min-width: 100px;
}

/* Progress Display - LOOKS LIKE LABELS NOT BUTTONS */
#progressDisplay,
#scoreDisplay {
  background: transparent;
  color: var(--text-dark);
  padding: 0;
  border-radius: 0;
  font-weight: 600;
  font-size: 13px;
}

#scoreDisplay {
  color: var(--success-color);
}

/* Results Container */
.result-container {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  padding: 30px 20px;
}

.result-container h2 {
  color: var(--primary-color);
  margin-bottom: 24px;
  font-size: 26px;
}

.score-card {
  background: var(--bg-light);
  padding: 36px 28px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  border: 3px solid;
}

.score-card h3 {
  font-size: 26px;
  margin-bottom: 12px;
  font-weight: 700;
}

.score-card .score {
  font-size: 20px;
  margin-bottom: 10px;
  color: var(--text-dark);
  font-weight: 600;
}

.score-card .percentage {
  font-size: 44px;
  font-weight: 700;
}

.grade-excellent {
  border-color: #28a745;
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.grade-excellent h3,
.grade-excellent .percentage {
  color: #28a745;
}

.grade-good {
  border-color: #17a2b8;
  background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
}

.grade-good h3,
.grade-good .percentage {
  color: #17a2b8;
}

.grade-average {
  border-color: var(--warning-color);
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
}

.grade-average h3,
.grade-average .percentage {
  color: #856404;
}

.grade-poor {
  border-color: var(--danger-color);
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

.grade-poor h3,
.grade-poor .percentage {
  color: var(--danger-color);
}

.result-buttons {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.result-buttons .btn {
  min-width: 140px;
}

/* Modal Overlay */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 90%;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.modal-icon {
  font-size: 28px;
  line-height: 1;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.modal-body {
  color: var(--text-light);
  line-height: 1.5;
  margin-bottom: 20px;
  font-size: 13px;
}

.modal-body p {
  margin-bottom: 10px;
}

.modal-body p:last-child {
  margin-bottom: 0;
}

.modal-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  font-family: inherit;
  font-size: 14px;
  margin-top: 10px;
}

.modal-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.modal-status {
  margin-top: 10px;
  font-size: 13px;
  min-height: 18px;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.modal-buttons .btn {
  min-width: 120px;
  flex: 1;
  max-width: 200px;
}

/* Flag Modal Specific */
.flag-reasons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.flag-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s;
}

.flag-option:hover {
  background: var(--bg-light);
}

.flag-option input[type="radio"] {
  cursor: pointer;
  width: 14px;
  height: 14px;
}

.flag-option span {
  color: var(--text-dark);
  font-size: 13px;
}

.flag-textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 14px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}

.flag-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Error Messages */
.error {
  color: var(--danger-color);
  text-align: center;
  padding: 18px;
  font-size: 14px;
  background: #f8d7da;
  border-radius: var(--radius-md);
  border: 2px solid var(--danger-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 12px;
  }

  .user-info {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

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

  .navigation-buttons {
    flex-direction: column;
  }

  .navigation-buttons .btn {
    width: 100%;
  }

  .result-buttons {
    flex-direction: column;
  }

  .result-buttons .btn {
    width: 100%;
  }

  .login-card {
    padding: 24px 20px;
  }

  .question-card {
    padding: 16px;
  }

  .modal-box {
    width: 95%;
    padding: 20px;
    box-sizing: border-box;
  }

  .modal-overlay {
    padding: 16px;
    box-sizing: border-box;
    align-items: flex-end;
  }
}

/* ========================================
   ANNOUNCEMENTS ACCORDION
   ======================================== */

.announcements-accordion {
    margin-bottom: 18px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.ann-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #eef2ff 0%, #f5f0ff 100%);
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: left;
}

.ann-header:hover {
    background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 100%);
}

.ann-chevron {
    font-size: 11px;
    color: var(--text-light);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.ann-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    font-size: 13px;
    line-height: 1.5;
}

.ann-row-even {
    background: #ffffff;
}

.ann-row-odd {
    background: #f8f7ff;
}

.ann-row-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ann-title {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 13px;
}

.ann-body {
    color: var(--text-light);
    font-size: 12.5px;
}

.ann-cta-wrap {
    flex-shrink: 0;
}

.ann-cta {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    white-space: nowrap;
}

.ann-cta:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
  .page-header h1 {
    font-size: 24px;
  }

  .header h1 {
    font-size: 18px;
  }

  .question-text {
    font-size: 15px;
  }

  .subjects-grid,
  .modules-grid {
      grid-template-columns: 1fr;
  }

  .score-card .percentage {
    font-size: 36px;
  }
} 
/* ^^^ THIS BRACKET WAS MISSING, CAUSING THE BELOW STYLES TO BE MOBILE ONLY ^^^ */

/* ========================================
 v2.0 NEW COMPONENTS
 ======================================== */

/* Utility */
.hidden { display: none !important; }

/* Achievement Bar (Dashboard) */
.achievement-bar {
  background: white;
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-around;
  padding: 20px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.achievement-bar .stat {
  text-align: center;
}

.achievement-bar .stat span {
  font-size: 12px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.achievement-bar .stat strong {
  display: block;
  font-size: 20px;
  color: var(--primary-color);
}

/* Question Navigator Grid (Quiz) */
.question-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
  gap: 8px;
  margin-top: 20px;
  padding: 15px;
  background: var(--bg-light);
  border-radius: var(--radius-md);
}

.nav-btn {
  height: 35px;
  width: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--border-color);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn.active {
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: scale(1.1);
  box-shadow: 0 0 8px rgba(102, 126, 234, 0.3);
}

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

/* Timer Styling */
#timer-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #f1f5f9;
  border-radius: 20px;
  font-weight: 700;
  color: var(--text-dark);
}

#timer-container.warning {
  background: #fee2e2;
  color: var(--danger-color);
  animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* Results Score Circle */
.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 8px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 24px;
  font-weight: 700;
}

.score-circle.pass { border-color: var(--success-color); color: var(--success-color); }
.score-circle.fail { border-color: var(--danger-color); color: var(--danger-color); }

/* Review List Cards */
.review-item {
  border-left: 5px solid var(--border-color);
  transition: transform 0.2s;
}

.review-item.correct { border-left-color: var(--success-color); }
.review-item.incorrect { border-left-color: var(--danger-color); }

.review-item:hover {
  transform: translateX(5px);
}

/* ========================================
   FIXES FOR QUIZ UI & MODALS
   ======================================== */

/* 1. Modal Overlay - FORCE ON TOP */
.modal {
  display: none; 
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99999; /* This fixes the popup issue */
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex !important;
}

/* 2. Options Styling (Cards) */
.option-label {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  margin-bottom: 6px;
  background: white;
  border: 2px solid #e2e8f0; /* Default border */
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-label:hover {
  background: #f8fafc;
  border-color: #667eea; /* Primary color */
}

.option-label.selected {
  border-color: #667eea;
  background: #e0e7ff;
}

/* Feedback Colors */
.option-label.correct {
  border-color: #16a34a; /* Success Green */
  background: #dcfce7;
  color: #166534;
}

.option-label.wrong {
  border-color: #dc2626; /* Danger Red */
  background: #fee2e2;
  color: #991b1b;
}

.opt-letter {
  font-weight: 700;
  margin-right: 15px;
  min-width: 25px;
  color: #64748b;
}

/* Selected letter style */
.option-label.selected .opt-letter {
  color: #667eea;
}

/* ========================================
   COMPACT HEADER REDESIGN (Dashboard)
   ======================================== */

.header-compact {
  background: white;
  padding: 20px 25px;
  border-radius: var(--radius-lg);
  margin-bottom: 25px;
  box-shadow: var(--shadow-md);
}

/* Outer flex: avatar block + content side by side */
.header-body {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* Avatar block — fixed width, spans both rows */
.header-avatar {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
  border: 3px solid var(--border-color);
  transition: border-color 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-light);
}

.header-avatar:hover {
  border-color: var(--primary-color);
  transform: scale(1.04);
}

.header-avatar svg {
  width: 90%;
  height: 90%;
}

/* Silhouette placeholder SVG colour */
.header-avatar-placeholder {
  color: #cbd5e1;
}

/* Content area — takes remaining width */
.header-content {
  flex: 1;
  min-width: 0;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.badge-challenge-count {
  font-size: 13px;
  font-weight: 700;
  color: #ef4444;
  margin-left: 4px;
}

.badge-new {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 6px;
  background: #f59e0b;
  color: #fff;
  margin-left: 5px;
  vertical-align: middle;
  letter-spacing: 0.3px;
}

.sub-expiry-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
    color: #fff;
}
.sub-expiry-badge.amber  { background: #f59e0b; }
.sub-expiry-badge.orange { background: #f97316; }
.sub-expiry-badge.red    { background: #ef4444; }

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.welcome-text {
  font-size: 18px;
  color: var(--text-dark);
}

.welcome-text strong {
  font-weight: 700;
}

.user-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
}

.grade-dropdown {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: white;
  color: var(--text-dark);
  margin-left: 4px;
  transition: border-color 0.2s;
}

.grade-dropdown:hover {
  border-color: var(--primary-color);
}

.grade-dropdown:focus {
  outline: none;
  border-color: var(--primary-color);
}

.header-right {
  display: flex;
  gap: 10px;
  position: relative;
}

.btn-menu {
  position: relative;
  z-index: 100;
}

.header-dropdown {
  position: fixed;
  top: auto;
  right: 16px;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 9999;
  display: none;
  flex-direction: column;
}

.header-dropdown.show {
  display: flex;
}

.dropdown-item {
  display: block;
  padding: 8px 16px;
  color: var(--text-dark);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
}

.dropdown-item:hover:not(.dropdown-item-active):not([style*="cursor: not-allowed"]) {
  background: var(--bg-light);
  color: var(--primary-color);
}

.dropdown-item-active {
  background: #ede9fe;
  color: var(--primary-color);
  font-weight: 600;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

.btn-header {
  padding: 8px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  color: var(--text-dark);
}

.btn-header:hover {
  background: var(--bg-light);
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.btn-header-sm {
  padding: 5px 12px;
  font-size: 13px;
}

.header-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
}

.header-stats-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-stats-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-weight: 700;
}

/* Streak — orange */
.stat-item:nth-child(1) .stat-value {
  color: #f59e0b;
}

/* Rank/XP — purple */
.stat-item:nth-child(3) .stat-value {
  color: #8b5cf6;
}

/* Stars — gold */
.stat-item:nth-child(5) .stat-value {
  color: #f59e0b;
}

.stat-separator {
  color: var(--border-color);
  font-weight: 400;
}

.stat-link {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid #667eea;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
    text-decoration: none;
    transition: all 0.2s ease;
}

.stat-link:hover {
    background: #667eea;
    color: white;
}

/* Responsive adjustments for compact header */
@media (max-width: 1023px), (pointer: coarse) and (max-width: 1366px) {
  body {
    min-height: unset;
  }

  .header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-right {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .btn-header {
    padding: 6px 10px;
    font-size: 12px;
  }

  .grade-dropdown {
    font-size: 12px;
    padding: 5px 8px;
  }

  .header-stats {
    flex-wrap: wrap;
    font-size: 13px;
  }

  .header-stats-left {
    flex-wrap: wrap;
  }

  .header-avatar {
    width: 64px;
    height: 64px;
  }
}

@media (max-width: 480px), (pointer: coarse) and (max-width: 768px) {
  .header-body {
    gap: 8px;
  }

  .header-avatar {
    width: 52px;
    height: 52px;
  }

  .welcome-text {
    font-size: 14px;
  }

  .user-name {
    font-size: 15px;
  }

  .btn-header {
    padding: 5px 8px;
    font-size: 11px;
  }
}



/* ========================================
   MODULES PAGE SPECIFIC STYLES
   ======================================== */

.back-btn {
  background: var(--bg-light);
  border: 2px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  color: var(--text-dark);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s;
}

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



.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.btn-subject-test {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-subject-test:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Module cards - use same grid as subjects */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.module-info-stats {
  font-size: 13px;
  margin-top: 12px;
  margin-bottom: 12px;
  color: white;
  opacity: 0.95;
  line-height: 1.6;
}

.module-not-attempted {
  font-size: 13px;
  margin-top: 12px;
  margin-bottom: 12px;
  color: white;
  opacity: 0.85;
  font-style: italic;
}

/* Module action buttons */
.module-actions button:first-child:hover {
  background: #f8f9ff !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.module-actions button:last-child:hover {
  background: rgba(255, 255, 255, 0.4) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.module-select-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.module-select-actions button {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1.5px solid #ddd6fe;   /* light purple border */
    background: #f5f3ff;           /* very light purple */
    color: #5b21b6;                /* strong purple text */
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.module-select-actions button:hover {
    background: #ede9fe;           /* slightly deeper purple */
    border-color: #c4b5fd;
    transform: translateY(-1px);
}

.module-select-actions button:active {
    transform: translateY(0);
}

