/* ==========================================================================
   Badriyya Academy - Core Design System & Portal Stylesheet
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Alata&family=Alexandria:wght@400;500;600;700;800&family=Arimo:ital,wght@0,400;0,600;0,700;1,400;1,700&family=Baloo+Chettan+2:wght@400;600;700;800&family=Gabarito:wght@400;600;700;800&family=Inter:wght@400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  /* Brand Palette */
  --primary: #A14600;
  --primary-hover: #7C3702;
  --primary-dark: #652c00;
  --primary-light: #fef7ee;
  --primary-focus: rgba(161, 70, 0, 0.15);

  --secondary: #433322;
  --secondary-hover: #2b1f13;
  --secondary-light: #f7efe4;

  --accent-teal: #099A97;
  --accent-teal-hover: #13C1A3;
  --accent-gold: #D7AF7C;

  --success: #137333;
  --success-bg: #eaf5ee;
  --success-border: #c8e6d0;

  --danger: #c5221f;
  --danger-bg: #fdeeee;
  --danger-border: #f8c9c8;

  --warning: #995a00;
  --warning-bg: #fef6e7;
  --warning-border: #f9e2b8;

  --info: #099A97;
  --info-bg: #e6f7f6;
  --info-border: #b8ebe7;

  /* Surfaces & Backgrounds */
  --bg-page: #FFFEF8;
  --bg-card: #FFFFFF;
  --bg-subtle: #fdfbf7;
  --bg-hover: #fcf8f2;
  --bg-active: #f7efe4;

  /* Borders & Dividers */
  --border: #efe4d5;
  --border-strong: #dccbb6;

  /* Typography */
  --text-dark: #372706;
  --text-body: #4a4035;
  --text-muted: #8c7b69;
  --text-light: #FFFEF8;

  /* Radii */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(67, 51, 34, 0.04);
  --shadow-md: 0 6px 20px rgba(67, 51, 34, 0.06);
  --shadow-lg: 0 12px 30px rgba(161, 70, 0, 0.08);

  /* Transition */
  --transition: all 0.25s ease;
}

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

html {
  scrollbar-width: thin;
  scrollbar-color: #d7c5b0 transparent;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: #d7c5b0;
  border-radius: 10px;
  transition: background-color 0.25s ease;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #A14600;
}

body {
  width: 100%;
  min-height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-dark);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Alexandria', 'Arimo', sans-serif;
  color: var(--text-dark);
  font-weight: 700;
  line-height: 1.3;
}

h1 { font-size: 26px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

p {
  color: var(--text-body);
}

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

a:hover {
  color: var(--primary-hover);
}

/* ==========================================================================
   Header & Navbar (Admin & Student)
   ========================================================================== */
.navbar {
  background: rgba(255, 254, 248, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.navbar-left {
  display: flex;
  align-items: center;
}

.navbar-brand {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.navbar-brand img {
  height: 42px;
  max-width: 220px;
  width: auto;
  object-fit: contain;
  display: block;
}

.navbar-brand::before {
  content: none;
  display: none;
}

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

.nav-links {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nav-link {
  color: var(--text-dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

@media (min-width: 1280px) {
  .nav-links {
    gap: 8px;
  }
  .nav-link {
    font-size: 13.5px;
    padding: 8px 16px;
  }
}

.nav-link:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-link.active,
.nav-link.active:hover,
.nav-link.active:focus,
.nav-link.active:active {
  background: var(--primary) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(161, 70, 0, 0.2);
}

/* Navigation Dropdown ("More") */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dark);
  padding: 8px 14px;
  -webkit-tap-highlight-color: transparent;
}

.nav-dropdown-toggle:hover,
.nav-dropdown.open .nav-dropdown-toggle:not(.active) {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-light);
}

.nav-dropdown-toggle.active,
.nav-dropdown-toggle.active:hover,
.nav-dropdown-toggle.active:focus,
.nav-dropdown-toggle.active:active,
.nav-dropdown.open .nav-dropdown-toggle.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 4px 12px rgba(161, 70, 0, 0.2);
}

.dropdown-chevron {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.desktop-nav-link {
  display: inline-flex;
}

.desktop-only {
  display: inline-flex;
}

.mobile-only,
.nav-dropdown.mobile-only {
  display: none !important;
}

.mobile-only-item {
  display: none !important;
}

.nav-dropdown.open .dropdown-chevron {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1100;
  display: flex;
  flex-direction: column;
}

.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  color: var(--text-dark);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 8px;
  transition: var(--transition);
}

.dropdown-item:hover {
  background: var(--primary-light);
  color: var(--primary);
  transform: translateX(3px);
}

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

.dropdown-item.active::before {
  content: "•";
  color: var(--primary);
  font-size: 18px;
  line-height: 0;
  margin-right: 8px;
}

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

.navbar-user-actions {
  display: flex;
  align-items: center;
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  transition: var(--transition);
  color: var(--text-muted);
}

.logout-btn svg {
  flex-shrink: 0;
}

.logout-btn:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */
.container {
  max-width: 1100px;
  margin: 28px auto 40px;
  padding: 0 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

/* ==========================================================================
   Grids & Flexbox Utilities
   ========================================================================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

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

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

.page-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.page-header-btn {
  white-space: nowrap;
}

.admin-header-desc {
  color: var(--text-muted);
}

.courses-mobile-list,
.admin-mobile-cards-list {
  display: none;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  gap: 6px;
  line-height: 1.2;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(161, 70, 0, 0.2);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(161, 70, 0, 0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  border-color: var(--border-strong);
  color: var(--text-dark);
  box-shadow: 0 2px 6px rgba(67, 51, 34, 0.04);
}

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

.btn-danger {
  background: var(--danger);
  color: #ffffff !important;
  box-shadow: 0 4px 10px rgba(197, 34, 31, 0.2);
}

.btn-danger:hover {
  background: #a81c19;
}

.btn-success {
  background: var(--success);
  color: #ffffff !important;
  box-shadow: 0 4px 10px rgba(19, 115, 51, 0.2);
}

.btn-success:hover {
  background: #0f5c29;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: var(--radius-pill);
}

/* ==========================================================================
   Dropdowns & 3-Dot Menus
   ========================================================================== */
.dropdown {
  position: relative;
  display: inline-flex;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--text-dark);
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  transition: var(--transition);
  padding: 0;
}

.btn-icon:hover {
  background: var(--bg-subtle);
  border-color: var(--primary);
  color: var(--primary);
}

.dropdown-menu {
  position: fixed;
  background: #ffffff;
  min-width: 175px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(67, 51, 34, 0.18);
  padding: 6px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dropdown-menu.hidden {
  display: none !important;
}

.dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  color: var(--text-dark);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  box-sizing: border-box;
}

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

.dropdown-item.danger {
  color: var(--danger);
}

.dropdown-item.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ==========================================================================
   Forms & Inputs
   ========================================================================== */
.form-group {
  margin-bottom: 18px;
}

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

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  background: #ffffff;
  color: var(--text-dark);
  transition: var(--transition);
}

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

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

/* ==========================================================================
   Tables
   ========================================================================== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

th {
  background: var(--secondary-light);
  color: var(--primary-dark);
  font-weight: 700;
  font-family: 'Arimo', sans-serif;
  letter-spacing: 0.3px;
}

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

tr:hover td {
  background: var(--bg-hover);
}

/* ==========================================================================
   Badges & Status Tags
   ========================================================================== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-primary { background: var(--primary-light); color: var(--primary); border: 1px solid var(--border); }
.badge-info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); }
.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }

/* ==========================================================================
   Alerts
   ========================================================================== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success); }
.alert-danger { background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger); }
.alert-info { background: var(--info-bg); border: 1px solid var(--info-border); color: var(--info); }

/* ==========================================================================
   Audio Player Component
   ========================================================================== */
.player-container {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 16px;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e8dfd5;
  border-radius: var(--radius-pill);
  cursor: pointer;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-pill);
  width: 0%;
  transition: width 0.1s linear;
}

/* ==========================================================================
   Exam Components
   ========================================================================== */
.timer-badge {
  font-size: 16px;
  font-weight: 700;
  color: var(--danger);
  padding: 6px 14px;
  border: 1.5px solid var(--danger);
  border-radius: var(--radius-pill);
  background: var(--danger-bg);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.question-palette {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.palette-btn {
  padding: 10px 6px;
  text-align: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dark);
  transition: var(--transition);
}

.palette-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(161, 70, 0, 0.25);
}

.palette-btn.answered {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(55, 39, 6, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-backdrop.hidden { display: none; }

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

/* ==========================================================================
   Login & Auth Components
   ========================================================================== */
.login-container {
  max-width: 440px;
  margin: 40px auto;
  background: #ffffff;
  padding: 38px 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.biometric-btn {
  background: linear-gradient(135deg, #7C3702 0%, #A14600 100%);
  color: #ffffff;
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(161, 70, 0, 0.28);
}

.biometric-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(161, 70, 0, 0.38);
}

.divider {
  text-align: center;
  margin: 24px 0 20px 0;
  position: relative;
}

.divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-top: 1px solid var(--border);
}

.divider span {
  background: #ffffff;
  padding: 0 14px;
  position: relative;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.tab-btn {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid transparent;
  background: transparent;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(67, 51, 34, 0.08);
}

/* Setup & Verify Cards */
.setup-card, .verify-card {
  max-width: 580px;
  margin: 40px auto;
  background: #ffffff;
  padding: 36px 30px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  border-top: 6px solid var(--primary);
}

.step-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Mobile & Responsive Adaptations (Prioritized)
   ========================================================================== */
@media (max-width: 900px) {
  .navbar {
    padding: 10px 16px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
  }

  .navbar-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  .navbar-brand {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
  }

  .navbar-right {
    display: contents;
  }

  .navbar-user-actions {
    order: 2;
    margin-left: auto;
  }

  .nav-links {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    gap: 8px;
  }

  .nav-link {
    padding: 6px 14px;
    font-size: 13px;
  }

  /* Student Portal Mobile Navbar */
  .navbar-student {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    gap: 10px 0;
  }

  .navbar-student .navbar-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  .navbar-student .navbar-brand img {
    height: 38px;
    max-width: 180px;
  }

  .navbar-student .navbar-user-actions {
    order: 2;
    margin-left: auto;
    display: flex;
    align-items: center;
  }

  .navbar-student .nav-links {
    order: 3;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
  }

  .navbar-student .nav-link {
    text-align: center;
    justify-content: center;
  }

  .nav-dropdown-menu {
    right: auto;
    left: 0;
    min-width: 220px;
  }

  .desktop-nav-link {
    display: none !important;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: inline-flex !important;
  }

  .nav-dropdown.mobile-only {
    display: block !important;
  }

  .mobile-only-item {
    display: flex !important;
  }

  .nav-dropdown-toggle.mobile-only,
  .nav-dropdown-toggle.mobile-only:hover,
  .nav-dropdown-toggle.mobile-only:focus,
  .nav-dropdown-toggle.mobile-only:active,
  .nav-dropdown.open .nav-dropdown-toggle.mobile-only,
  .nav-dropdown.open .nav-dropdown-toggle.mobile-only:hover,
  .nav-dropdown.open .nav-dropdown-toggle.mobile-only:focus,
  .nav-dropdown.open .nav-dropdown-toggle.mobile-only:active {
    background: var(--primary) !important;
    color: #ffffff !important;
    border: 1px solid var(--primary) !important;
    padding: 7px 16px;
    font-size: 13.5px;
    font-weight: 700;
    gap: 8px;
    border-radius: var(--radius-pill);
    box-shadow: 0 4px 12px rgba(161, 70, 0, 0.2);
    -webkit-tap-highlight-color: transparent;
    outline: none;
  }

  .nav-dropdown-toggle.mobile-only:active {
    transform: scale(0.98);
  }

  .nav-dropdown-toggle.mobile-only .dropdown-chevron,
  .nav-dropdown.open .nav-dropdown-toggle.mobile-only .dropdown-chevron {
    stroke: #ffffff !important;
  }

  .container {
    margin-top: 18px;
    padding: 0 14px;
  }

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

  /* Admin Mobile View Enhancements */
  #adminName {
    display: block;
    margin-top: 4px;
  }

  .admin-header-desc {
    display: none !important;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 20px;
  }

  .page-header .btn,
  .page-header-btn {
    width: 100% !important;
  }

  .page-header-actions {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .page-header-actions .btn {
    width: 100% !important;
  }

  .page-header-actions .btn-primary {
    order: -1;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .card-header .btn {
    width: 100% !important;
  }

  /* Courses Mobile Responsive Card View */
  .courses-desktop-table {
    display: none !important;
  }

  .courses-mobile-list {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
  }

  .course-card-item {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .course-card-top {
    display: flex;
    gap: 12px;
    align-items: flex-start;
  }

  .course-card-thumb {
    flex-shrink: 0;
  }

  .course-card-thumb img,
  .course-card-thumb div {
    width: 58px;
    height: 42px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
  }

  .course-card-main {
    flex: 1;
    min-width: 0;
  }

  .course-card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
  }

  .course-card-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.35;
    word-break: break-word;
  }

  .course-card-instructor {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
  }

  .course-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 0;
    border-top: 1px dashed var(--border);
    border-bottom: 1px dashed var(--border);
  }

  .course-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-dark);
    background: #f8fafc;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(0, 0, 0, 0.05);
  }

  .course-meta-pill svg {
    color: var(--primary);
  }

  .course-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .course-card-manage-btn {
    flex: 1;
    justify-content: center;
    gap: 6px;
    height: 38px;
    font-size: 13px;
    font-weight: 600;
    background: transparent !important;
    color: #000000 !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    transition: var(--transition);
  }

  .course-card-manage-btn svg {
    color: #000000 !important;
    stroke: #000000 !important;
  }

  .course-card-manage-btn:hover {
    background: #f8fafc !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12) !important;
  }

  .course-card-manage-btn:active {
    background: #f1f5f9 !important;
    transform: scale(0.98);
  }

  .course-card-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: #f8fafc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    color: var(--text-dark);
  }

  /* Unified Admin Mobile Cards System (Batches, Exams, Question Banks, Admissions, Students) */
  .admin-desktop-table {
    display: none !important;
  }

  .admin-mobile-cards-list {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
  }

  .admin-card-item {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .admin-card-item:active {
    background: #fafafa;
  }

  .admin-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
  }

  .admin-card-main {
    flex: 1;
    min-width: 0;
  }

  .admin-card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
  }

  .admin-card-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.35;
    word-break: break-word;
  }

  .admin-card-subtitle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.3;
  }

  .admin-card-contact {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    color: var(--text-dark);
    margin-top: 4px;
  }

  .admin-card-contact-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 11.5px;
  }

  .admin-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 0;
    border-top: 1px dashed var(--border);
    border-bottom: 1px dashed var(--border);
  }

  .admin-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-dark);
    background: #f8fafc;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(0, 0, 0, 0.05);
  }

  .admin-meta-pill svg {
    color: var(--primary);
  }

  .admin-card-progress {
    width: 100%;
    margin-top: 2px;
  }

  .admin-card-progress-bar {
    background: #e2e8f0;
    border-radius: 4px;
    height: 6px;
    width: 100%;
    overflow: hidden;
    margin-top: 4px;
  }

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

  .admin-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .admin-card-actions .btn {
    flex: 1;
    min-width: 90px;
    justify-content: center;
    height: 38px;
    font-size: 13px;
    font-weight: 600;
  }
}

@media (max-width: 600px) {
  .card {
    padding: 18px 14px;
    margin-bottom: 16px;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .card-header .btn {
    width: 100% !important;
  }

  th, td {
    padding: 10px 12px;
    font-size: 13px;
  }

  .login-container {
    margin: 20px auto;
    padding: 28px 18px;
  }

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

@media (max-width: 480px) {
  .navbar-student {
    padding: 8px 12px;
  }

  .navbar-student .navbar-brand img {
    height: 34px;
    max-width: 160px;
  }

  .navbar-student .logout-btn {
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
    gap: 4px;
  }

  .navbar-student .logout-btn svg {
    width: 14px;
    height: 14px;
  }

  .navbar-student .nav-links {
    gap: 6px;
    padding-top: 6px;
  }

  .navbar-student .nav-link {
    padding: 5px 10px;
    font-size: 12px;
  }
}

/* ==========================================================================
   UI Toasts & Custom Modals
   ========================================================================== */
.ui-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 420px;
  width: calc(100vw - 40px);
}

.ui-toast {
  pointer-events: auto;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(67, 51, 34, 0.15);
  animation: uiSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.25s ease, transform 0.25s ease;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-dark);
}

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

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

.ui-toast-info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info);
}

.ui-toast-warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning);
}

.ui-toast-close {
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0;
}

.ui-toast-close:hover {
  opacity: 1;
}

.ui-toast-fadeout {
  opacity: 0;
  transform: translateY(-8px);
}

@keyframes uiSlideIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ui-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(30, 20, 10, 0.5);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.ui-modal-backdrop.hidden {
  display: none !important;
}

.ui-modal-card {
  background: #ffffff;
  border-radius: var(--radius);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(67, 51, 34, 0.2);
  text-align: center;
  border: 1px solid var(--border);
  animation: uiModalScale 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes uiModalScale {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.ui-modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.ui-modal-message {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-dark);
  margin-bottom: 24px;
  white-space: pre-line;
}

.ui-modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}
