/**
 * EgenAI Course Platform — Responsive CSS
 * Mobile-first breakpoints, hamburger menu, stacked layouts
 */

/* ================================================================
   TABLET (≤ 1024px)
   ================================================================ */
@media (max-width: 1024px) {
  /* Sidebar becomes overlay */
  .sidebar {
    transform: translateX(-100%);
    z-index: 900;
    width: 260px !important;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 800;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.show { display: block; }

  /* Grid adjustments */
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }

  /* Stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Auth split */
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-left { display: none; }
}

/* ================================================================
   MOBILE (≤ 768px)
   ================================================================ */
@media (max-width: 768px) {
  /* Hero */
  .hero { min-height: 70vh; padding: 50px 16px; }
  .hero-search-row { flex-direction: column; }
  .hero-stats { gap: 24px; }
  .hero-stat .stat-num { font-size: 1.6rem; }

  /* Navbar */
  .main-navbar { padding: 0 16px; }
  .navbar-nav-links { display: none; }

  /* Grids */
  .grid-4,
  .grid-3,
  .grid-2 { grid-template-columns: 1fr; }

  /* Auth */
  .auth-right { padding: 40px 24px; }
  .auth-box { max-width: 100%; }

  /* Topbar */
  .topbar { padding: 0 16px; }
  .topbar-breadcrumb { display: none; }

  /* Page content */
  .page-content { padding: 16px; }
  .page-header { flex-direction: column; align-items: flex-start; }

  /* Stats grid */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-value { font-size: 1.6rem; }

  /* Table toolbar stacked */
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .table-search { min-width: 100%; }
  .table-search input { width: 100%; }

  /* Filter sidebar hidden by default, shown as offcanvas */
  .filter-sidebar { position: fixed; top: 0; left: -320px; width: 300px; height: 100vh; z-index: 900; border-radius: 0; overflow-y: auto; transition: left .3s ease; }
  .filter-sidebar.open { left: 0; }

  /* Cards */
  .card-body { padding: 16px; }

  /* Category chips scroll */
  .category-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; }
  .category-chips::-webkit-scrollbar { display: none; }

  /* Buttons */
  .btn-xl { padding: 12px 24px; font-size: 0.95rem; }

  /* Hero search */
  .hero-search { padding: 18px; border-radius: 16px; }
  .hero-search-input { padding: 10px 14px; }

  /* Institution details tabs */
  .inst-detail-tabs .nav-link { padding: 8px 14px; font-size: 0.85rem; }
}

/* ================================================================
   SMALL MOBILE (≤ 480px)
   ================================================================ */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 18px 16px; }

  .hero h1 { font-size: 1.8rem; }
  .section-title { font-size: 1.4rem; }

  .main-navbar { height: 60px; }
  .navbar-brand { font-size: 1.1rem; }

  .topbar { height: 56px; }
  .sidebar-brand-icon { width: 34px; height: 34px; }

  .toast-container { bottom: 12px; right: 12px; left: 12px; }
  .toast-custom { min-width: auto; width: 100%; }

  .btn-lg { padding: 11px 22px; font-size: 0.9rem; }

  /* Pagination */
  .pagination-custom a,
  .pagination-custom span { width: 34px; height: 34px; font-size: 0.82rem; }
}

/* ================================================================
   PRINT
   ================================================================ */
@media print {
  .sidebar, .topbar, .main-navbar, .breadcrumbs,
  .btn, .toast-container, .filter-sidebar { display: none !important; }
  .main-content { margin-left: 0 !important; }
  body { background: #fff; }
  .card, .widget, .table-wrapper { box-shadow: none; border: 1px solid #ddd; }
}
