/* =========================================================
   TRYOUT UKOM KEPERAWATAN - RESPONSIVE STYLES
   100% Mobile Friendly & Full Question Visibility Guarantee
   ========================================================= */

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 999;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
}

/* Mobile Bottom Nav Bar (< 1024px) */
.mobile-bottom-nav {
  display: none;
}

/* Desktop & Laptop (>1024px) - 75% Scale Proportional Adaptive Layout */
@media (min-width: 1025px) {
  body {
    zoom: 0.75;
    -webkit-text-size-adjust: 100%;
    width: 100%;
    min-height: 100vh;
  }

  .menu-toggle {
    display: none !important;
  }
}

/* Tablet & Mobile Navigation (< 1024px) */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 290px;
    box-shadow: var(--shadow-lg);
  }

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

  .main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;
    background: #ffffff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    z-index: 950;
    align-items: center;
    justify-content: space-around;
    padding: 0 0.5rem;
  }

  body.cbt-mode .mobile-bottom-nav,
  body.login-mode .mobile-bottom-nav {
    display: none !important;
  }

  body.login-mode .content-viewport {
    padding-bottom: 0 !important;
  }

  .content-viewport {
    padding-bottom: 75px !important;
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    flex: 1;
    padding: 0.25rem 0;
    transition: all 0.2s ease;
  }

  .bottom-nav-item .bnav-icon {
    font-size: 1.3rem;
    margin-bottom: 2px;
    line-height: 1;
  }

  .bottom-nav-item.active,
  .bottom-nav-item:hover {
    color: var(--primary);
  }

  .bottom-nav-item.active .bnav-icon {
    transform: scale(1.15);
  }
}

/* =========================================================
   CBT ENGINE 100% MOBILE RESPONSIVE ADAPTATION (< 900px)
   Guarantees all vignettes, questions, & options are fully visible
   ========================================================= */
@media (max-width: 900px) {
  body.cbt-mode {
    overflow-y: auto !important;
    height: auto !important;
    position: relative !important;
  }

  .cbt-container {
    height: auto !important;
    min-height: 100vh !important;
    display: block !important;
    overflow: visible !important;
    background-color: #f8fafc !important;
  }

  /* CBT Top Bar Header on Mobile */
  .cbt-header {
    height: auto !important;
    padding: 0.625rem 0.875rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    background-color: #0f172a !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
  }

  .cbt-brand {
    font-size: 0.85rem !important;
    max-width: 50% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .cbt-timer {
    font-size: 0.9rem !important;
    padding: 0.25rem 0.625rem !important;
  }

  #cbt-top-submit-btn {
    font-size: 0.75rem !important;
    padding: 0.35rem 0.65rem !important;
  }

  /* CBT Main Body & Layout */
  .cbt-body {
    display: block !important;
    height: auto !important;
    flex: none !important;
    overflow: visible !important;
  }

  .cbt-main-content {
    display: block !important;
    padding: 0.75rem !important;
    height: auto !important;
    flex: none !important;
    overflow: visible !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* CBT Question Card on Mobile */
  .cbt-question-card {
    display: block !important;
    height: auto !important;
    padding: 1rem !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    margin-bottom: 1rem !important;
    overflow: visible !important;
    background: #ffffff !important;
  }

  .question-meta {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    padding-bottom: 0.75rem !important;
    margin-bottom: 0.875rem !important;
  }

  .question-number {
    font-size: 1rem !important;
  }

  /* Question Case & Vignette - Unclipped Scrolling */
  .question-case {
    font-size: 0.925rem !important;
    line-height: 1.6 !important;
    padding: 0.875rem !important;
    border-left-width: 4px !important;
    margin-bottom: 1rem !important;
    border-radius: 0 8px 8px 0 !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    background-color: #f1f5f9 !important;
  }

  .question-text {
    font-size: 0.975rem !important;
    line-height: 1.5 !important;
    margin-bottom: 1rem !important;
    color: #0f172a !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  /* Options List & Touch Targets */
  .options-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.625rem !important;
    margin-bottom: 1.25rem !important;
  }

  .option-item {
    padding: 0.875rem 1rem !important;
    border-radius: 10px !important;
    min-height: 48px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
  }

  .option-key {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.85rem !important;
    flex-shrink: 0 !important;
  }

  .option-label {
    font-size: 0.875rem !important;
    line-height: 1.5 !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    flex: 1 !important;
  }

  /* Sticky Footer Action Buttons on Mobile */
  .cbt-footer {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 99 !important;
    background: #ffffff !important;
    border-top: 2px solid #e2e8f0 !important;
    padding: 0.625rem 0.75rem !important;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08) !important;
    display: flex !important;
    gap: 0.375rem !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .cbt-footer .btn {
    flex: 1 !important;
    min-width: 0 !important;
    padding: 0.625rem 0.375rem !important;
    font-size: 0.775rem !important;
    text-align: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    white-space: nowrap !important;
  }

  /* CBT Sidebar (User Profile, Navigation Grid & Calculator) */
  .cbt-sidebar {
    width: 100% !important;
    height: auto !important;
    border-left: none !important;
    border-top: 2px solid #e2e8f0 !important;
    padding: 1rem !important;
    box-sizing: border-box !important;
    margin-top: 1rem !important;
    border-radius: 12px !important;
    background: #ffffff !important;
  }

  .palette-grid {
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)) !important;
    gap: 6px !important;
    max-height: 220px !important;
    overflow-y: auto !important;
    padding: 4px !important;
  }

  .palette-btn {
    height: 38px !important;
    font-size: 0.85rem !important;
  }
}

/* Mobile Screen Utilities (< 640px) */
@media (max-width: 640px) {
  .content-viewport {
    padding: 0.75rem !important;
  }

  .grid-stats {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  .card {
    padding: 1rem !important;
    border-radius: 12px !important;
  }

  .card-title {
    font-size: 1.1rem !important;
  }

  .table-responsive {
    -webkit-overflow-scrolling: touch !important;
  }
}

/* Print Media Styles for Official Reports */
@media print {
  .sidebar, .topbar, .no-print, .menu-toggle, #sidebar-menu-list {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
  .content-viewport {
    padding: 0 !important;
  }
  .printable-area {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  body {
    background: #fff !important;
    color: #000 !important;
  }
}
