/* =============================================
   Mobile-First Accessibility Overrides
   Loaded AFTER style.css / admin.css
   ============================================= */

/* ---------- Global a11y baseline ---------- */
:root { --tap: 44px; }

html { -webkit-text-size-adjust: 100%; }
body { text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: #0f2547; color: #fff; padding: 12px 18px;
  border-radius: 0 0 8px 0; font-weight: 700; z-index: 10000;
}
.skip-link:focus { left: 0; outline: 3px solid #f59e0b; }

/* Focus-visible ring everywhere */
a:focus-visible, button:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid #f59e0b !important;
  outline-offset: 2px;
  border-radius: 6px;
}

/* iOS: stop input zoom – inputs must be ≥16px */
input, select, textarea, button { font-size: 16px; }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Mobile-first: tap targets ---------- */
@media (max-width: 900px) {
  .btn-primary, .btn-outline, .btn-white, .btn-outline-white,
  .nav-links li a, .nav-links .btn-apply,
  .footer-links ul li a, .social-links a,
  .contact-link, .pwd-toggle, .logout-btn, .btn-login,
  .btn-sm-outline, .nav-item, .sidebar-toggle, .hamburger {
    min-height: var(--tap);
  }
  .hamburger { min-width: var(--tap); align-items: center; justify-content: center; }
  .social-links a { width: var(--tap); height: var(--tap); font-size: 1.05rem; }
  .btn-primary, .btn-outline, .btn-white, .btn-outline-white {
    padding: 14px 24px;
  }
}

/* ---------- Navbar / Drawer ---------- */
@media (max-width: 768px) {
  .nav-inner { height: 64px; padding: 0 16px; }
  .logo-circle { width: 40px; height: 40px; font-size: 0.8rem; }
  .nav-logo-img { height: 44px; max-width: 50px; }
  .footer-logo-img { height: 40px; }
  .logo-name { font-size: 0.92rem; }
  .logo-tagline { font-size: 0.68rem; }

  .nav-links {
    top: 64px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 16px;
    gap: 4px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
    display: flex !important;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-links li a, .nav-links .btn-apply {
    display: flex; align-items: center;
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
  }
  .hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .hamburger.active span:nth-child(2) { opacity: 0; }
  .hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Backdrop when drawer open */
  body.menu-open { overflow: hidden; }
  body.menu-open::after {
    content: ''; position: fixed; inset: 64px 0 0 0;
    background: rgba(15,37,71,0.5); z-index: 998;
  }
}

/* ---------- Hero ---------- */
@media (max-width: 768px) {
  .hero {
    min-height: auto;
    padding: 44px 0 36px 0;
    background-position: center;
  }
  .hero-overlay {
    background: linear-gradient(
      180deg,
      rgba(11, 31, 58, 0.94) 0%,
      rgba(11, 31, 58, 0.88) 55%,
      rgba(11, 31, 58, 0.82) 100%
    );
  }
  .hero-content {
    max-width: 100%;
  }
  .hero-badge {
    font-size: 0.76rem;
    padding: 6px 14px;
    margin-bottom: 16px;
  }
  .hero-title {
    font-size: clamp(1.85rem, 7.5vw, 2.4rem);
    margin-bottom: 16px;
  }
  .hero-sub {
    font-size: 0.96rem;
    line-height: 1.65;
    margin-bottom: 24px;
    color: rgba(255, 255, 255, 0.88);
  }
  .hero-actions {
    gap: 12px;
    margin-bottom: 0;
  }
  .hero-actions .hero-stagger {
    width: 100%;
  }
  .hero-actions .btn-primary,
  .hero-actions .btn-outline-white,
  .hero-actions .hero-stagger .btn-primary,
  .hero-actions .hero-stagger .btn-outline-white {
    width: 100%;
    justify-content: center;
  }
  .hero-stats-wrapper {
    margin-top: 36px;
    max-width: 100%;
  }
  .hero-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 12px;
    padding: 16px 14px;
  }
  .stat-divider { display: none; }
  .stat { padding: 0; text-align: center; }
  .stat-number { font-size: 1.15rem; }
  .stat-label { font-size: 0.70rem; }
}

/* ---------- Sections ---------- */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .section { padding: 48px 0; }
  .section-header.center { margin-bottom: 32px; }
  .section-title { font-size: clamp(1.5rem, 6vw, 1.9rem); }
  .section-desc { font-size: 0.95rem; }

  .welcome-grid { gap: 28px; }
  .welcome-images { height: auto; display: flex; justify-content: center; }
  .welcome-single-image { max-width: 330px; margin: 0 auto; }
  .welcome-single-image img { height: 395px; }
  .welcome-single-image .img-badge {
    display: flex;
    top: 14px;
    right: 14px;
    width: 76px;
    height: 76px;
    font-size: 0.62rem;
  }
  .welcome-single-image .img-badge i { font-size: 1.1rem; }
  .img-main, .img-secondary {
    position: static; width: 100%; height: 220px;
    border: none;
  }
  .welcome-features { grid-template-columns: 1fr; gap: 8px; }

  .why-card, .program-card, .mv-card, .req-card, .team-card, .facility-card {
    padding: 24px 20px;
  }
}

/* ---------- Sticky bottom CTA on small phones ---------- */
.mobile-cta-bar {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-top: 1px solid var(--border, #e2e8f0);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  z-index: 990;
  box-shadow: 0 -6px 20px rgba(0,0,0,0.08);
  gap: 10px;
}
.mobile-cta-bar a {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 13px 12px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.95rem;
  min-height: 48px;
}
.mobile-cta-bar .cta-call {
  background: #f1f5f9;
  color: #0f2547;
}
.mobile-cta-bar .cta-apply {
  background: #f59e0b;
  color: #0f2547;
}
@media (max-width: 768px) {
  .mobile-cta-bar { display: flex; }
  body { padding-bottom: 76px; }
  .footer-bottom { padding-bottom: calc(20px + 76px); }
}
@media (max-width: 768px) {
  /* hide on apply page where the form's own CTA is primary */
  body.page-apply .mobile-cta-bar { display: none; }
  body.page-apply { padding-bottom: 0; }
  body.page-apply .footer-bottom { padding-bottom: 20px; }
}

/* ---------- Forms ---------- */
@media (max-width: 768px) {
  .apply-form-wrapper { padding: 20px 16px; border-radius: 10px; }
  .form-step-header { gap: 12px; margin-bottom: 22px; padding-bottom: 18px; }
  .step-num-badge { width: 40px; height: 40px; font-size: 1rem; }
  .form-step-header h3 { font-size: 1.1rem; }
  .form-grid { gap: 14px; }
  .form-group input, .form-group select, .form-group textarea {
    padding: 14px 14px;
    border-radius: 10px;
  }
  .upload-group .upload-area { padding: 22px 14px; }
  .form-actions { display: flex; flex-direction: column-reverse; gap: 10px; }
  .form-actions .btn-primary, .form-actions .btn-outline { width: 100%; justify-content: center; }
}

/* ---------- Tables → cards on mobile ---------- */
@media (max-width: 640px) {
  .admission-table thead { display: none; }
  .admission-table, .admission-table tbody, .admission-table tr, .admission-table td {
    display: block; width: 100%;
  }
  .admission-table tr {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow, 0 4px 20px rgba(0,0,0,0.08));
    margin-bottom: 14px;
    padding: 8px 4px;
  }
  .admission-table td {
    padding: 10px 16px;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 0.92rem;
  }
  .admission-table td::before {
    content: attr(data-label);
    font-weight: 800;
    color: #0f2547;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
  }
}

/* ---------- Footer ---------- */
@media (max-width: 768px) {
  .footer-top { padding: 48px 0 32px; }
  .footer-grid { gap: 32px; }
  .footer-brand > p { font-size: 0.92rem; }
}

/* ---------- Topbar visible but compact on small tablets ---------- */
@media (max-width: 1024px) and (min-width: 769px) {
  .topbar .container { flex-wrap: wrap; gap: 6px 16px; }
}

/* ---------- ADMIN: mobile drawer + cards ---------- */
@media (max-width: 900px) {
  .sidebar-toggle { display: inline-flex !important; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
  .admin-sidebar {
    transform: translateX(-100%);
    width: 84vw; max-width: 300px;
    box-shadow: 8px 0 28px rgba(0,0,0,0.25);
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-header { padding: 0 16px; height: 60px; }
  .header-title h1 { font-size: 1rem; }
  .admin-content { padding: 16px; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 16px; gap: 12px; }
  .stat-num { font-size: 1.5rem; }

  /* backdrop for sidebar */
  body.admin-body.sidebar-open { overflow: hidden; }
  body.admin-body.sidebar-open::before {
    content: ''; position: fixed; inset: 0;
    background: rgba(15,37,71,0.55); z-index: 90;
  }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* Admin tables → stacked cards */
@media (max-width: 700px) {
  table.data-table, .applications-table table {
    border: 0;
  }
  table.data-table thead, .applications-table thead { display: none; }
  table.data-table tr, .applications-table tr {
    display: block;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin-bottom: 12px;
    padding: 6px 4px;
  }
  table.data-table td, .applications-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 0;
    font-size: 0.9rem;
  }
  table.data-table td::before, .applications-table td::before {
    content: attr(data-label);
    font-weight: 800;
    color: #0f2547;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
}

/* ---------- Hide accidental stray brace placeholders ---------- */
@media (max-width: 480px) {
  .error-num { font-size: 5rem; }
  .error-page { padding: 72px 0; }
  .login-card { padding: 32px 22px; }
}

@media (max-width: 768px) {
  .map-section { padding: 0 0 24px; }
  .map-card-wrapper { max-width: 100%; border-radius: 10px; }
  .map-header { padding: 10px 14px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .map-iframe-container { height: 160px; }
  .map-footer-meta {
    padding: 8px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-size: 0.74rem;
  }
}
