/* ============================================================
   ELGA LMS — Responsive Mobile CSS
   Applies to all pages. Include after Tailwind CDN.
   ============================================================ */

/* ── HAMBURGER BUTTON ── */
.mob-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.mob-menu-btn:hover { background: rgba(255,255,255,0.22); }
.mob-menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  position: relative;
  transition: all 0.3s;
}
.mob-menu-btn span::before,
.mob-menu-btn span::after {
  content: '';
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  position: absolute;
  transition: all 0.3s;
}
.mob-menu-btn span::before { top: -6px; }
.mob-menu-btn span::after  { top:  6px; }

/* Open state */
.mob-menu-btn.open span { background: transparent; }
.mob-menu-btn.open span::before { top: 0; transform: rotate(45deg); }
.mob-menu-btn.open span::after  { top: 0; transform: rotate(-45deg); }

/* ── MOBILE DRAWER ── */
.mob-drawer {
  display: none;
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  background: #02642A;
  z-index: 100;
  padding: 8px 16px 16px;
  border-top: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  transform: translateY(-8px);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.mob-drawer.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.mob-drawer a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  transition: background 0.15s;
  margin-bottom: 2px;
}
.mob-drawer a:hover,
.mob-drawer a.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.mob-drawer a.logout-link {
  color: #fca5a5;
}
.mob-drawer .drawer-divider {
  height: 1px;
  background: rgba(255,255,255,0.12);
  margin: 8px 0;
}
.mob-drawer .drawer-user {
  padding: 10px 14px 6px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── BOTTOM NAV (alternative for mobile) ── */
/* We use the drawer approach instead */

/* ============================================================
   BREAKPOINT: max-width 768px
   ============================================================ */
@media (max-width: 768px) {

  /* Show hamburger, hide desktop nav links */
  .mob-menu-btn { display: flex !important; }
  .mob-drawer   { display: block !important; }

  /* Hide desktop nav links */
  .nav-desktop-links { display: none !important; }

  /* Topnav height adjustment */
  nav .flex.items-center.h-\[72px\] {
    height: 60px !important;
  }
  nav .flex.items-center.h-\\[72px\\] {
    height: 60px;
  }

  /* Drawer offset fix */
  .mob-drawer { top: 60px; }

  /* Logo smaller on mobile */
  nav .h-11 { height: 34px !important; }

  /* ── dashboard.php content ── */
  .max-w-7xl { padding-left: 1rem !important; padding-right: 1rem !important; }

  /* ── course.php sidebar ── */
  .course-sidebar {
    position: fixed !important;
    top: 60px;
    left: 0;
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.3s;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  }
  .course-sidebar.open { transform: translateX(0); }

  .course-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: 60px;
    background: rgba(0,0,0,0.4);
    z-index: 89;
  }
  .course-sidebar-overlay.open { display: block; }

  /* Course layout: remove flex row on mobile */
  .course-layout {
    flex-direction: column !important;
  }

  /* Sidebar toggle button */
  .sidebar-toggle-btn {
    display: inline-flex !important;
  }

  /* ── admin tables ── */
  .admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── result.php paper ── */
  .paper {
    padding: 0 !important;
  }
  .cert-body { padding: 12px 14px 20px !important; }
  .cert-header { padding: 12px 14px 10px !important; }
  .cert-title-jp { font-size: 14px !important; letter-spacing: 1px !important; }
  .profile-row { flex-direction: column !important; align-items: center !important; }
  .profile-photo { margin-bottom: 12px; }

  /* ── mycourses filter row ── */
  .filter-row {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .filter-row select,
  .filter-row input {
    flex: 1 1 calc(50% - 4px) !important;
    min-width: 0 !important;
  }
  .filter-row input[type="text"] {
    flex: 1 1 100% !important;
    order: -1;
  }

  /* ── exam.php ── */
  .exam-layout {
    flex-direction: column !important;
  }
  .exam-sidebar {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid #e5e7eb;
    max-height: 180px;
    overflow-y: auto;
  }

  /* action-bar (result.php) */
  .action-bar {
    flex-wrap: wrap;
    justify-content: center !important;
    gap: 8px !important;
    padding: 0 8px;
  }
  .btn-print, .btn-back {
    flex: 1;
    justify-content: center;
    min-width: 120px;
  }

  /* sub-nav kursus */
  .course-subnav {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  /* Breadcrumb truncate */
  .breadcrumb { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

  /* Typography scale down */
  h1.text-2xl { font-size: 1.25rem !important; }

  /* ── admin sub-sidebar ── */
  .admin-layout {
    flex-direction: column !important;
  }
  .admin-sub-sidebar {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid #e5e7eb;
    flex-direction: row !important;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
}

/* ── SIDEBAR TOGGLE BUTTON (hidden on desktop) ── */
.sidebar-toggle-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: #02642A;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
}
