/* ========================================
   DEX - Responsive Styles
   Breakpoints:
     - Tablet: max-width 1024px
     - Mobile: max-width 768px
     - Small:  max-width 480px
   ======================================== */

/* Desktop: hide mobile-only, show desktop-only */
.dex-mobile-only {
  display: none !important;
}

/* ========================================
   Hamburger Menu Button (hidden on desktop)
   ======================================== */
.dex-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  z-index: 1100;
}

.dex-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-color);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.dex-hamburger span:nth-child(1) {
  margin-bottom: 5px;
}

.dex-hamburger span:nth-child(3) {
  margin-top: 5px;
}

/* Hamburger animation when open */
.dex-hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.dex-hamburger.active span:nth-child(2) {
  opacity: 0;
}

.dex-hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile menu overlay */
.dex-mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dex-mobile-overlay.active {
  display: block;
  opacity: 1;
}

/* ========================================
   TABLET (max-width: 1024px)
   ======================================== */
@media (max-width: 1024px) {
  :root {
    --fs-h1: 32px;
    --fs-h2: 28px;
    --fs-h3: 22px;
    --fs-h4: 20px;
    --fs-h5: 18px;
    --fs-lg: 24px;
    --fs-md: 22px;
    --fs-base: 16px;
    --fs-small: 15px;
    --fs-sm: 15px;
    --fs-xs: 14px;
    --fs-2xs: 14px;
  }

  /* Header */
  .dex-hamburger {
    display: flex;
  }

  .dex-header-inner {
    padding: 0 16px;
  }

  .dex-nav {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100vh;
    background: var(--white);
    flex-direction: column;
    align-items: stretch;
    padding: 80px 0 20px;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    transition: right 0.3s ease;
    overflow-y: auto;
  }

  .dex-nav.active {
    right: 0;
  }

  .dex-nav-item {
    position: relative;
  }

  .dex-nav-link {
    padding: 14px 24px;
    font-size: 16px;
    border-radius: 0;
    border-bottom: 1px solid var(--border-color);
  }

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

  /* Dropdown in mobile nav */
  .dex-dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    background: var(--bg-grey);
    display: none;
  }

  .dex-nav-item:hover .dex-dropdown,
  .dex-nav-item.open .dex-dropdown {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .dex-dropdown a {
    padding: 12px 24px 12px 40px;
    font-size: 14px;
  }

  /* Header right buttons in mobile nav */
  .dex-header-right {
    position: fixed;
    bottom: 0;
    right: -300px;
    width: 300px;
    padding: 16px 20px;
    background: var(--white);
    border-top: 1px solid var(--border-color);
    z-index: 1051;
    transition: right 0.3s ease;
    flex-wrap: wrap;
    gap: 8px;
  }

  .dex-header-right.active {
    right: 0;
  }

  .dex-btn-login,
  .dex-btn-user {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 14px;
    height: 38px;
    padding: 0 12px;
  }

  .dex-user-info {
    width: 100%;
    justify-content: center;
  }

  /* Hero */

  .dex-hero-title {
    font-size: 28px;
  }

  .dex-hero-subtitle {
    font-size: 16px;
  }

  .dex-hero-image {
    width: 280px;
    height: 200px;
    right: 5%;
  }

  /* Intro */
  .dex-intro {
    flex-direction: column;
    padding: 40px 20px 20px;
    gap: 20px;
  }

  .dex-intro-left {
    margin-right: 0;
  }

  .dex-intro-title {
    font-size: 28px;
  }

  /* Quick Actions */
  .dex-quick-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .dex-quick-card {
    padding: 20px 16px;
  }

  /* Info Grid */
  .dex-info-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  /* Footer */
  .dex-footer-main {
    flex-direction: column;
    gap: 24px;
    align-items: center;
    text-align: center;
  }

  .dex-footer-links {
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
  }

  .dex-footer-info {
    text-align: center;
  }

  /* Page Banner */
  .dex-page-banner {
    height: 160px;
  }

  .dex-page-title {
    font-size: 24px;
  }

  /* Content */
  .dex-content {
    padding: 40px 0;
  }

  /* Tables - horizontal scroll */
  .dex-table-section,
  .dex-exam-table-section {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dex-table,
  .dex-schedule-table,
  .dex-notice-table,
  .dex-answers-table,
  .dex-user-table {
    min-width: 800px;
  }

  /* User Page Layout */
  .dex-user {
    flex-direction: column;
  }

  /* Show sidebar toggle */
  .dex-sidebar-toggle {
    display: flex;
  }

  /* Sidebar as mobile drawer */
  .dex-user-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    border-right: none;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    transition: left 0.3s ease;
    overflow-y: auto;
    background: var(--white);
  }

  .dex-user-sidebar.mobile-open {
    left: 0;
  }

  .dex-user-nav {
    flex-direction: column;
    padding: 0;
    gap: 0;
  }

  .dex-user-link {
    padding: 14px 20px;
    font-size: 15px;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border-color);
  }

  .dex-user-link.active {
    border-left: 3px solid var(--primary);
    background: var(--primary-light);
  }

  .dex-user-submenu {
    padding-left: 0;
  }

  .dex-user-submenu.active {
    display: block;
  }

  .dex-user-submenu a {
    padding: 10px 20px 10px 40px;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border-color);
    display: block;
  }

  .dex-user-content {
    padding: 20px;
    overflow-x: hidden;
    min-width: 0;
  }

  .dex-user-logo {
    text-align: center;
    padding: 16px 20px;
  }

  /* Tables in user pages - horizontal scroll */
  .dex-card-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Charts */
  .dex-charts-grid {
    grid-template-columns: 1fr;
  }

  .dex-chart-card {
    overflow: hidden;
    max-width: 100%;
  }

  .dex-chart-container {
    max-width: 100%;
    overflow: auto;
  }

  .dex-chart-container canvas {
    max-width: 100% !important;
    height: auto !important;
  }

  .dex-chart-legend {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .dex-legend-item {
    font-size: 12px;
    gap: 4px;
  }

  .dex-legend-color {
    width: 12px;
    height: 12px;
  }

  /* Question options in exam view */
  .dex-question-options {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Qualification Intro */
  .dex-qualification-intro-grid {
    flex-direction: column;
    gap: 30px;
  }

  .dex-qualification-intro-left {
    width: 100%;
  }

  .dex-qualification-intro-right {
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
  }

  /* Track Grid */
  .dex-track-grid {
    grid-template-columns: 1fr;
  }

  /* Problem Grid */
  .dex-problem-grid {
    grid-template-columns: 1fr;
  }

  /* Practical Exam */
  .dex-practical-label {
    width: 100px;
    font-size: 14px;
  }

  /* Exam Interface */
  .dex-exam {
    padding: 24px;
  }

  .dex-exam-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  /* Login / Register */
  .dex-login-card {
    padding: 36px 28px;
  }

  /* Modal */
  .dex-modal-lg {
    width: 95%;
  }

  /* Search */
  .dex-search-input {
    width: 100% !important;
  }

  .dex-search-box {
    max-width: 100%;
  }

  /* Exam register */
  .dex-register-row {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }
}

/* ========================================
   Mobile Card Components (base styles)
   Used in exam-register.php, qualification-prep.php
   ======================================== */

/* --- Schedule Card --- */
.dex-m-schedule {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.dex-m-schedule-header {
  background: var(--bg-grey, #f8f9fa);
  padding: 14px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.dex-m-schedule-title {
  font-weight: 700;
  font-size: var(--fs-base);
  margin-bottom: 4px;
  color: var(--primary);
}

.dex-m-schedule-period {
  font-size: var(--fs-small);
  opacity: 0.9;
}

.dex-m-schedule-cards {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.dex-m-exam-info-card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.dex-m-exam-info-card:last-child {
  border-bottom: none;
}

.dex-m-exam-info-label {
  font-weight: 700;
  font-size: var(--fs-small);
  color: var(--primary-color, #027cf7);
  margin-bottom: 8px;
}

.dex-m-exam-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: var(--fs-small);
}

.dex-m-info-key {
  color: #888;
  flex-shrink: 0;
}

.dex-m-info-val {
  font-weight: 500;
  text-align: right;
}

/* --- Grade Cards --- */
.dex-m-grade-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dex-m-grade-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.dex-m-grade-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-grey);
}

.dex-m-grade-level {
  font-weight: 800;
  font-size: var(--fs-lg);
  color: var(--primary-color, #027cf7);
}

.dex-m-grade-name {
  font-weight: 600;
  font-size: var(--fs-base);
  color: #333;
}

.dex-m-grade-target {
  padding: 10px 16px;
  font-size: var(--fs-small);
  color: #666;
  border-bottom: 1px solid var(--border-color);
}

.dex-m-grade-actions {
  display: flex;
  gap: 0;
}

.dex-m-exam-col {
  flex: 1;
  padding: 12px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dex-m-exam-col + .dex-m-exam-col {
  border-left: 1px solid var(--border-color);
}

.dex-m-exam-col-label {
  font-size: var(--fs-2xs);
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
}

/* ========================================
   MOBILE (max-width: 768px)
   ======================================== */
@media (max-width: 768px) {
  :root {
    --header-height: 60px;
    --fs-h1: 26px;
    --fs-h2: 22px;
    --fs-h3: 18px;
    --fs-h4: 17px;
    --fs-h5: 16px;
    --fs-lg: 20px;
    --fs-md: 18px;
    --fs-base: 15px;
    --fs-small: 14px;
    --fs-sm: 14px;
    --fs-xs: 13px;
    --fs-2xs: 13px;
    --btn-height: 42px;
  }

  .dex-user-home {
    margin-left: 0;
  }

  /* Header */
  .dex-logo img {
    height: 30px;
  }

  /* Hero */

  .dex-hero-content {
    padding: 0 16px;
  }

  .dex-hero-title {
    font-size: 22px;
    margin-bottom: 12px;
  }

  .dex-hero-subtitle {
    font-size: 14px;
    margin-bottom: 20px;
  }

  .dex-hero-image {
    display: none;
  }

  .dex-hero-buttons {
    flex-direction: column;
    gap: 10px;
  }

  .dex-hero-indicator {
    bottom: 20px;
  }

  /* Intro */
  .dex-intro {
    padding: 30px 16px 20px;
  }

  .dex-intro-title {
    font-size: 22px;
    line-height: 1.4;
  }

  .dex-intro-desc {
    font-size: 14px;
    line-height: 1.8;
  }

  .dex-intro-btn {
    width: 100%;
    text-align: center;
    padding: 12px 24px;
  }

  /* Quick Actions */
  .dex-quick-actions {
    padding: 20px 0 40px;
  }

  .dex-quick-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .dex-quick-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 12px;
    gap: 8px;
  }

  .dex-quick-icon {
    width: 50px;
    height: 50px;
    margin: 0;
  }

  .dex-quick-icon img {
    width: 50px;
    height: 50px;
  }

  .dex-quick-title {
    font-size: 15px;
    margin-bottom: 8px;
  }

  .dex-quick-btn {
    height: 36px;
    padding: 0 16px;
    font-size: 13px;
    width: 100%;
  }

  /* Section */
  .dex-section {
    padding: 40px 0;
  }

  .dex-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 20px;
  }

  /* Info Cards */
  .dex-info-card {
    padding: 20px;
  }

  .dex-info-header {
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  /* FAQ Page */
  .dex-faq-question {
    padding: 14px 16px;
  }

  .dex-faq-answer {
    padding: 14px 16px;
  }

  .dex-search-content {
    justify-content: stretch;
  }

  .dex-search-box {
    width: 100%;
    max-width: 100%;
  }

  /* Accordion */
  .dex-accordion-header {
    padding: 12px 16px;
  }

  .dex-accordion-item.active .dex-accordion-body {
    padding: 16px;
  }

  /* Footer */
  .dex-footer {
    padding: 24px 0;
  }

  .dex-footer-logo img {
    height: 80px;
  }

  .dex-footer-links {
    gap: 8px;
    font-size: 13px;
  }

  .dex-footer-link {
    font-size: 13px;
  }

  .dex-footer-info {
    font-size: 12px;
    line-height: 1.6;
  }

  .dex-footer-info p {
    word-break: keep-all;
  }

  .dex-footer-bottom {
    font-size: 12px;
  }

  /* Dynamic content from site_settings - scale down large inline font sizes */
  .dex-footer-info [style*="font-size"],
  .dex-content .container [style*="font-size"] {
    font-size: clamp(12px, 3.2vw, 24px) !important;
  }

  /* Ensure tables in dynamic content are responsive */
  .dex-footer-info table,
  .dex-content .container table {
    max-width: 100% !important;
    width: auto !important;
    overflow-x: auto;
    display: block;
  }

  /* Page Banner */
  .dex-page-banner {
    height: 120px;
    background-size: cover;
  }

  .dex-page-title {
    font-size: 20px;
    margin-bottom: 6px;
  }

  .dex-breadcrumb {
    font-size: 12px;
  }

  /* Content & Container */
  .container {
    padding: 0 16px;
  }

  .dex-content {
    padding: 24px 0;
    min-height: auto;
  }

  /* Tables */
  .dex-table th,
  .dex-table td {
    padding: 10px 12px;
    font-size: 13px;
  }

  /* User tables - minimum width to prevent column collapse */
  .dex-user-table {
    min-width: 1200px;
  }

  /* Scrollable table container */
  .dex-card-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Scroll hint shadow on right edge */
  .dex-card-body:has(.dex-user-table) {
    position: relative;
    background-repeat: no-repeat;
    background-size:
      40px 100%,
      40px 100%,
      14px 100%,
      14px 100%;
    background-attachment: local, local, scroll, scroll;
  }

  /* Table cells - prevent text wrap for key data */
  .dex-user-table th {
    white-space: nowrap;
  }

  .dex-user-table td {
    white-space: nowrap;
  }

  /* Cards */
  .dex-card-header {
    padding: 16px;
    align-items: flex-start;
    gap: 8px;
  }

  .dex-card-body {
    padding: 16px !important;
  }

  .dex-card-title {
    font-size: 17px;
  }

  /* Forms (in user pages) */
  .dex-form-group {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 8px;
  }

  .dex-form-group-row {
    flex-direction: row;
    align-items: center;
  }

  .dex-form-group-row .dex-form-value {
    margin-bottom: 8px;
  }

  .dex-form-label {
    flex-shrink: 0;
    width: 80px;
  }

  .dex-form-row {
    flex-direction: column;
    align-items: stretch;
    width: 100% !important;
  }

  .dex-user-form {
    max-width: 100%;
  }

  /* Force all inputs, selects to full width and 40px height in user forms */
  .dex-user-form .dex-form-input,
  .dex-user-form .dex-form-select,
  .dex-user-form input[type="text"],
  .dex-user-form input[type="password"],
  .dex-user-form input[type="tel"],
  .dex-user-form input[type="email"],
  .dex-user-form select {
    width: 100% !important;
    height: 40px !important;
    min-height: 40px;
    min-width: 0;
    box-sizing: border-box;
    font-size: 14px;
    padding: 8px 12px;
  }

  /* Inputs with password toggle need extra right padding */
  .dex-user-form input[type="password"] {
    padding-right: 45px !important;
  }

  .dex-form-input {
    width: 100% !important;
    height: 40px !important;
  }

  .dex-form-value {
    font-size: 15px;
    min-height: 40px;
    display: flex;
    align-items: center;
  }

  /* Password toggle - base CSS handles positioning via .dex-input-wrapper */
  /* No additional overrides needed here */

  /* When .dex-form-group has a hint below input, toggle should still align to input */
  .dex-user-form .dex-form-group .password-toggle ~ .dex-form-hint,
  .dex-user-form .dex-form-group .password-toggle ~ .dex-form-hint-primary {
    position: static !important;
    transform: none !important;
  }

  /* Password hint - move below input instead of overflowing right */
  .dex-user-form .dex-form-hint,
  .dex-user-form .dex-form-hint-primary {
    position: static !important;
    transform: none !important;
    display: block;
    white-space: normal;
    font-size: 12px;
  }

  .dex-form-hint {
    white-space: normal;
  }

  /* Checkbox label spacing */
  .dex-checkbox-label {
    font-size: 14px;
  }

  /* Form actions - center button */
  .dex-form-actions {
    text-align: center;
    margin-top: 24px;
  }

  .dex-form-actions .dex-btn {
    min-width: 160px;
  }

  /* Alert in withdraw page */
  .dex-alert {
    font-size: 13px;
    line-height: 1.6;
  }

  /* Pagination */
  .dex-pagination {
    gap: 4px;
    flex-wrap: wrap;
  }

  .dex-pagination a,
  .dex-pagination span {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .dex-page-btn {
    width: 36px;
    height: 36px;
  }

  /* User Page */
  .dex-user-content {
    padding: 16px;
  }

  .dex-user-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
  }

  .dex-user-breadcrumb {
    font-size: 12px;
    flex-wrap: wrap;
  }

  .dex-user-title {
    font-size: 20px;
    margin-bottom: 16px;
  }

  /* Exam Interface */
  .dex-exam {
    padding: 16px;
  }

  .dex-exam-title {
    font-size: 20px;
    margin-bottom: 24px;
  }

  .dex-exam-question {
    padding: 16px;
  }

  .dex-exam-question-title {
    font-size: 14px;
  }

  .dex-exam-option {
    padding: 10px 14px;
    font-size: 14px;
  }

  .dex-exam-submit {
    padding: 24px 0;
  }

  .dex-exam-timer {
    font-size: 18px;
  }

  /* Question options - single column on mobile */
  .dex-question-options {
    grid-template-columns: 1fr;
  }

  /* Practical Exam */
  .dex-practical-problem,
  .dex-practical-row {
    flex-direction: column;
  }

  .dex-practical-label {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 10px 16px;
  }

  .dex-practical-content {
    padding: 12px 16px;
  }

  /* File Upload */
  .dex-file-upload {
    padding: 24px 16px;
  }

  /* Exam View */
  .dex-exam-view,
  .dex-answers-view {
    padding: 20px 16px;
  }

  .dex-exam-view-title {
    font-size: 20px;
    margin-bottom: 24px;
  }

  /* Login / Register */
  .dex-login-wrap {
    padding: 60px 16px;
    min-height: auto;
  }

  .dex-login-card {
    padding: 28px 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  }

  .dex-login-title {
    font-size: 20px;
  }

  .dex-login-subtitle {
    font-size: 13px;
    margin-bottom: 24px;
  }

  .dex-login-card .dex-form-group {
    margin-bottom: 14px;
  }

  .dex-login-card .dex-form-control {
    height: 44px;
    font-size: 14px;
  }

  .dex-btn-full {
    height: 46px;
    font-size: 15px;
  }

  /* Buttons */
  .dex-btn {
    padding: 10px 20px;
    font-size: 14px;
  }

  .dex-btn-start {
    height: 32px;
    padding: 0 14px;
    font-size: 13px;
  }

  .dex-btn-register {
    height: 32px;
    padding: 0 12px;
    font-size: 13px;
  }

  /* Checklist */
  .dex-checklist-box {
    padding: 16px 20px;
  }

  .dex-checklist li {
    font-size: 14px;
  }

  /* Notice Box */
  .dex-notice-box {
    padding: 16px;
  }

  /* Notice Header */
  .dex-notice-header {
    gap: 8px;
  }

  /* Register Info */
  .dex-register-info {
    padding: 14px;
  }

  /* Modal */
  .dex-modal-sm {
    width: 95%;
  }

  .dex-modal-header {
    padding: 14px 16px;
  }

  .dex-modal-body {
    padding: 16px;
  }

  .dex-modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  /* Exam badge */
  .dex-exam-badge {
    font-size: 13px;
    padding: 4px 12px;
  }

  /* Empty State */
  .dex-empty-state {
    padding: 48px 16px;
    font-size: 14px;
  }

  /* Exam Schedule Box - table responsive */
  .dex-exam-schedule-box {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Level info */
  .dex-level-info {
    padding: 12px 16px;
  }

  .dex-level-actions {
    flex-wrap: wrap;
  }

  /* SweetAlert2 responsive */
  .swal2-popup {
    font-size: 14px !important;
    width: 90% !important;
    max-width: 340px !important;
    padding: 20px 16px !important;
  }

  .swal2-title {
    font-size: 18px !important;
  }

  .swal2-html-container {
    font-size: 14px !important;
    line-height: 1.5 !important;
  }

  .swal2-confirm,
  .swal2-cancel {
    font-size: 14px !important;
    padding: 8px 20px !important;
  }

  /* Desktop/Mobile show-hide utilities */
  .dex-desktop-only {
    display: none !important;
  }

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

  /* Answers Card Layout (mobile) */
  .dex-answers-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .dex-answer-card {
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    margin-bottom: 10px;
  }

  .dex-answer-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
  }

  .dex-answer-card-num {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary, #027cf7);
  }

  .dex-answer-card-answer {
    font-weight: 600;
    font-size: 15px;
    color: #22c55e;
    background: #fff;
    padding: 2px 12px;
    border-radius: 20px;
    border: 1px solid;
  }

  .dex-answer-card-body {
    padding: 12px 16px;
  }

  .dex-answer-card-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-grey, #888);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .dex-answer-card-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color, #333);
    word-break: break-word;
    white-space: normal;
    margin: 0;
  }

  /* Mobile grade cards - use flex instead of block */
  .dex-m-grade-cards.dex-mobile-only {
    display: flex !important;
  }
}

/* ========================================
   SMALL MOBILE (max-width: 480px)
   ======================================== */
@media (max-width: 480px) {
  :root {
    --fs-h1: 22px;
    --fs-h2: 20px;
    --fs-h3: 17px;
  }

  /* Hero */

  .dex-hero-title {
    font-size: 18px;
  }

  /* Intro */
  .dex-intro-title {
    font-size: 20px;
  }

  /* Quick Actions */
  .dex-quick-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .dex-quick-card {
    padding: 12px 8px;
  }

  .dex-quick-icon {
    width: 40px;
    height: 40px;
  }

  .dex-quick-icon img {
    width: 40px;
    height: 40px;
  }

  .dex-quick-title {
    font-size: 14px;
    margin-bottom: 6px;
  }

  .dex-quick-btn {
    font-size: 12px;
    height: 32px;
  }

  /* Footer */
  .dex-footer-links {
    gap: 6px;
  }

  .dex-footer-logo img {
    height: 60px;
  }

  /* Login */
  .dex-login-card {
    padding: 24px 16px;
    border-radius: 12px;
  }

  /* User nav tabs scroll horizontally */
  .dex-user-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
    gap: 6px;
  }

  .dex-user-link {
    white-space: nowrap;
    font-size: 13px;
  }

  /* Exam */
  .dex-exam-options {
    gap: 8px;
  }

  /* FAQ Icon */
  .dex-faq-icon {
    width: 24px;
    height: 24px;
    font-size: 12px;
    margin-right: 8px;
  }
}

/* ========================================
   User Page: Sidebar Toggle Button (hidden on desktop)
   ======================================== */
.dex-sidebar-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: var(--white);
  border: none;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-color);
  text-align: left;
}

.dex-sidebar-toggle svg {
  color: var(--text-grey);
  flex-shrink: 0;
}

/* Sidebar overlay for mobile */
.dex-sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dex-sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ========================================
   Utility: Prevent body scroll when menu open
   ======================================== */
body.mobile-menu-open {
  overflow: hidden;
}

/* ========================================
   Mobile Exam Cards (exam.php)
   ======================================== */
.dex-m-exam-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dex-m-exam-card {
  background: #fff;
  border: 1px solid var(--border-color, #e5e7eb);
  border-top: 2px solid var(--text-color);
  border-radius: 0;
  padding: 16px;
}

.dex-m-exam-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.dex-m-exam-type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.dex-m-exam-type-badge.badge-primary {
  background: var(--primary, #027cf7);
}

.dex-m-exam-type-badge.badge-success {
  background: #10b981;
}

.dex-m-exam-grade {
  font-size: 13px;
  color: var(--text-grey, #6b7280);
  font-weight: 500;
}

.dex-m-exam-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-color, #1a1a1a);
  margin-bottom: 10px;
}

.dex-m-exam-card-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.dex-m-exam-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.dex-m-info-key {
  color: var(--text-grey, #6b7280);
}

.dex-m-info-val {
  color: var(--text-color, #1a1a1a);
  font-weight: 500;
}

.dex-m-exam-card-action {
  margin-top: 4px;
}

.dex-btn-full {
  width: 100%;
  text-align: center;
}

/* ========================================
   Mobile Practical Question Cards (user.php)
   ======================================== */
.dex-m-pq-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dex-m-pq-card {
  background: #fff;
  border: 1px solid var(--border-color, #e5e7eb);
  border-top: 2px solid var(--text-color);
  padding: 14px 16px;
}

.dex-m-pq-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.dex-m-pq-number {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color, #1a1a1a);
}

.dex-m-pq-score {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary, #027cf7);
}

.dex-m-pq-card-actions {
  display: flex;
  gap: 8px;
}

.dex-m-pq-card-actions .dex-btn {
  flex: 1;
  text-align: center;
  justify-content: center;
}

/* ========================================
   Mobile Question Cards (user-practical.php detail)
   ======================================== */
.dex-m-question-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dex-m-question-card {
  background: #fff;
  border: 1px solid var(--border-color, #e5e7eb);
  border-top: 2px solid var(--text-color);
  padding: 14px 16px;
}

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

.dex-m-question-number {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color, #1a1a1a);
}

.dex-m-question-score {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary, #027cf7);
}

.dex-m-question-card-answer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-bottom: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border-color, #e5e7eb);
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.dex-m-question-card-actions {
  display: flex;
  gap: 8px;
}

.dex-m-question-card-actions .dex-btn {
  flex: 1;
  text-align: center;
  justify-content: center;
}

/* Answer badges */
.dex-answer-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.dex-answer-file {
  background: #eff6ff;
  color: #2563eb;
}

.dex-answer-text {
  background: #f0fdf4;
  color: #16a34a;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* ========================================
   Mobile Improvement Cards (user.php)
   ======================================== */
.dex-m-improve-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dex-m-improve-card {
  background: #fff;
  border: 1px solid var(--border-color, #e5e7eb);
  border-top: 2px solid var(--text-color);
  padding: 14px 16px;
}

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

.dex-m-improve-area {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color, #1a1a1a);
}

.dex-m-improve-grade {
  font-size: 14px;
  letter-spacing: 2px;
}

.dex-m-improve-tips {
  font-size: 13px;
  color: var(--text-grey, #6b7280);
  line-height: 1.6;
}
