/* ==========================================================================
   CSS SYSTEM - STUDYPATH
   ========================================================================== */

:root {
  --primary-color: #6b46c1;       /* Main Purple */
  --primary-hover: #553c9a;       /* Darker Purple */
  --primary-light: #f3e8ff;       /* Soft Light Purple background */
  --primary-glow: rgba(107, 70, 193, 0.15);
  
  --gradient-start: #8b5cf6;      /* Header Gradient Start */
  --gradient-end: #6d28d9;        /* Header Gradient End */
  
  --sidebar-bg: #f7f6fc;          /* Light Lavender Sidebar */
  --sidebar-hover: #ede9fe;
  
  --main-bg: #fdfdff;             /* Very light white/purple main page */
  --card-bg: #ffffff;
  
  --text-primary: #1f1b2d;        /* Deep Slate */
  --text-secondary: #605978;      /* Muted Slate */
  --border-color: #e5e2f3;        /* Soft Border */
  
  --success-color: #10b981;
  --success-bg: #ecfdf5;
  --success-text: #047857;
  
  --danger-color: #ef4444;
  --danger-bg: #fef2f2;
  --danger-text: #b91c1c;

  --warning-color: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-text: #b45309;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Outfit', sans-serif;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--main-bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

.text-center { text-align: center; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary-color);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--primary-color);
  color: var(--primary-color);
}
.btn-outline:hover {
  background-color: var(--primary-light);
}

.btn-white {
  background-color: #ffffff;
  color: var(--primary-color);
  border-color: #ffffff;
}
.btn-white:hover {
  background-color: #f8f7ff;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  letter-spacing: 0.05em;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-icon-only {
  padding: 8px;
  width: 38px;
  height: 38px;
  border-radius: 8px;
}

.btn-icon-label {
  padding-left: 14px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 9999px;
  gap: 4px;
}

.badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-success {
  background-color: var(--success-bg);
  color: var(--success-text);
}
.badge-success::before {
  background-color: var(--success-color);
}

.badge-danger {
  background-color: var(--danger-bg);
  color: var(--danger-text);
}
.badge-danger::before {
  background-color: var(--danger-color);
}

.badge-warning {
  background-color: var(--warning-bg);
  color: var(--warning-text);
}
.badge-warning::before {
  background-color: var(--warning-color);
}

/* Forms */
label {
  display: block;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  font-family: var(--font-main);
  font-size: 0.9rem;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  color: var(--text-primary);
  outline: none;
  transition: all 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

/* Select wrapper */
.select-wrapper {
  position: relative;
  width: 100%;
}
.select-wrapper select {
  appearance: none;
  padding-right: 36px;
}
.select-wrapper::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text-secondary);
  pointer-events: none;
}

/* Screen Wrapper */
.screen-wrapper {
  display: none;
  width: 100%;
  min-height: 100vh;
}
.screen-wrapper.active {
  display: flex;
}

/* ==========================================================================
   1. LOGIN SCREEN STYLES
   ========================================================================== */
#login-screen {
  background: radial-gradient(circle at 80% 20%, #f4efff 0%, #f7f8fc 100%);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background-color: var(--card-bg);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 10px 30px rgba(107, 70, 193, 0.06);
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.login-header {
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
  color: #ffffff;
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.5px;
}

.book-logo {
  width: 26px;
  height: 26px;
  stroke: #ffffff;
}

.login-body {
  padding: 36px;
}

.login-body h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary-color);
  margin-bottom: 24px;
  text-align: center;
  letter-spacing: 0.5px;
}

.input-group {
  margin-bottom: 20px;
}

.input-wrapper {
  position: relative;
}

.input-wrapper input {
  padding-left: 42px;
  border-color: var(--border-color);
}

.input-wrapper input:focus {
  border-color: var(--primary-color);
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -4px;
  margin-bottom: 24px;
  font-size: 0.85rem;
}

/* Custom Checkbox */
.checkbox-container {
  display: block;
  position: relative;
  padding-left: 24px;
  cursor: pointer;
  font-weight: 500;
  text-transform: none;
  font-size: 0.85rem;
  color: var(--text-secondary);
  user-select: none;
  margin-bottom: 0;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 0;
  height: 16px;
  width: 16px;
  background-color: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: 4px;
  transition: all 0.15s ease;
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--primary-color);
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.checkmark::after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark::after {
  display: block;
}

.checkbox-container .checkmark::after {
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.forgot-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}
.forgot-link:hover {
  text-decoration: underline;
}

.autofill-helpers {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px dashed var(--border-color);
  padding-top: 20px;
}

.btn-helper {
  background-color: var(--primary-light);
  color: var(--primary-color);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-helper:hover {
  background-color: #e8dffc;
}

.login-footer {
  border-top: 1px solid var(--border-color);
  background-color: #fafafc;
  padding: 18px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.login-footer a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}
.login-footer a:hover {
  text-decoration: underline;
}


/* ==========================================================================
   2. DASHBOARD COMMON LAYOUT
   ========================================================================== */
#dashboard-screen {
  flex-direction: column;
  background-color: #f7f7fc;
}

.main-header {
  height: 70px;
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
  color: #ffffff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(107, 70, 193, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.book-logo-white {
  width: 28px;
  height: 28px;
  stroke: #ffffff;
}

.logo-title {
  font-family: 'Caveat', cursive;
  font-size: 1.8rem;
  font-weight: 700;
}

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

.profile-pill {
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.profile-avatar {
  width: 40px;
  height: 40px;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
}

.app-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 70px);
}

/* Sidebar Navigation */
.sidebar {
  width: 250px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: var(--primary-color);
}

.nav-item.active {
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-weight: 600;
}

.nav-icon {
  width: 20px;
  height: 20px;
  transition: stroke 0.2s ease;
}

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

.logout-btn, .logout-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.logout-btn:hover, .logout-link:hover {
  background-color: var(--danger-bg);
  color: var(--danger-color);
}

.logout-icon {
  width: 20px;
  height: 20px;
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 28px 40px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.tab-view {
  display: none;
  animation: fadeIn 0.3s ease;
}
.tab-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.8rem;
  color: var(--text-primary);
  margin-bottom: 24px;
}

/* Cards */
.dashboard-card {
  background-color: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(107, 70, 193, 0.02);
}

.dashboard-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--primary-color);
  margin-bottom: 18px;
}


/* ==========================================================================
   3. NEXT LESSON PLAQUE
   ========================================================================== */
.lesson-plaque {
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
  border-radius: 12px;
  padding: 24px 30px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  box-shadow: 0 6px 20px rgba(109, 40, 217, 0.15);
}

.plaque-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plaque-tag {
  background-color: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 2px 8px;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 1px;
  align-self: flex-start;
}

.plaque-details {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.detail-item {
  font-size: 0.95rem;
}

.detail-item .label {
  opacity: 0.85;
  font-weight: 400;
}

.detail-item .value {
  font-weight: 600;
}

.btn-join {
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
  white-space: nowrap;
}


/* ==========================================================================
   4. CHOOSE STUDENT CARD
   ========================================================================== */
.select-student-card select {
  max-width: 300px;
  margin-bottom: 20px;
}

.select-student-card .select-wrapper select {
  max-width: none;
  width: 100%;
}

.student-info-strip {
  display: flex;
  align-items: center;
  background-color: var(--main-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px 20px;
}

.student-avatar-badge, .avatar-sm {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  user-select: none;
}

.student-text-details {
  flex: 1;
}

.student-text-details h4 {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.student-text-details p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.student-email {
  margin-top: 2px;
}

/* ==========================================================================
   5. FORMS LAYOUT (ADD HOMEWORK)
   ========================================================================== */
.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.form-col {
  display: flex;
  flex-direction: column;
}

.col-12 { width: 100%; }
.col-8 { width: 66.666%; }
.col-6 { width: 50%; }
.col-4 { width: 33.333%; }

.input-with-icon {
  position: relative;
}

.input-with-icon input {
  padding-right: 40px;
}

.field-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  pointer-events: none;
}

.form-actions-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  margin-top: 4px;
}

.file-upload-label {
  margin-bottom: 0;
  font-weight: 600;
}


/* ==========================================================================
   6. HOMEWORK LIST
   ========================================================================== */
.hw-table-header {
  display: flex;
  padding: 10px 16px;
  border-bottom: 2px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hw-item {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.15s ease;
}

.hw-item:hover {
  background-color: var(--main-bg);
}

.col-title {
  flex: 1;
}

.hw-main-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.hw-sub-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.col-deadline {
  width: 120px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.col-status {
  width: 140px;
}

.col-actions {
  width: 140px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.btn-more {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
}
.btn-more:hover {
  background-color: var(--border-color);
}

.show-more-box {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.btn-show-more {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--primary-color);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 10px 28px;
  border-radius: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(124, 93, 250, 0.05);
}

.btn-show-more:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(124, 93, 250, 0.1);
}

.btn-show-more:active {
  transform: translateY(0);
}


/* ==========================================================================
   7. TEACHER - STUDENTS MANAGEMENT
   ========================================================================== */
.tab-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.tab-header-row .page-title {
  margin-bottom: 0;
}

.full-width-card {
  padding: 0;
}

.card-title-row {
  padding: 24px 24px 0 24px;
  margin-bottom: 12px;
}

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

.students-table th, .students-table td {
  padding: 16px 24px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.students-table th {
  background-color: #fafafc;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.students-table tr:last-child td {
  border-bottom: none;
}

.avatar-sm {
  width: 36px;
  height: 36px;
  font-size: 0.9rem;
  margin-right: 0;
}

.select-blue {
  background-color: #e0f2fe;
  color: #0369a1;
}

.select-pink {
  background-color: #fce7f3;
  color: #be185d;
}

.select-orange {
  background-color: #ffedd5;
  color: #c2410c;
}

.subtext {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 400;
}


/* ==========================================================================
   8. TEACHER - LESSON MATERIALS
   ========================================================================== */
.split-layout {
  display: flex;
  gap: 24px;
}

.split-left {
  flex: 2;
}

.split-right {
  flex: 1;
}

.upload-container {
  margin-bottom: 20px;
}

.list-materials-card {
  margin-top: 24px;
}

.theme-materials-group {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.theme-group-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.material-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f3f3f8;
}

.material-item:last-child {
  border-bottom: none;
}

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

.mat-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-video { background-color: #fef2f2; color: #ef4444; }
.icon-doc { background-color: #e0f2fe; color: #0284c7; }
.icon-test { background-color: #f0fdf4; color: #16a34a; }
.icon-link { background-color: #faf5ff; color: #9333ea; }

.mat-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.mat-actions {
  display: flex;
  gap: 8px;
}

.btn-delete:hover {
  background-color: var(--danger-bg);
  border-color: var(--danger-color);
  color: var(--danger-color);
}


/* ==========================================================================
   9. STUDENT - PROFILE & LAYOUTS
   ========================================================================== */
.profile-large-card {
  padding: 30px;
}

.student-profile-large-strip {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 10px;
}

.student-avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.student-profile-details h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.profile-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 30px;
}

.grid-cell {
  font-size: 0.9rem;
}

.cell-label {
  color: var(--text-secondary);
}

.cell-val {
  font-weight: 600;
  color: var(--text-primary);
}


/* ==========================================================================
   10. FLOATING REGISTRATION MODAL
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(31, 27, 45, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

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

.modal-card {
  background-color: var(--card-bg);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

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

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

.modal-header h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--primary-color);
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.15s ease;
}
.btn-close-modal:hover {
  background-color: var(--sidebar-hover);
}

.modal-body {
  padding: 24px;
}

.auto-generated-field {
  background-color: #f7f6fc !important;
  color: var(--primary-color) !important;
  font-family: monospace;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}

.password-reg-wrapper {
  display: flex;
  gap: 8px;
}

.btn-regenerate {
  white-space: nowrap;
  font-size: 0.8rem;
  padding: 10px 14px;
}

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


/* ==========================================================================
   11. CALENDAR STYLES (MY LESSONS)
   ========================================================================== */
.calendar-card {
  padding: 24px;
}

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

.calendar-header-left {
  display: flex;
  gap: 8px;
}

.btn-arrow {
  padding: 8px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-today {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
}

.calendar-month-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text-primary);
  margin-bottom: 0;
}

.calendar-header-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.select-calendar-mode {
  width: 110px;
}

.btn-add-lesson {
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
}

/* Calendar Grid */
.calendar-grid-wrapper {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--card-bg);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background-color: var(--border-color);
  gap: 1px;
}

.grid-header-cell {
  background-color: #fafafc;
  padding: 10px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}

.grid-day-cell {
  background-color: #ffffff;
  min-height: 120px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: background-color 0.15s ease;
}

.grid-day-cell:hover {
  background-color: #faf9fe;
}

.day-num {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  align-self: flex-start;
}

.bold-num {
  font-weight: 700;
  color: var(--text-primary);
}

.cell-muted {
  background-color: #fcfcff;
}

.cell-muted .day-num {
  opacity: 0.4;
}

/* Calendar Event Cards */
.calendar-event-card {
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.calendar-event-card:hover {
  box-shadow: 0 4px 8px rgba(107, 70, 193, 0.06);
}

.ev-time {
  font-weight: 700;
}

.ev-name {
  font-weight: 700;
}

.ev-topic {
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ev-comment {
  font-weight: 400;
  font-size: 0.75rem;
  opacity: 0.85;
  margin-top: 2px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Colors for event cards */
.ev-purple {
  background-color: #f3e8ff;
  border-left: 3px solid #8b5cf6;
  color: #6d28d9;
}
.ev-green {
  background-color: #d1fae5;
  border-left: 3px solid #10b981;
  color: #047857;
}
.ev-blue {
  background-color: #e0f2fe;
  border-left: 3px solid #0284c7;
  color: #0369a1;
}
.ev-orange {
  background-color: #ffedd5;
  border-left: 3px solid #f97316;
  color: #c2410c;
}
.ev-red {
  background-color: #fee2e2;
  border-left: 3px solid #ef4444;
  color: #b91c1c;
}

/* Add Lesson section split */
.add-lesson-section {
  padding: 24px;
}

.add-lesson-section select,
.add-lesson-section input,
.add-lesson-section textarea {
  background-color: #ffffff;
}

/* Lesson Preview Card on the Right */
.lesson-preview-pane {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.lesson-preview-card {
  background-color: #f4f3ff;
  border: 1px dashed #c0b3fd;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: center;
  flex: 1;
  min-height: 180px;
}

.preview-icon-wrapper {
  margin-bottom: 14px;
  color: var(--primary-color);
  opacity: 0.85;
}

.preview-text {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 16px;
}

.preview-text strong {
  color: var(--primary-color);
  font-size: 0.95rem;
}

.btn-clear-form {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
}
.btn-clear-form:hover {
  background-color: rgba(107, 70, 193, 0.05);
  color: var(--primary-color);
}

.btn-save-lesson {
  padding: 12px 24px;
}


/* ==========================================================================
   RESPONSIVENESS
   ========================================================================== */
@media (max-width: 992px) {
  .split-layout {
    flex-direction: column;
  }
  .app-layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
  }
  .nav-menu {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 8px;
  }
  .nav-item {
    white-space: nowrap;
  }
  .main-content {
    padding: 20px;
  }
  .profile-info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .lesson-plaque {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }
  .btn-join {
    width: 100%;
  }
  .form-row {
    flex-direction: column;
    gap: 12px;
  }
  .col-8, .col-4, .col-6 {
    width: 100%;
  }
  .hw-table-header {
    display: none;
  }
  .hw-item {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .col-deadline, .col-status, .col-actions {
    width: 100%;
  }
  .col-actions {
    justify-content: flex-start;
  }
}

/* Toast Notification System */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10000;
}

.toast {
  background: var(--card-bg);
  color: var(--text-primary);
  border-left: 4px solid var(--primary-color);
  padding: 14px 24px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 400px;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  border-left-color: var(--success-color);
  background-color: var(--success-bg);
  color: var(--success-text);
}

.toast-error {
  border-left-color: var(--danger-color);
  background-color: var(--danger-bg);
  color: var(--danger-text);
}

.toast-info {
  border-left-color: var(--warning-color);
  background-color: var(--warning-bg);
  color: var(--warning-text);
}

/* ==========================================================================
   8. STUDENT TESTING MODAL & RESULTS
   ========================================================================== */

/* Fullscreen modal style specifically for tests */
.test-modal-overlay {
  display: none; /* Controlled by active class */
  background: rgba(31, 27, 45, 0.4);
  backdrop-filter: blur(12px);
  z-index: 10005; /* Exceed header and normal modals */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  padding: 24px;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
}

.test-modal-overlay.active {
  display: flex;
}

.test-card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(107, 70, 193, 0.18);
  width: 100%;
  max-width: 800px;
  padding: 32px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: testModalAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-height: 90vh;
  overflow-y: auto;
}

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

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

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

.test-icon {
  font-size: 1.8rem;
}

.test-header-left h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text-primary);
}

.test-header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.test-timer-wrapper {
  background: var(--primary-light);
  color: var(--primary-color);
  padding: 8px 16px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.test-timer-wrapper svg {
  color: var(--primary-color);
}

/* Blinking critical alarm class */
.test-timer-wrapper.timer-warning {
  background: var(--danger-bg);
  color: var(--danger-color);
  animation: timerBlink 1s infinite alternate;
}

.test-timer-wrapper.timer-warning svg {
  color: var(--danger-color);
}

@keyframes timerBlink {
  0% { opacity: 1; }
  100% { opacity: 0.6; transform: scale(1.05); }
}

.test-progress-text {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* Progress bar container */
.test-progress-container {
  background: var(--border-color);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: -8px;
}

.test-progress-bar {
  background: linear-gradient(90deg, var(--gradient-start) 0%, var(--primary-color) 100%);
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Question text area */
.test-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 220px;
}

.test-question-box {
  background: var(--sidebar-bg);
  padding: 20px 24px;
  border-radius: 12px;
  border-left: 5px solid var(--primary-color);
}

.test-question-text {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text-primary);
}

/* Options rendering */
.test-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Interactive Option items as cards */
.test-option-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
}

.test-option-item:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
  transform: translateY(-2px);
}

/* Active option state */
.test-option-item.selected {
  border-color: var(--primary-color);
  background: rgba(107, 70, 193, 0.08);
  box-shadow: 0 4px 15px rgba(107, 70, 193, 0.06);
}

/* Custom inputs design instead of default browser elements */
.test-input-indicator {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

/* Radio is circle, checkbox is square */
.test-option-item[data-type="radio"] .test-input-indicator {
  border-radius: 50%;
}
.test-option-item[data-type="checkbox"] .test-input-indicator {
  border-radius: 6px;
}

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

/* Inner dot or checkmark */
.test-input-indicator::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  background: #ffffff;
  transform: scale(0);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.test-option-item[data-type="radio"] .test-input-indicator::after {
  border-radius: 50%;
}

.test-option-item[data-type="checkbox"] .test-input-indicator::after {
  content: "✓";
  color: white;
  background: transparent;
  font-size: 14px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0);
  line-height: 1;
}

.test-option-item.selected .test-input-indicator::after {
  transform: scale(1);
}

.test-option-text {
  font-size: 1rem;
  font-weight: 550;
  color: var(--text-primary);
}

/* Footer layout */
.test-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.test-footer-nav {
  display: flex;
  gap: 12px;
}

/* Result Screen Layout */
.test-results-view {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.test-results-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 30px;
  background: var(--primary-light);
  border-radius: 16px;
  border: 1px solid rgba(107, 70, 193, 0.15);
}

.test-score-large {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--primary-color);
  margin: 10px 0;
  line-height: 1.1;
}

.test-results-headline {
  font-size: 1.4rem;
  font-weight: 750;
  color: var(--text-primary);
}

.test-results-meta {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 6px;
  font-weight: 500;
}

/* Detailed results breakdowns */
.test-results-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.test-results-title-secondary {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  border-left: 4px solid var(--primary-color);
  padding-left: 10px;
  margin-bottom: 12px;
}

.test-result-breakdown-card {
  padding: 20px;
  border-radius: 10px;
  border: 1.5px solid var(--border-color);
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.test-result-breakdown-card.correct {
  border-color: var(--success-color);
  background: rgba(16, 185, 129, 0.02);
}

.test-result-breakdown-card.incorrect {
  border-color: var(--danger-color);
  background: rgba(239, 68, 68, 0.02);
}

.breakdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.breakdown-question-num {
  font-weight: 700;
  font-size: 0.9rem;
}

.correct .breakdown-question-num {
  color: var(--success-text);
}

.incorrect .breakdown-question-num {
  color: var(--danger-text);
}

.breakdown-status-badge {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.correct .breakdown-status-badge {
  background: var(--success-bg);
  color: var(--success-text);
}

.incorrect .breakdown-status-badge {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.breakdown-question-text {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-primary);
}

.breakdown-answers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}

.breakdown-answer-row {
  font-size: 0.9rem;
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-weight: 500;
}

.breakdown-answer-row.user-choice {
  color: var(--text-primary);
}

.breakdown-answer-row.correct-choice {
  color: var(--success-text);
}

.breakdown-explanation {
  background: var(--sidebar-bg);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  font-style: italic;
}

/* ==========================================================================
   11. STUDENT UNIFIED DASHBOARD PANELS
   ========================================================================== */
.student-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 20px;
  margin-bottom: 40px;
}

@media (max-width: 992px) {
  .student-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.student-card {
  background-color: #ffffff;
  border-radius: 20px;
  border: 1px solid #ebe9f5;
  box-shadow: 0 10px 25px rgba(124, 93, 250, 0.04);
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  min-height: 320px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.student-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(124, 93, 250, 0.08);
}

.student-card-content {
  background-color: #ece8f7;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  flex-grow: 1;
}

/* Adjustments for nested items inside student-card-content to look highly polished */
.student-card-content .panel-item-row {
  background-color: #ffffff;
  border: 1px solid #ebe9f5;
}

.student-card-content .panel-item-row:hover {
  background-color: #f7f5fd;
}

.student-card-content .test-block {
  background-color: #ffffff;
  border: 1px solid #ebe9f5;
}

.student-card-content .next-test-block {
  background-color: #ffffff;
  border: 1px dashed #7c5dfa;
}

.student-card-content .btn-outline-purple {
  background-color: #ffffff;
  border: 1px solid #7c5dfa;
  color: #7c5dfa;
}

.student-card-content .btn-outline-purple:hover {
  background-color: #f6f4fc;
}

.student-card .panel-icon-circle {
  background-color: transparent !important;
  width: auto;
  height: auto;
  border-radius: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.student-card.accent-panel .panel-icon-circle {
  color: #ffffff !important;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.panel-icon-circle {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f0edff;
  color: #7c5dfa;
}

.panel-header h3 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: #2b1b93;
  margin: 0;
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex-grow: 1;
}

.panel-badge-wrapper {
  margin-bottom: 2px;
}

.panel-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 100px;
  display: inline-block;
}

.badge-purple {
  background-color: #f0edff;
  color: #7c5dfa;
}

.panel-main-title {
  font-size: 1.5rem;
  font-weight: 750;
  color: #1e1938;
  line-height: 1.3;
}

.panel-meta-item {
  display: flex;
  align-items: center;
  font-size: 1rem;
  font-weight: 600;
  color: #55506a;
}

.btn-panel-solid-action {
  width: 100%;
  padding: 14px 22px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #7c5dfa;
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-panel-solid-action:hover {
  background-color: #6c4bf6;
}

/* Homework Panel */
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-align-center {
  align-items: center;
}

.panel-badge-flat {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
}

.badge-assigned {
  color: #7d7993;
  padding: 4px 0;
}

.badge-due {
  background-color: #fee2e2;
  color: #ef4444;
}

.panel-bullet-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-bullet-list li {
  font-size: 0.95rem;
  font-weight: 500;
  color: #55506a;
  position: relative;
  padding-left: 18px;
}

.panel-bullet-list li::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: #7c5dfa;
  font-size: 1.2rem;
  line-height: 1;
}

.panel-attachment-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: #7c5dfa;
}

/* Materials Panel */
.panel-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #7c5dfa;
  margin-bottom: 2px;
}

.panel-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background-color: #f8f7fa;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.panel-item-row:hover {
  background-color: #f1eff5;
}

.item-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #332d4a;
  display: flex;
  align-items: center;
  gap: 10px;
}

.item-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  color: #ffffff;
}

.pdf-badge {
  background-color: #ef4444;
}

.pptx-badge {
  background-color: #f59e0b;
}

.mp4-badge {
  background-color: #3b82f6;
}

.test-badge {
  background-color: #10b981;
}

.btn-outline-purple {
  width: 100%;
  padding: 14px 22px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f0edff;
  color: #7c5dfa;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-outline-purple:hover {
  background-color: #e4e0ff;
}

/* Tests and control panel */
.test-block {
  background-color: #f8f7fa;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.test-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.test-block-tag {
  font-size: 0.8rem;
  font-weight: 700;
  color: #8b88a5;
  text-transform: uppercase;
}

.test-score-badge {
  background-color: #d1fae5;
  color: #065f46;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.test-block-content {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.test-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e1938;
}

.test-date {
  font-size: 0.85rem;
  font-weight: 600;
  color: #8b88a5;
}

.btn-light-purple {
  background-color: #e0dbff;
  color: #7c5dfa;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease;
  align-self: flex-start;
}

.btn-light-purple:hover {
  background-color: #d2cbff;
}

.next-test-block {
  background-color: #ffffff;
  border: 1px dashed #ebe9f5;
}

/* Accent Notification Panel */
.accent-panel {
  background: linear-gradient(135deg, #7c5dfa 0%, #6c4bf6 100%);
  border: none;
  box-shadow: 0 10px 25px rgba(108, 75, 246, 0.2);
}

.accent-panel .panel-header h3 {
  color: #ffffff;
}

.accent-panel .panel-icon-circle {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.notification-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notification-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.notification-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

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

.noti-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.noti-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
}

.noti-date {
  font-size: 0.8rem;
  font-weight: 500;
  color: #d1c4ff;
}

.btn-accent-light {
  width: 100%;
  padding: 14px 22px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-accent-light:hover {
  background-color: rgba(255, 255, 255, 0.25);
}

/* Progress Panel */
.progress-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.progress-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-indicator {
  font-size: 0.9rem;
  font-weight: 700;
}

.tick-green {
  color: #10b981;
}

.dot-yellow {
  color: #f59e0b;
}

.dot-purple {
  color: #7c5dfa;
}

.dot-grey {
  color: #d1d5db;
}

.topic-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e1938;
}

.progress-item-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar-wrapper {
  width: 100px;
  height: 8px;
  background-color: #f0edff;
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 100px;
}

.fill-green {
  background-color: #10b981;
}

.fill-yellow {
  background-color: #f59e0b;
}

.fill-purple {
  background-color: #7c5dfa;
}

.fill-grey {
  background-color: #d1d5db;
}

.percentage-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e1938;
  min-width: 36px;
  text-align: right;
}

/* Actions Dropdown Menu */
.col-actions {
  position: relative;
}

.actions-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: #ffffff;
  border: 1px solid #ebe9f5;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(31, 27, 45, 0.08);
  z-index: 100;
  display: none;
  min-width: 120px;
  overflow: hidden;
  margin-top: 4px;
}

.actions-dropdown.active {
  display: block;
}

.dropdown-item-delete {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ef4444;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  transition: background-color 0.15s ease;
}

.dropdown-item-delete:hover {
  background-color: #fee2e2;
}

/* ==========================================
   MESSAGING SYSTEM
   ========================================== */

.chat-container {
  display: flex;
  background-color: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(31, 27, 45, 0.05);
  height: calc(100vh - 180px);
  min-height: 500px;
  overflow: hidden;
}

.chat-sidebar {
  width: 280px;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  background-color: #faf9ff;
}

.chat-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.chat-sidebar-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e1938;
}

.contacts-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  margin-bottom: 4px;
}

.contact-item:hover {
  background-color: #f0edff;
}

.contact-item.active {
  background-color: #e5e0ff;
}

.contact-info {
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1e1938;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.contact-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.unread-badge {
  background-color: #ef4444;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 100px;
  margin-top: 4px;
}

.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
}

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

.avatar-chat {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  margin-right: 0;
}

.chat-username {
  font-weight: 700;
  font-size: 1rem;
  color: #1e1938;
}

.chat-user-status {
  font-size: 0.8rem;
  color: #10b981;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background-color: #f7f6fc;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  gap: 12px;
  text-align: center;
}

.message-bubble {
  max-width: 65%;
  padding: 12px 16px;
  border-radius: 12px;
  position: relative;
  font-size: 0.95rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.message-bubble.sent {
  align-self: flex-end;
  background-color: #7c5dfa;
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.message-bubble.received {
  align-self: flex-start;
  background-color: #ffffff;
  color: #1e1938;
  border-bottom-left-radius: 2px;
  box-shadow: 0 2px 8px rgba(31, 27, 45, 0.04);
  border: 1px solid var(--border-color);
}

.message-time {
  font-size: 0.7rem;
  margin-top: 4px;
  text-align: right;
  display: block;
  opacity: 0.7;
}

.message-attachment {
  margin-top: 8px;
  padding: 8px 12px;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
  color: inherit;
}

.message-bubble.received .message-attachment {
  background-color: #f0edff;
  color: #7c5dfa;
}

.chat-attachment-preview {
  padding: 8px 16px;
  background-color: #f0edff;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-attach {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-attach:hover {
  background-color: var(--main-bg);
  color: #7c5dfa;
}

.chat-input {
  flex: 1;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  outline: none;
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.chat-input:focus {
  border-color: #7c5dfa;
}

.btn-send {
  padding: 12px 24px !important;
}

/* ==========================================================================
   9. LMS TESTING SYSTEM STYLES
   ========================================================================== */

.question-builder-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  position: relative;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.question-builder-card:hover {
  border-color: var(--purple-accent-color);
  box-shadow: 0 4px 16px rgba(124, 93, 250, 0.08);
}

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

.question-num-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.05rem;
}

.question-type-badge {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--main-bg);
  color: var(--purple-accent-color);
  font-weight: 600;
}

.btn-delete-question {
  background: none;
  border: none;
  color: var(--error-color);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background-color 0.2s ease;
}

.btn-delete-question:hover {
  background-color: #ffeef0;
}

.options-builder-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
  padding-left: 15px;
  border-left: 2px dashed var(--border-color);
}

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

.option-builder-row input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.9rem;
}

.option-builder-row input[type="checkbox"], 
.option-builder-row input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.btn-delete-option {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-delete-option:hover {
  background-color: #f1f0f7;
  color: var(--error-color);
}

.test-text-answer-textarea {
  width: 100%;
  min-height: 120px;
  padding: 16px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease;
  resize: vertical;
}

.test-text-answer-textarea:focus {
  border-color: var(--purple-accent-color);
}

.test-text-input-field {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.95rem;
  margin-top: 10px;
}

/* Result breakdown extra styles */
.test-result-breakdown-card {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  padding: 18px;
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.test-result-breakdown-card.correct {
  border-left: 4px solid var(--success-color);
}

.test-result-breakdown-card.incorrect {
  border-left: 4px solid var(--error-color);
}

.test-result-breakdown-card.neutral {
  border-left: 4px solid var(--purple-accent-color);
}

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

.breakdown-question-num {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.breakdown-status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

.correct .breakdown-status-badge {
  background-color: #e6f9f0;
  color: var(--success-color);
}

.incorrect .breakdown-status-badge {
  background-color: #ffeef0;
  color: var(--error-color);
}

.neutral .breakdown-status-badge {
  background-color: #f1ecfe;
  color: var(--purple-accent-color);
}

.breakdown-question-text {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.breakdown-answers {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  background-color: var(--main-bg);
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.breakdown-answer-row {
  display: flex;
  gap: 6px;
}

.breakdown-answer-row strong {
  color: var(--text-primary);
}

.breakdown-explanation {
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
  margin-top: 8px;
}

/* ========================================== */
/* COURSE BUILDER & PROGRESS SYSTEM STYLES    */
/* ========================================== */

/* Carousel Container & Nav buttons */
.carousel-container {
  position: relative;
  width: 100%;
}

.carousel-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: var(--main-bg);
  color: var(--purple-accent-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  box-shadow: var(--shadow-sm);
  z-index: 5;
}

.carousel-nav-btn:hover {
  background-color: var(--purple-accent-color);
  color: white;
  border-color: var(--purple-accent-color);
}

/* Topic Carousel Card */
.topic-card {
  min-width: 130px;
  max-width: 160px;
  flex: 0 0 auto;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  background-color: var(--main-bg);
  cursor: pointer;
  position: relative;
  text-align: center;
  transition: all 0.2s ease;
  user-select: none;
}

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

.topic-card.active {
  border-color: var(--primary-color);
  background-color: var(--primary-light);
  box-shadow: 0 0 10px rgba(124, 93, 250, 0.15);
}

.topic-card-icon {
  font-size: 1.8rem;
  margin-bottom: 10px;
  display: inline-block;
}

.topic-card-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topic-card-progress-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 6px;
}

.topic-card-progress-bar-bg {
  width: 100%;
  height: 4px;
  background-color: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
}

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

/* Topic Actions Overlay (Edit mode) */
.topic-actions-overlay {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
}

.topic-btn-action {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background-color: var(--text-secondary);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.topic-btn-action:hover {
  opacity: 1;
}

.topic-btn-action.delete {
  background-color: var(--error-color);
}

.topic-btn-action.edit {
  background-color: var(--primary-color);
}

/* Subtopics Tree List */
.subtopics-tree-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tree-row {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--main-bg);
  gap: 12px;
  position: relative;
  transition: all 0.2s ease;
}

.tree-row:hover {
  border-color: var(--purple-accent-color);
}

.tree-row.level-2 {
  margin-left: 24px;
  background-color: #fbfbfe;
}

.tree-row.level-3 {
  margin-left: 48px;
  background-color: #f7f7fc;
  font-size: 0.95rem;
}

.tree-row.level-4 {
  margin-left: 72px;
  background-color: #f4f4fa;
  font-size: 0.92rem;
}

.tree-row.level-5 {
  margin-left: 96px;
  background-color: #f1f1f7;
  font-size: 0.9rem;
}

.tree-row.level-6 {
  margin-left: 120px;
  background-color: #ededf2;
  font-size: 0.88rem;
}

.tree-chevron {
  cursor: pointer;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  width: 20px;
  height: 20px;
}

.tree-chevron.expanded {
  transform: rotate(90deg);
}

.tree-title {
  font-weight: 600;
  color: var(--text-primary);
  flex-grow: 1;
}

.tree-progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 160px;
}

.tree-progress-bar-bg {
  width: 100px;
  height: 6px;
  background-color: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.tree-progress-bar-fill {
  height: 100%;
  background-color: var(--purple-accent-color);
  border-radius: 3px;
  width: 0;
  transition: width 0.3s ease;
}

.tree-progress-percent {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  width: 40px;
  text-align: right;
}

.tree-actions {
  display: flex;
  gap: 6px;
}

.tree-btn-action {
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: none;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.tree-btn-action:hover {
  background-color: var(--primary-light);
  border-color: var(--purple-accent-color);
  color: var(--purple-accent-color);
}

.tree-btn-action.delete:hover {
  background-color: #fee2e2;
  border-color: var(--error-color);
  color: var(--error-color);
}

.nested-children-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nested-children-wrapper.collapsed {
  display: none;
}

/* Modal test checkbox items */
.test-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: var(--main-bg);
  cursor: pointer;
}

.test-checkbox-row:hover {
  border-color: var(--purple-accent-color);
}

.btn-emoji {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  width: 38px;
  height: 38px;
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  user-select: none;
}

.btn-emoji:hover {
  background: var(--primary-light);
  border-color: var(--purple-accent-color);
  transform: translateY(-2px);
}

/* --- TEMPLATES SYSTEM STYLES --- */
.template-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
  position: relative;
}

.template-item:hover {
  border-color: var(--primary-color);
  background: var(--sidebar-hover);
  transform: translateX(4px);
}

.template-item.active {
  border-color: var(--primary-color);
  background: var(--primary-light);
  font-weight: 600;
}

.template-item-name {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
}

.template-item-badge {
  font-size: 0.75rem;
  background: var(--border-color);
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  transition: all 0.2s ease;
}

.template-item.active .template-item-badge {
  background: var(--primary-color);
  color: white;
}

.template-item-actions {
  display: flex;
  gap: 6px;
  margin-left: 10px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.template-item:hover .template-item-actions {
  opacity: 1;
}

.template-item:hover .template-item-badge {
  display: none;
}

.template-item-actions .btn-icon-tiny {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.template-item-actions .btn-icon-tiny:hover {
  background-color: var(--sidebar-hover);
  transform: scale(1.15);
}

@media (max-width: 768px) {
  .templates-layout {
    flex-direction: column !important;
  }
  .templates-layout > div {
    max-width: 100% !important;
    width: 100% !important;
  }
}

/* Custom styling for date inputs to match the site's aesthetic */
input[type="date"] {
  position: relative;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  min-height: 41px;
}

/* Hide default calendar picker indicator in Chrome/Edge/Safari and make it overlay */
input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

/* Ensure native date clear buttons do not clash with styling */
input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-clear-button {
  display: none;
  -webkit-appearance: none;
}

/* Hide lesson management elements for student role */
.role-student .btn-add-lesson,
.role-student .add-lesson-section {
  display: none !important;
}

/* Styling for calendar event action buttons */
.calendar-event-card {
  position: relative;
}

.role-teacher .calendar-event-card {
  padding-right: 18px;
}

.btn-more-event {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.4;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.1s ease;
  z-index: 5;
}

.btn-more-event:hover {
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.06);
}

/* Dropdown inside calendar */
.event-actions-dropdown {
  min-width: 140px;
  margin-top: 0;
  top: 100%;
}

.dropdown-item-action {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  transition: background-color 0.15s ease;
}

.dropdown-item-action:hover {
  background-color: var(--sidebar-hover);
}

/* Missed lesson styling */
.calendar-event-card.ev-missed {
  opacity: 0.6;
  border-left-style: dashed !important;
}

.calendar-event-card.ev-missed .ev-topic {
  text-decoration: line-through;
}

.ev-missed-badge {
  background-color: #ef4444;
  color: #ffffff;
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
}

/* Elevate day cells and event cards containing active actions dropdown to prevent clipping */
.grid-day-cell:has(.actions-dropdown.active) {
  z-index: 999 !important;
  position: relative;
}

.calendar-event-card:has(.actions-dropdown.active) {
  z-index: 999 !important;
  position: relative;
}

/* Custom Multiselect Dropdown */
.custom-multiselect {
  position: relative;
  width: 100%;
}

.multiselect-select-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-primary);
  min-height: 41px;
  user-select: none;
}

.multiselect-select-box:hover {
  border-color: #7c5dfa;
}

.multiselect-placeholder {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90%;
}

.multiselect-arrow {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-secondary);
  transition: transform 0.2s ease;
}

.custom-multiselect.active .multiselect-arrow {
  transform: rotate(180deg);
}

.multiselect-options-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
  margin-top: 4px;
  z-index: 1000;
  max-height: 250px;
  overflow-y: auto;
  padding: 8px;
}

.custom-multiselect.active .multiselect-options-panel {
  display: block;
}

.multiselect-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: background-color 0.15s ease;
}

.multiselect-option:hover {
  background-color: var(--sidebar-hover);
}

.multiselect-option input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

/* Student column styling */
.col-student {
  width: 150px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* ==========================================================================
   12. TEACHER DASHBOARD (MY DASHBOARD)
   ========================================================================== */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .metrics-row {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: 16px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px rgba(124, 93, 250, 0.03);
  transition: transform 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(124, 93, 250, 0.06);
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-info {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 4px;
  line-height: 1.1;
  font-family: var(--font-display);
}

/* Dashboard List Items */
.t-dash-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.t-dash-item:hover {
  background-color: var(--sidebar-bg);
  transform: translateX(4px);
}

.t-dash-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.t-dash-item-details {
  flex: 1;
  min-width: 0;
}

.t-dash-item-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.t-dash-item-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Student progress card on dashboard */
.t-dash-student-card {
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: box-shadow 0.2s ease;
}

.t-dash-student-card:hover {
  box-shadow: 0 8px 20px rgba(124, 93, 250, 0.05);
}

.t-dash-student-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.t-dash-student-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary-color);
  background-color: var(--primary-light);
  font-family: var(--font-display);
}

.t-dash-student-meta {
  flex: 1;
  min-width: 0;
}

.t-dash-student-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.t-dash-student-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.t-dash-student-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  background-color: var(--sidebar-bg);
  padding: 12px;
  border-radius: 10px;
}

.t-dash-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.t-dash-stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
}

.t-dash-stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ==========================================================================
   MOBILE & RESPONSIVE ADAPTATIONS (ADDITIONS)
   ========================================================================== */

/* Chat Back Button (Desktop default hidden) */
.btn-chat-back {
  display: none;
}

/* Burger Menu Button (Desktop default hidden) */
.burger-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1010;
  margin-right: 12px;
}

.burger-menu-btn span {
  width: 100%;
  height: 2px;
  background-color: #ffffff;
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Burger Button Animation when Menu Open */
.burger-menu-btn.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.burger-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.burger-menu-btn.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(31, 27, 45, 0.4);
  backdrop-filter: blur(4px);
  z-index: 990;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* Responsive Overrides (Screen width <= 992px) */
@media (max-width: 992px) {
  /* Show Burger Button */
  .burger-menu-btn {
    display: flex;
  }

  /* Make sidebar slide out from left */
  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 280px !important;
    height: 100vh !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000 !important;
    background-color: #ffffff !important;
    box-shadow: 10px 0 30px rgba(31, 27, 45, 0.15);
    border-right: 1px solid var(--border-color) !important;
    border-bottom: none !important;
    padding: 24px 16px !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Override the previous .sidebar horizontal tab styling */
  .app-layout {
    flex-direction: row !important; /* Keep horizontal flow, sidebar is fixed anyway */
  }

  .nav-menu {
    flex-direction: column !important;
    overflow-x: visible !important;
    padding-bottom: 0 !important;
    gap: 8px !important;
  }

  .nav-item {
    white-space: normal !important;
  }

  /* Reset main-content margins / padding */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 16px !important;
  }
}

/* Responsive Overrides (Screen width <= 768px) */
@media (max-width: 768px) {
  /* Scale typography and paddings globally */
  html {
    font-size: 14px; /* Slight scaling down */
  }

  .page-title {
    font-size: 1.5rem !important;
    margin-bottom: 16px !important;
  }

  .dashboard-card, .student-card {
    padding: 16px !important;
    border-radius: 12px !important;
  }

  /* Calendar adaptation */
  .calendar-grid-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .calendar-grid {
    min-width: 650px !important; /* Prevent squishing calendar columns */
  }

  /* Student Table -> Responsive Cards */
  .students-table, 
  .students-table thead, 
  .students-table tbody, 
  .students-table tr, 
  .students-table td {
    display: block !important;
    width: 100% !important;
  }

  .students-table thead {
    display: none !important; /* Hide column headers */
  }

  .students-table tr {
    padding: 16px !important;
    border-bottom: 1px solid var(--border-color) !important;
    margin-bottom: 12px !important;
    border-radius: 8px !important;
    background-color: var(--card-bg) !important;
    box-shadow: 0 2px 8px rgba(31, 27, 45, 0.03) !important;
  }

  .students-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 8px 0 !important;
    border-bottom: none !important;
    text-align: right !important;
  }

  /* Use custom CSS labels based on index */
  .students-table td:nth-child(1)::before { content: "Фото:"; }
  .students-table td:nth-child(2)::before { content: "ФИО:"; }
  .students-table td:nth-child(3)::before { content: "Класс:"; }
  .students-table td:nth-child(4)::before { content: "Группа:"; }
  .students-table td:nth-child(5)::before { content: "Статус:"; }
  .students-table td:nth-child(6)::before { content: "Действия:"; }

  .students-table td::before {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: left;
  }

  .students-table td:nth-child(6) {
    justify-content: flex-end !important;
    gap: 8px;
  }

  /* Chat Adaptation */
  .btn-chat-back {
    display: none; /* Controlled dynamically by active class, let's set to flex on active container */
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-primary); /* Dark color to match the header text */
    cursor: pointer;
    padding: 4px;
    margin-right: 12px;
    border-radius: 50%;
    transition: background-color 0.15s ease;
  }

  .btn-chat-back:hover {
    background-color: var(--sidebar-hover);
  }

  .chat-container {
    height: calc(100vh - 160px) !important;
    min-height: 400px !important;
  }

  .chat-sidebar {
    width: 100% !important;
    display: flex !important;
  }

  .chat-window {
    width: 100% !important;
    display: none !important;
  }

  /* Toggle Chat Window and Contact list on mobile */
  .chat-container.active-chat .chat-sidebar {
    display: none !important;
  }

  .chat-container.active-chat .chat-window {
    display: flex !important;
  }

  .chat-container.active-chat .btn-chat-back {
    display: flex !important;
  }

  /* Student Info Strip column view */
  .student-info-strip {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px !important;
  }

  .student-info-strip > div:last-child {
    margin-left: 0 !important;
    width: 100% !important;
    justify-content: flex-start !important;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Adaptive labels for list items (Homework, Tests, Materials) */
  #teacher-hw-list .hw-item,
  #teacher-tests-list .hw-item,
  #teacher-materials-list .hw-item {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 16px !important;
  }

  #teacher-hw-list .hw-item > div,
  #teacher-tests-list .hw-item > div,
  #teacher-materials-list .hw-item > div {
    width: 100% !important;
    text-align: left !important;
  }

  #teacher-hw-list .hw-item .col-student,
  #teacher-hw-list .hw-item .col-deadline,
  #teacher-hw-list .hw-item .col-status,
  #teacher-tests-list .hw-item .col-student,
  #teacher-tests-list .hw-item .col-deadline,
  #teacher-tests-list .hw-item .col-status,
  #teacher-materials-list .hw-item .col-student,
  #teacher-materials-list .hw-item .col-deadline,
  #teacher-materials-list .hw-item .col-status {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 0.85rem !important;
    padding: 6px 0 !important;
    border-bottom: 1px dashed var(--border-color) !important;
  }

  /* Remove border on the last metadata cell before actions */
  #teacher-hw-list .hw-item .col-status,
  #teacher-tests-list .hw-item .col-status,
  #teacher-materials-list .hw-item .col-status {
    border-bottom: none !important;
  }

  #teacher-hw-list .hw-item .col-student::before { content: "Ученик:"; }
  #teacher-hw-list .hw-item .col-deadline::before { content: "Срок сдачи:"; }
  #teacher-hw-list .hw-item .col-status::before { content: "Статус:"; }

  #teacher-tests-list .hw-item .col-student::before { content: "Ученик:"; }
  #teacher-tests-list .hw-item .col-deadline::before { content: "Вопросов:"; }
  #teacher-tests-list .hw-item .col-status::before { content: "Прохождений:"; }

  #teacher-materials-list .hw-item .col-student::before { content: "Ученик:"; }
  #teacher-materials-list .hw-item .col-deadline::before { content: "Дата:"; }
  #teacher-materials-list .hw-item .col-status::before { content: "Файлы:"; }

  #teacher-hw-list .hw-item .col-student::before,
  #teacher-hw-list .hw-item .col-deadline::before,
  #teacher-hw-list .hw-item .col-status::before,
  #teacher-tests-list .hw-item .col-student::before,
  #teacher-tests-list .hw-item .col-deadline::before,
  #teacher-tests-list .hw-item .col-status::before,
  #teacher-materials-list .hw-item .col-student::before,
  #teacher-materials-list .hw-item .col-deadline::before,
  #teacher-materials-list .hw-item .col-status::before {
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    font-size: 0.85rem !important;
  }

  /* Actions container alignment */
  #teacher-hw-list .hw-item .col-actions,
  #teacher-tests-list .hw-item .col-actions,
  #teacher-materials-list .hw-item .col-actions {
    display: flex !important;
    justify-content: flex-end !important;
    width: 100% !important;
    gap: 8px !important;
    margin-top: 6px !important;
    padding-top: 8px !important;
    border-top: 1px solid var(--border-color) !important;
    border-bottom: none !important;
  }

  /* Form layouts to column */
  .form-actions-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 16px !important;
  }

  .form-actions-row button[type="submit"] {
    width: 100% !important;
  }

  /* Subtopics Tree Row Adaptation to prevent horizontal scroll */
  .tree-row {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    padding: 12px !important;
    gap: 8px !important;
  }

  /* Reduce indentation on mobile to save valuable horizontal space */
  .tree-row.level-2 { margin-left: 8px !important; }
  .tree-row.level-3 { margin-left: 16px !important; }
  .tree-row.level-4 { margin-left: 24px !important; }
  .tree-row.level-5 { margin-left: 32px !important; }
  .tree-row.level-6 { margin-left: 40px !important; }

  .tree-title {
    width: calc(100% - 40px) !important;
    flex-grow: 1 !important;
    word-break: break-word !important;
  }

  .tree-progress-container {
    width: 100% !important;
    margin-left: 0 !important;
    justify-content: space-between !important;
  }

  .tree-actions {
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-top: 4px !important;
    padding-top: 8px !important;
    border-top: 1px dashed var(--border-color) !important;
  }

  .tree-btn-action {
    flex: 1 1 auto !important;
    justify-content: center !important;
    padding: 6px 10px !important;
  }

  /* Compact calendar header to reduce vertical footprint on mobile */
  .calendar-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
  }

  .calendar-month-title {
    order: 1 !important;
    text-align: center !important;
    font-size: 1.2rem !important;
    margin-bottom: 4px !important;
  }

  .calendar-header-left {
    order: 2 !important;
    justify-content: center !important;
    gap: 6px !important;
  }

  .calendar-header-right {
    order: 3 !important;
    justify-content: center !important;
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .calendar-header-right > div, 
  .calendar-header-right > button {
    flex: 1 1 auto !important;
    justify-content: center !important;
  }

  .select-calendar-mode {
    width: 100% !important;
    max-width: 130px !important;
  }

  /* Compact calendar day cells to reduce total calendar height and eliminate vertical scroll */
  .grid-day-cell {
    min-height: 75px !important;
    padding: 4px !important;
    gap: 4px !important;
  }

  .day-num {
    font-size: 0.75rem !important;
  }

  .calendar-event-card {
    padding: 3px 6px !important;
    font-size: 0.65rem !important;
    border-radius: 4px !important;
    gap: 1px !important;
  }

  .ev-topic, .ev-comment {
    font-size: 0.62rem !important;
  }
}

/* Responsive Overrides (Screen width <= 480px) */
@media (max-width: 480px) {
  /* Smaller dialog box spacing */
  .login-body {
    padding: 24px 16px !important;
  }

  /* Modal scaling */
  .modal-card {
    width: 94% !important;
    max-width: 100% !important;
    margin: 12px auto !important;
  }

  /* Make tab titles and content margins tighter */
  .main-header {
    padding: 0 16px !important;
  }

  .profile-pill {
    padding: 4px 10px !important;
    font-size: 0.75rem !important;
  }
}


