/* =========================================================
   V15 - MOBILE LAUNCH READY
   Comprehensive mobile-first CSS for Student, Teacher, Institute portals
   + Premium Login Page + Enhanced UX
   ========================================================= */

/* --- CSS Variables for mobile theming --- */
:root {
  --v5-touch-min: 44px;
  --v5-mobile-nav-h: 62px;
  --v5-topbar-h: 56px;
  --v5-radius: 14px;
  --v5-radius-sm: 10px;
  --v5-shadow: 0 8px 32px rgba(0,0,0,.18);
  --v5-shadow-lg: 0 16px 48px rgba(0,0,0,.24);
}

/* =========================================================
   1. GLOBAL MOBILE RESETS & BASE
   ========================================================= */
@media (max-width: 768px) {
  body {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }

  /* Prevent horizontal overflow */
  .main-layout {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  /* Content area full width */
  .content {
    padding: 12px !important;
    gap: 14px !important;
  }

  /* Container reset */
  .container {
    width: calc(100% - 24px) !important;
    padding: 0 12px !important;
  }

  /* =========================================================
     2. SIDEBAR - MOBILE BEHAVIOR
     ========================================================= */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 85% !important;
    max-width: 320px !important;
    height: 100vh !important;
    z-index: 1001 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-radius: 0 !important;
    padding: 16px !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .sidebar.is-open {
    transform: translateX(0) !important;
  }

  /* Sidebar brand compact */
  .sidebar .brand {
    gap: 10px !important;
  }

  .sidebar .brand-logo {
    width: 40px !important;
    height: 40px !important;
    border-radius: 12px !important;
    font-size: 0.85rem !important;
  }

  .sidebar .brand h2 {
    font-size: 1rem !important;
    margin: 0 !important;
  }

  .sidebar .brand p {
    font-size: 0.75rem !important;
    margin: 2px 0 0 !important;
  }

  /* Nav links - touch friendly */
  .nav-links {
    gap: 6px !important;
    margin-top: 16px !important;
  }

  .nav-links a {
    padding: 12px 14px !important;
    min-height: var(--v5-touch-min) !important;
    display: flex !important;
    align-items: center !important;
    border-radius: var(--v5-radius-sm) !important;
    font-size: 0.9rem !important;
  }

  .nav-links a.is-active {
    background: rgba(86, 204, 242, 0.18) !important;
    border-color: rgba(86, 204, 242, 0.35) !important;
  }

  /* Sidebar scroll indicators hide on mobile */
  .sidebar-scroll-indicator {
    display: none !important;
  }

  /* =========================================================
     3. MOBILE TOPBAR - ENHANCED
     ========================================================= */
  .mobile-topbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: var(--v5-topbar-h) !important;
    z-index: 1000 !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 12px !important;
    gap: 10px !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    background: rgba(7, 11, 23, 0.92) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  }

  .mobile-topbar .hamburger {
    width: var(--v5-touch-min) !important;
    height: var(--v5-touch-min) !important;
    min-width: var(--v5-touch-min) !important;
    min-height: var(--v5-touch-min) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border-radius: var(--v5-radius-sm) !important;
    color: var(--text) !important;
    font-size: 1.3rem !important;
    cursor: pointer !important;
  }

  .mobile-topbar .mini-brand {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
  }

  .mobile-topbar .mini-brand .brand-logo {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    font-size: 0.78rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .mobile-topbar .mini-brand span {
    font-weight: 700 !important;
    font-size: 0.92rem !important;
  }

  /* =========================================================
     4. MOBILE OVERLAY
     ========================================================= */
  .mobile-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1000 !important;
    background: rgba(0, 0, 0, 0.55) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 0.3s ease, visibility 0.3s ease !important;
  }

  .mobile-overlay.is-open {
    opacity: 1 !important;
    visibility: visible !important;
  }

  body.mobile-menu-open .mobile-overlay {
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* =========================================================
     5. BOTTOM NAV - ENHANCED
     ========================================================= */
  .bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: var(--v5-mobile-nav-h) !important;
    z-index: 999 !important;
    display: flex !important;
    align-items: stretch !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    background: rgba(7, 11, 23, 0.94) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3) !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    transform: none !important;
    left: 0 !important;
  }

  .bottom-nav a {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    padding: 6px 4px !important;
    min-height: var(--v5-mobile-nav-h) !important;
    border-radius: 0 !important;
    font-size: 0.65rem !important;
    color: rgba(239, 244, 255, 0.65) !important;
    text-decoration: none !important;
    transition: color 0.2s ease, background 0.2s ease !important;
    position: relative !important;
  }

  .bottom-nav a div:first-child {
    font-size: 1.15rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
  }

  .bottom-nav a div:last-child {
    font-size: 0.62rem !important;
    line-height: 1.1 !important;
    opacity: 0.85 !important;
  }

  .bottom-nav a.is-active {
    color: var(--accent) !important;
    background: rgba(86, 204, 242, 0.1) !important;
  }

  .bottom-nav a.is-active::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 32px !important;
    height: 3px !important;
    border-radius: 0 0 3px 3px !important;
    background: var(--accent) !important;
  }

  /* =========================================================
     6. TOUCH-FRIENDLY BUTTONS & FORMS
     ========================================================= */

  /* Buttons - minimum 44px touch target */
  .btn, button, [role="button"] {
    min-height: var(--v5-touch-min) !important;
    padding: 10px 16px !important;
    border-radius: var(--v5-radius-sm) !important;
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    cursor: pointer !important;
    -webkit-user-select: none !important;
    user-select: none !important;
  }

  .btn-sm {
    min-height: 38px !important;
    padding: 8px 12px !important;
    font-size: 0.82rem !important;
  }

  /* Form inputs */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  input[type="search"],
  input[type="url"],
  input[type="date"],
  select,
  textarea {
    min-height: var(--v5-touch-min) !important;
    padding: 10px 14px !important;
    border-radius: var(--v5-radius-sm) !important;
    font-size: 16px !important; /* Prevents iOS zoom on focus */
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    background: rgba(255, 255, 255, 0.06) !important;
    color: var(--text) !important;
    width: 100% !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }

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

  textarea {
    min-height: 100px !important;
    padding: 12px 14px !important;
  }

  /* Labels */
  label {
    display: block !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    margin-bottom: 6px !important;
    color: var(--muted) !important;
  }

  /* Form grid - single column on mobile */
  .form-grid, .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Action rows - stack buttons */
  .action-row, .top-actions, .auth-actions {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .action-row .btn, .top-actions .btn, .auth-actions .btn {
    width: 100% !important;
    text-align: center !important;
  }

  /* =========================================================
     7. TABLE TO CARD - ENHANCED MOBILE
     ========================================================= */
  .table-wrap {
    border-radius: var(--v5-radius) !important;
    overflow: visible !important;
  }

  .table-wrap table {
    display: block !important;
    border: none !important;
  }

  .table-wrap thead {
    display: none !important;
  }

  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block !important;
    width: 100% !important;
  }

  .table-wrap tr {
    padding: 14px !important;
    margin-bottom: 10px !important;
    border-radius: var(--v5-radius) !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    position: relative !important;
  }

  .table-wrap td {
    padding: 6px 0 !important;
    border: none !important;
    text-align: left !important;
    font-size: 0.88rem !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .table-wrap td::before {
    content: attr(data-label) !important;
    font-weight: 700 !important;
    font-size: 0.72rem !important;
    color: var(--muted) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    min-width: 80px !important;
    flex-shrink: 0 !important;
  }

  .table-wrap td:last-child {
    margin-top: 8px !important;
    padding-top: 10px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
  }

  .table-wrap td:last-child::before {
    display: none !important;
  }

  /* =========================================================
     8. CARDS & GRIDS - MOBILE
     ========================================================= */
  .card-grid,
  .stats-grid,
  .feature-grid,
  .metric-row,
  .funnel-grid,
  .quick-grid,
  .dashboard-mini-grid,
  .role-kpi-grid,
  .role-work-grid,
  .myexam-kpis {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Cards */
  .card,
  .stats-card,
  .table-card,
  .info-card,
  .hero-card,
  .kpi {
    padding: 16px !important;
    border-radius: var(--v5-radius) !important;
  }

  .kpi .big {
    font-size: 1.5rem !important;
  }

  /* =========================================================
     9. PAGE HEADINGS
     ========================================================= */
  .page-head {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: flex-start !important;
  }

  .page-head h1 {
    font-size: 1.4rem !important;
    line-height: 1.25 !important;
  }

  .page-head p {
    font-size: 0.85rem !important;
  }

  .section-heading {
    flex-direction: column !important;
    gap: 8px !important;
    align-items: flex-start !important;
  }

  .section-heading h2 {
    font-size: 1.2rem !important;
  }

  .section-heading p {
    font-size: 0.82rem !important;
  }

  /* =========================================================
     10. BADGES & PILLS
     ========================================================= */
  .badge {
    padding: 6px 10px !important;
    font-size: 0.72rem !important;
    min-height: 28px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  .pill-row, .hero-badge-row {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  /* =========================================================
     11. MODAL - MOBILE
     ========================================================= */
  .modal-backdrop .glass {
    width: calc(100% - 24px) !important;
    max-width: 480px !important;
    margin: 0 auto !important;
    border-radius: var(--v5-radius) !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }

  /* =========================================================
     12. FLASH MESSAGES
     ========================================================= */
  .flash {
    padding: 12px 14px !important;
    border-radius: var(--v5-radius-sm) !important;
    font-size: 0.85rem !important;
    margin-bottom: 12px !important;
  }

  /* =========================================================
     13. FOOTER / SIDEBAR FOOTER
     ========================================================= */
  .sidebar-footer {
    padding: 12px !important;
    border-radius: var(--v5-radius-sm) !important;
  }

  .sidebar-footer .small {
    font-size: 0.75rem !important;
    line-height: 1.4 !important;
  }

  /* =========================================================
     14. SCROLLING & OVERFLOW
     ========================================================= */
  body.mobile-menu-open {
    overflow: hidden !important;
  }

  .content {
    overflow-x: hidden !important;
  }

  /* =========================================================
     15. THEME TOGGLE - REPOSITION
     ========================================================= */
  .theme-toggle {
    position: fixed !important;
    bottom: calc(var(--v5-mobile-nav-h) + 12px) !important;
    right: 12px !important;
    z-index: 998 !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    background: rgba(7, 11, 23, 0.85) !important;
    color: var(--text) !important;
    font-size: 0.7rem !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    backdrop-filter: blur(12px) !important;
    box-shadow: var(--v5-shadow) !important;
  }

  /* =========================================================
     16. MOBILE PREVIEW TOGGLE - HIDE
     ========================================================= */
  .mobile-preview-toggle {
    display: none !important;
  }

  /* =========================================================
     17. MAIN CONTENT PADDING BELOW TOPBAR & ABOVE BOTTOM NAV
     ========================================================= */
  .main-layout {
    padding-top: calc(var(--v5-topbar-h) + 8px) !important;
    padding-bottom: calc(var(--v5-mobile-nav-h) + 12px) !important;
  }

  /* =========================================================
     18. AUTH / LOGIN PAGE - MOBILE ENHANCEMENTS
     ========================================================= */
  .auth-wrap {
    padding: 16px !important;
    min-height: 100vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .auth-shell {
    width: 100% !important;
    max-width: 480px !important;
  }

  .auth-showcase {
    text-align: center !important;
    padding: 20px !important;
    margin-bottom: 16px !important;
  }

  .auth-showcase .eyebrow {
    font-size: 0.75rem !important;
    padding: 7px 12px !important;
  }

  .auth-showcase h2 {
    font-size: 1.3rem !important;
    margin: 12px 0 8px !important;
  }

  .auth-showcase p {
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
  }

  .hero-badge-row {
    justify-content: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
  }

  .hero-badge {
    padding: 5px 10px !important;
    font-size: 0.7rem !important;
    border-radius: 999px !important;
  }

  .auth-card-premium {
    padding: 20px !important;
    border-radius: var(--v5-radius) !important;
  }

  .auth-title-row {
    flex-direction: column !important;
    gap: 10px !important;
    align-items: flex-start !important;
  }

  .auth-title-row .brand {
    gap: 10px !important;
  }

  .auth-title-row .brand-logo {
    width: 42px !important;
    height: 42px !important;
    font-size: 0.85rem !important;
  }

  .auth-title-row .brand h2 {
    font-size: 1.15rem !important;
  }

  .form-stack {
    gap: 14px !important;
  }

  .form-stack > div {
    width: 100% !important;
  }

  .auth-actions {
    flex-direction: column !important;
    gap: 8px !important;
    margin-top: 8px !important;
  }

  .auth-actions .btn {
    width: 100% !important;
    text-align: center !important;
  }

  .login-footer-copy {
    font-size: 0.75rem !important;
    text-align: center !important;
    padding: 12px 0 0 !important;
  }

  /* =========================================================
     19. NAV SECTION TITLES
     ========================================================= */
  .nav-section-title {
    font-size: 0.7rem !important;
    padding: 8px 0 4px !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    color: var(--muted) !important;
    opacity: 0.7 !important;
  }

  /* =========================================================
     20. SCROLLBAR - MOBILE FRIENDLY
     ========================================================= */
  .sidebar::-webkit-scrollbar,
  .content::-webkit-scrollbar {
    width: 4px !important;
  }

  .sidebar::-webkit-scrollbar-thumb,
  .content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15) !important;
    border-radius: 4px !important;
  }

  /* =========================================================
     21. FILTERS & SEARCH - MOBILE
     ========================================================= */
  .filter-bar, .search-bar, .toolbar {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 12px !important;
  }

  .filter-bar input,
  .filter-bar select {
    width: 100% !important;
  }

  /* =========================================================
     22. TABS / TAB NAVIGATION
     ========================================================= */
  .tabs, .tab-row {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    gap: 4px !important;
    padding: 4px !important;
  }

  .tabs::-webkit-scrollbar {
    display: none !important;
  }

  .tabs a, .tab-row a {
    flex-shrink: 0 !important;
    min-height: 38px !important;
    padding: 8px 14px !important;
    font-size: 0.82rem !important;
    white-space: nowrap !important;
  }

  /* =========================================================
     23. STAT NUMBERS - MOBILE
     ========================================================= */
  .stats-card h3 {
    font-size: 1.6rem !important;
  }

  /* =========================================================
     24. LIST ITEMS
     ========================================================= */
  .list-item, .list-card {
    padding: 14px !important;
    gap: 10px !important;
  }

  .list-item-meta {
    font-size: 0.78rem !important;
  }

  /* =========================================================
     25. EMPTY STATES
     ========================================================= */
  .empty-state {
    padding: 32px 20px !important;
    text-align: center !important;
  }

  .empty-state h3 {
    font-size: 1.1rem !important;
  }

  .empty-state p {
    font-size: 0.85rem !important;
  }

  /* Launch polish: app-style cards and QR payment on mobile */
  body.yc-app-role .xp-dashboard .content {
    background: #f8fafc !important;
  }

  body.yc-app-role .xp-panel,
  body.yc-app-role .xp-stat,
  body.yc-app-role .xp-action,
  body.yc-app-role .xp-list-item {
    border-radius: 14px !important;
  }

  body.yc-app-role .xp-hero {
    border-radius: 16px !important;
    margin-bottom: 14px !important;
  }

  .payment-qr-page {
    margin: calc(var(--v5-topbar-h) + 14px) 12px calc(var(--v5-mobile-nav-h) + 18px) !important;
    max-width: none !important;
    padding: 0 !important;
  }

  .payment-mini-stats,
  .payment-qr-layout {
    grid-template-columns: 1fr !important;
  }

  .payment-qr-box {
    min-height: 260px !important;
  }

  /* =========================================================
     26. DASHBOARD - MINI CARDS
     ========================================================= */
  .dashboard-mini-grid {
    gap: 10px !important;
  }

  .dashboard-mini-stat {
    padding: 14px !important;
    min-height: auto !important;
  }

  .dashboard-mini-stat strong {
    font-size: 1.3rem !important;
  }

  .dashboard-mini-stat span {
    font-size: 0.78rem !important;
  }

  /* =========================================================
     27. PROFILE PAGE
     ========================================================= */
  .profile-card {
    padding: 16px !important;
  }

  .profile-avatar {
    width: 64px !important;
    height: 64px !important;
  }

  /* =========================================================
     28. NOTIFICATION ITEMS
     ========================================================= */
  .notification-item {
    padding: 14px !important;
    gap: 10px !important;
  }

  .notification-item h4 {
    font-size: 0.92rem !important;
  }

  .notification-item p {
    font-size: 0.82rem !important;
  }

  /* =========================================================
     29. STUDY MATERIAL
     ========================================================= */
  .material-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .material-card {
    padding: 14px !important;
  }

  /* =========================================================
     30. PROGRESS / CHARTS
     ========================================================= */
  .progress-bar-track {
    height: 8px !important;
    border-radius: 4px !important;
  }

  .chart-row {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
}

/* =========================================================
   SMALL MOBILE - 480px and below
   ========================================================= */
@media (max-width: 480px) {
  :root {
    --v5-touch-min: 42px;
  }

  .content {
    padding: 10px !important;
  }

  .page-head h1 {
    font-size: 1.25rem !important;
  }

  .section-heading h2 {
    font-size: 1.1rem !important;
  }

  .card, .stats-card, .table-card, .kpi {
    padding: 14px !important;
  }

  .btn {
    padding: 10px 14px !important;
    font-size: 0.85rem !important;
  }

  .bottom-nav a {
    padding: 4px 2px !important;
  }

  .bottom-nav a div:first-child {
    font-size: 1.05rem !important;
  }

  .bottom-nav a div:last-child {
    font-size: 0.58rem !important;
  }

  .mobile-topbar {
    padding: 0 8px !important;
  }

  .auth-showcase h2 {
    font-size: 1.15rem !important;
  }

  .auth-card-premium {
    padding: 16px !important;
  }
}

/* =========================================================
   TABLET - 769px to 1024px
   ========================================================= */
@media (min-width: 769px) and (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 260px 1fr !important;
    gap: 16px !important;
  }

  .sidebar {
    width: 260px !important;
    height: calc(100vh - 28px) !important;
    position: sticky !important;
    top: 14px !important;
    transform: none !important;
  }

  .card-grid, .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .feature-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .bottom-nav {
    display: none !important;
  }

  .mobile-topbar {
    display: none !important;
  }

  .main-layout {
    padding-top: 20px !important;
    padding-bottom: 20px !important;
  }
}

/* =========================================================
   LIGHT THEME - MOBILE ADJUSTMENTS
   ========================================================= */
@media (max-width: 768px) {
  body.theme-light .mobile-topbar {
    background: rgba(255, 255, 255, 0.94) !important;
    border-bottom-color: rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
  }

  body.theme-light .mobile-topbar .hamburger {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #101828 !important;
  }

  body.theme-light .mobile-topbar .mini-brand span {
    color: #101828 !important;
  }

  body.theme-light .bottom-nav {
    background: rgba(255, 255, 255, 0.96) !important;
    border-top-color: rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08) !important;
  }

  body.theme-light .bottom-nav a {
    color: rgba(16, 24, 40, 0.65) !important;
  }

  body.theme-light .bottom-nav a.is-active {
    color: #0b63ce !important;
    background: rgba(11, 99, 206, 0.08) !important;
  }

  body.theme-light .theme-toggle {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    color: #101828 !important;
  }
}

/* =========================================================
   EXAM UI - MOBILE ENHANCEMENTS
   ========================================================= */
@media (max-width: 768px) {
  /* Exam layout */
  .exam-layout, .attempt-layout {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  .attempt-sidebar {
    position: sticky !important;
    top: var(--v5-topbar-h) !important;
    z-index: 10 !important;
    max-height: none !important;
    order: -1 !important;
    padding: 12px !important;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .stat-card {
    padding: 10px !important;
    text-align: center !important;
  }

  .stat-card strong {
    font-size: 1.2rem !important;
  }

  .stat-card span {
    font-size: 0.7rem !important;
  }

  /* Question palette */
  .palette-grid, .question-palette {
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 6px !important;
  }

  .palette-btn, .palette-num {
    min-height: 38px !important;
    min-width: 38px !important;
    font-size: 0.82rem !important;
    border-radius: 8px !important;
  }

  /* Timer */
  .timer-display {
    font-size: 1.4rem !important;
    padding: 8px 12px !important;
  }

  /* Question card */
  .question-card, .question-body {
    padding: 14px !important;
  }

  .question-text {
    font-size: 0.92rem !important;
    line-height: 1.6 !important;
  }

  .option-list {
    gap: 8px !important;
  }

  .option-item {
    padding: 12px !important;
    min-height: var(--v5-touch-min) !important;
    border-radius: var(--v5-radius-sm) !important;
  }

  .option-label {
    min-width: 32px !important;
    min-height: 32px !important;
    font-size: 0.85rem !important;
  }

  .option-text {
    font-size: 0.88rem !important;
  }

  /* Question navigation buttons */
  .question-nav-actions {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .question-nav-actions .btn {
    width: 100% !important;
  }

  /* Sticky submit bar for exam */
  .exam-submit-bar {
    position: fixed !important;
    bottom: var(--v5-mobile-nav-h) !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 998 !important;
    padding: 10px 12px !important;
    backdrop-filter: blur(20px) !important;
    background: rgba(7, 11, 23, 0.92) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  }

  .exam-submit-bar .btn {
    width: 100% !important;
  }
}

/* =========================================================
   PRINT STYLES - PRESERVE FOR PAPER PRINTING
   ========================================================= */
@media print {
  .mobile-topbar,
  .bottom-nav,
  .sidebar,
  .theme-toggle,
  .mobile-overlay,
  .mobile-preview-toggle {
    display: none !important;
  }

  .main-layout {
    padding: 0 !important;
    margin: 0 !important;
  }
}
