/* ══════════════════════════════════════════════════════════
   PSG VISHNUGRANTHI — GLOBAL RESPONSIVE CSS
   Provides mobile-first responsive patterns across all pages.
   Include via <link> in every page head.
   ══════════════════════════════════════════════════════════ */

/* ── BASE RESETS ── */
img, video, svg { max-width: 100%; height: auto; }
input, select, textarea, button { font-size: 16px; /* prevents iOS zoom */ }

/* ── SIDEBAR OVERLAY (shared by admin, school, teacher dashboards) ── */
.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99;
  opacity: 0;
  transition: opacity .3s;
}
.sb-overlay.show {
  display: block;
  opacity: 1;
}

/* ── MOBILE HAMBURGER ENHANCEMENTS ── */
.sb-toggle {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ── INDEX.PHP — MOBILE NAV ── */
.mobile-nav-btn {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 998;
}
.mobile-nav-overlay.show { display: block; }

.mobile-nav-drawer {
  position: fixed;
  top: 0; right: 0;
  width: 280px;
  max-width: 85vw;
  height: 100vh;
  background: #1C2660;
  z-index: 999;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  box-shadow: -4px 0 32px rgba(0,0,0,.35);
}
.mobile-nav-drawer.open { transform: translateX(0); }

.mobile-nav-close {
  align-self: flex-end;
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 28px;
  cursor: pointer;
  padding: 4px 8px;
  margin-bottom: 16px;
}

.mobile-nav-drawer a {
  display: block;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  padding: 12px 8px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  transition: all .2s;
}
.mobile-nav-drawer a:hover { color: #fff; background: rgba(255,255,255,.06); }

.mobile-nav-drawer .nav-cta-mobile {
  display: inline-block;
  margin-top: 16px;
  background: #C9A84C;
  color: #1C2660;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

/* ── RESPONSIVE TABLE ── */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── FORM RESPONSIVENESS ── */
@media (max-width: 768px) {
  .fc, input[type="text"], input[type="email"], input[type="tel"],
  input[type="password"], input[type="date"], input[type="number"],
  select, textarea {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .btn {
    min-height: 44px; /* touch target */
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* ══════════════════════════════════════════
   INDEX.PHP — RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════════ */

/* ── Tablet: 768–991px ── */
@media (max-width: 991px) {
  .mobile-nav-btn { display: block; }
  nav:not(.sb-nav) { display: none !important; }

  .hdr-main { padding: 10px 16px !important; }
  .hdr-top  { padding: 5px 16px !important; font-size: 10px; }

  .hdr-logo-txt h1 { font-size: 16px; }
  .hdr-logo-imgs img { height: 42px; }
  .hdr-logo-txt p { font-size: 8px; letter-spacing: 1px; }
  .hdr-logo-txt { padding-left: 10px; }
  .logo-sep { height: 34px; }
}

/* ── Small Mobile: ≤ 540px ── */
@media (max-width: 540px) {
  .hdr-top {
    flex-direction: column;
    gap: 4px;
    padding: 4px 12px !important;
    text-align: center;
  }
  .hdr-top > span { font-size: 9px; }
  .hdr-main { padding: 8px 12px !important; gap: 10px !important; }
  .hdr-logo-imgs img { height: 36px; }
  .hdr-logo-txt h1 { font-size: 14px; }
  .hdr-logo-txt { border-left-width: 2px; padding-left: 8px; }
  .logo-sep { height: 28px; }

  /* Hero */
  .hero-content { padding: 40px 16px 80px !important; }
  .hero h2 { font-size: clamp(24px, 6vw, 34px) !important; }
  .hero p { font-size: 14px !important; }
  .hero-btns { flex-direction: column; gap: 10px; }
  .btn-hero-primary, .btn-hero-outline { width: 100%; text-align: center; justify-content: center; }

  /* About strip */
  .about-strip { grid-template-columns: 1fr !important; }
  .as-content { padding: 36px 20px !important; }
  .as-content h3 { font-size: 22px; }

  /* Sections */
  .section { padding: 40px 16px !important; }
  .sec-hdr h2 { font-size: 26px; }
  .sec-hdr p { font-size: 13px; }

  /* Steps */
  .steps { grid-template-columns: 1fr !important; gap: 14px; }

  /* CTA */
  .cta { padding: 40px 16px !important; }
  .cta h2 { font-size: 28px; }
  .cta p { font-size: 14px; }

  /* Footer */
  .footer-main { grid-template-columns: 1fr !important; padding: 28px 16px !important; }
  .footer-bar { flex-direction: column; text-align: center; gap: 8px; padding: 16px !important; }

  /* App download section */
  .app-inner { grid-template-columns: 1fr !important; }
  .app-section { padding: 40px 16px !important; }
}

/* ── Tiny: ≤ 380px ── */
@media (max-width: 380px) {
  .hdr-logo-imgs img { height: 30px; }
  .hdr-logo-txt h1 { font-size: 12px; }
  .hdr-logo-txt p { display: none; }
  .hero-content { padding: 30px 12px 60px !important; }
  .hero h2 { font-size: 22px !important; }
}

/* ══════════════════════════════════════════
   DASHBOARD PAGES — RESPONSIVE
   (admin, school, teacher sidebars)
   ══════════════════════════════════════════ */
@media (max-width: 900px) {
  /* Stat cards stack */
  .stats-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .stat-card { padding: 14px 16px !important; }
  .stat-val { font-size: 24px !important; }

  /* Cards */
  .card { padding: 16px 14px !important; border-radius: 10px; }
  .card-head { flex-direction: column; align-items: flex-start; gap: 10px; }

  /* Filter forms */
  .card form[style*="flex"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .card form .btn { width: 100%; justify-content: center; }
}

@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr !important; }
  .topbar-left h1 { font-size: 16px !important; }
  .topbar { padding: 10px 12px 10px 48px !important; }
  .page-body { padding: 14px 10px !important; }
}

/* ══════════════════════════════════════════
   STANDALONE PAGES — LOGIN, REGISTER, TEST
   ══════════════════════════════════════════ */
@media (max-width: 600px) {
  /* Login cards */
  .login-card, .brand-card, [class*="login"] .card {
    margin: 16px !important;
    padding: 24px 18px !important;
    width: calc(100% - 32px) !important;
    max-width: 100% !important;
  }

  /* Registration form */
  .form-card, .page-header {
    margin-left: 12px !important;
    margin-right: 12px !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  .page-header h1 { font-size: 22px !important; }
  .page-header p { font-size: 12px !important; }

  /* Test/screening page */
  .test-container, .screening-container, .wizard-container {
    padding: 16px !important;
    margin: 12px !important;
  }
}

/* ══════════════════════════════════════════
   PRINT STYLES
   ══════════════════════════════════════════ */
@media print {
  .sidebar, .sb-toggle, .sb-overlay,
  .mobile-nav-btn, .mobile-nav-drawer, .mobile-nav-overlay,
  .topbar, nav, .lang-toggle { display: none !important; }
  .main { margin-left: 0 !important; }
  .page-body { padding: 0 !important; }
  body { display: block !important; }
}
