/* ============================================================
   Comprehensive Responsive CSS for School Website
   Covers: Mobile (≤576px), Tablet (576–991px), Desktop (992px+)
   ============================================================ */

/* ── CSS Custom Properties ── */
:root {
    --mobile-padding:  16px;
    --tablet-padding:  24px;
    --desktop-padding: 32px;
}

/* ── Global Box‑Sizing & Overflow ── */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

img, video, iframe, embed, object {
    max-width: 100%;
}

/* ── Container Padding ── */
.container {
    padding-left:  var(--mobile-padding);
    padding-right: var(--mobile-padding);
}

/* ============================================================
   NAVIGATION
   ============================================================ */
.navbar {
    padding: 0.5rem 0;
}

.navbar-brand {
    font-size: 1.2rem;
    font-weight: 600;
}

.navbar-nav .nav-link {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    text-align: center;
    min-height: 44px; /* touch target */
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar-toggler {
    padding: 0.3rem 0.6rem;
    font-size: 1rem;
    border: none;
    min-width: 44px;
    min-height: 44px;
}

/* ============================================================
   PAGE HEADER (banner at top of inner pages)
   ============================================================ */
.page-header {
    position: relative;
    z-index: 1;
    margin-top: 0;
    padding: 120px 0 60px !important;
    background-attachment: scroll !important; /* fixed causes iOS bugs */
    background-size: cover !important;
    background-position: center !important;
    overflow: hidden;
    min-height: 280px;
    display: flex;
    align-items: center;
}

.page-header h1 {
    font-size: clamp(1.6rem, 5vw, 3.5rem);
    line-height: 1.2;
    margin-bottom: 0.75rem;
    word-break: break-word;
}

.page-header p.lead {
    font-size: clamp(0.95rem, 2.5vw, 1.25rem);
    margin-bottom: 1rem;
}

/* ============================================================
   SECTION TITLES & PADDING
   ============================================================ */
.section-title {
    margin-bottom: 2rem;
    text-align: center;
}

.section-title h2 {
    font-size: clamp(1.4rem, 4vw, 2.5rem);
    line-height: 1.3;
}

.section-padding {
    padding: 48px 0;
}

/* ============================================================
   CARDS
   ============================================================ */
.card,
.mission-vision-card,
.contact-info-card,
.team-card {
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 1.25rem;
}

.card:hover,
.mission-vision-card:hover,
.contact-info-card:hover,
.team-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.card-body {
    padding: 1rem;
}

.card-title {
    font-size: 1.05rem;
    margin-bottom: 0.65rem;
}

.card-text {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ============================================================
   BUTTONS — minimum touch targets
   ============================================================ */
.btn {
    padding: 0.6rem 1.1rem;
    font-size: 0.9rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    min-height: 44px;
    white-space: nowrap;
}

/* On true mobile, make standalone (non-grouped) buttons full‑width */
@media (max-width: 575.98px) {
    .btn:not(.btn-sm):not(.btn-group .btn):not(.filter-btn):not(.navbar-toggler) {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

.btn-group .btn {
    width: auto;
    margin-bottom: 0;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control,
.form-select {
    font-size: 0.95rem;
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    min-height: 44px; /* touch target */
}

.form-label {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.form-group {
    margin-bottom: 1rem;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive {
    font-size: 0.85rem;
    border-radius: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table th,
.table td {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
}

/* ============================================================
   STATS / FEATURE CARDS
   ============================================================ */
.stats-card,
.feature-card {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1.5rem 1rem;
}

.stat-number,
.stats-number {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.stats-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color, #5bac59ff);
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-dialog {
    margin: 0.5rem auto;
    max-width: calc(100% - 1rem);
}

.modal-content  { border-radius: 10px; }
.modal-header,
.modal-body,
.modal-footer   { padding: 1rem 1.25rem; }

/* ============================================================
   HERO SECTION (Home)
   ============================================================ */
.hero-section {
    min-height: 56vh;
    display: flex;
    align-items: center;
    text-align: center;
    padding: 80px 0 60px;
    background-attachment: scroll !important;
}

.hero-content h1 {
    font-size: clamp(1.6rem, 5vw, 3.5rem);
    line-height: 1.2;
    margin-bottom: 1rem;
}

.hero-content p,
.hero-section p {
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    margin-bottom: 1.5rem;
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

/* ============================================================
   GALLERY
   ============================================================ */
.masonry-gallery {
    column-count: 1;
    column-gap: 0.75rem;
    padding: 0.5rem;
}

.gallery-item {
    break-inside: avoid;
    margin-bottom: 0.75rem;
    border-radius: 10px;
    overflow: hidden;
}

.gallery-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1.1rem;
    font-size: 0.875rem;
    border-radius: 50px;
    min-height: 38px;
    white-space: nowrap;
}

/* ============================================================
   NEWS & EVENTS CARDS
   ============================================================ */
.news-card,
.event-card {
    margin-bottom: 1.5rem;
}

.news-card img,
.event-card img,
.news-image,
.event-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* ============================================================
   ADMISSIONS / CONTACT FORMS
   ============================================================ */
.application-form,
.contact-form {
    padding: 1.25rem 1rem;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
    padding: 2.5rem 0 1rem;
}

footer h5,
footer h6 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

footer p,
footer li,
footer a {
    font-size: 0.875rem;
    line-height: 1.5;
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

/* ============================================================
   ALERTS & BREADCRUMBS
   ============================================================ */
.alert {
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
}

.breadcrumb { font-size: 0.8rem; padding: 0.5rem 0; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    justify-content: center;
    flex-wrap: wrap;
}

.pagination .page-link {
    padding: 0.45rem 0.7rem;
    font-size: 0.875rem;
    min-height: 38px;
    min-width: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   VIDEO LIGHTBOX — mobile‑safe sizing
   ============================================================ */
.video-lightbox-container {
    width: 92vw !important;
    max-width: 900px;
}

/* ============================================================
   TEAM & ACADEMIC IMAGES
   ============================================================ */
.team-card img,
.academic-program img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* ============================================================
   CONTACT INFO CARD — center on mobile
   ============================================================ */
.contact-info-card {
    text-align: center;
    padding: 1.5rem 1rem;
    margin-bottom: 1.25rem;
}

/* ============================================================
   SEARCH / FILTER TABS
   ============================================================ */
.search-box  { margin-bottom: 1rem; }

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-tab {
    padding: 0.45rem 0.9rem;
    font-size: 0.875rem;
    min-height: 38px;
}

/* ============================================================
   ADMIN PANEL
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

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

    .main-content  { margin-left: 0; }
    .content-wrapper { padding: 0 12px 28px; }
    .top-navbar    { padding: 12px; }
    .stats-card    { margin-bottom: 1rem; }
    .table-responsive { font-size: 0.75rem; }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.d-mobile-none  { display: none; }
.d-mobile-block { display: block; }

.text-mobile-center { text-align: center; }

.w-mobile-100 { width: 100%; }

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.loading-spinner {
    width: 32px;
    height: 32px;
}

/* ============================================================
   >> SMALL (≥576px)
   ============================================================ */
@media (min-width: 576px) {
    .container {
        padding-left:  var(--tablet-padding);
        padding-right: var(--tablet-padding);
    }

    .masonry-gallery {
        column-count: 2;
        column-gap: 1rem;
        padding: 0.75rem;
    }

    .news-card img,
    .event-card img,
    .news-image,
    .event-image {
        height: 220px;
    }

    .application-form,
    .contact-form {
        padding: 1.75rem 1.5rem;
    }

    .hero-section {
        min-height: 60vh;
    }

    .section-padding {
        padding: 56px 0;
    }

    .contact-info-card {
        padding: 2rem 1.5rem;
    }
}

/* ============================================================
   >> MEDIUM (≥768px) — tablets landscape / small laptops
   ============================================================ */
@media (min-width: 768px) {
    .container {
        padding-left:  var(--desktop-padding);
        padding-right: var(--desktop-padding);
    }

    /* Nav links left‑aligned again */
    .navbar-nav .nav-link {
        text-align: left;
        justify-content: flex-start;
    }

    .page-header {
        padding: 130px 0 80px !important;
    }

    .section-padding {
        padding: 64px 0;
    }

    .card-body  { padding: 1.5rem; }
    .card-title { font-size: 1.2rem; }
    .card-text  { font-size: 0.95rem; }

    .hero-section {
        min-height: 70vh;
        padding: 100px 0 60px;
    }

    /* buttons no longer forced full‑width */
    .btn:not(.btn-sm):not(.btn-group .btn):not(.filter-btn):not(.navbar-toggler) {
        width: auto;
        margin-bottom: 0;
    }

    .masonry-gallery {
        column-count: 3;
        column-gap: 1rem;
        padding: 1rem;
    }

    .news-card img,
    .event-card img,
    .news-image,
    .event-image {
        height: 240px;
    }

    .team-card img,
    .academic-program img {
        height: 250px;
    }

    .application-form,
    .contact-form {
        padding: 2.5rem 2rem;
    }

    .contact-info-card {
        text-align: left;
        padding: 2.5rem 2rem;
    }

    .social-links {
        justify-content: flex-start;
    }

    .stats-card,
    .feature-card {
        text-align: left;
    }

    footer {
        text-align: left;
    }

    footer .row.align-items-center {
        text-align: left;
    }

    .d-mobile-none  { display: block; }
    .d-mobile-block { display: none; }

    .text-mobile-center { text-align: left; }

    .w-mobile-100 { width: auto; }
}

/* ============================================================
   >> LARGE (≥992px)
   ============================================================ */
@media (min-width: 992px) {
    .page-header {
        padding: 140px 0 90px !important;
    }

    .section-padding {
        padding: 80px 0;
    }

    .card-body  { padding: 2rem; }
    .card-title { font-size: 1.3rem; }
    .card-text  { font-size: 1rem; }

    .hero-section {
        min-height: 80vh;
    }

    .masonry-gallery {
        column-count: 4;
        column-gap: 1.25rem;
        padding: 1rem;
    }

    .news-card img,
    .event-card img,
    .news-image,
    .event-image {
        height: 260px;
    }

    .application-form,
    .contact-form {
        padding: 3rem 2.5rem;
    }

    .feature-icon { font-size: 3rem; }
}

/* ============================================================
   >> EXTRA LARGE (≥1200px)
   ============================================================ */
@media (min-width: 1200px) {
    .section-padding { padding: 96px 0; }

    .masonry-gallery {
        column-count: 4;
        column-gap: 1.5rem;
    }

    .news-card img,
    .event-card img,
    .news-image,
    .event-image {
        height: 280px;
    }

    .application-form,
    .contact-form {
        padding: 3.5rem 3rem;
    }

    .feature-icon { font-size: 3.5rem; }
}

/* ============================================================
   >> XXL (≥1400px)
   ============================================================ */
@media (min-width: 1400px) {
    .masonry-gallery {
        column-count: 5;
    }

    .news-card img,
    .event-card img,
    .news-image,
    .event-image {
        height: 300px;
    }
}

/* ============================================================
   LANDSCAPE MOBILE
   ============================================================ */
@media (max-width: 767.98px) and (orientation: landscape) {
    .hero-section {
        min-height: 100vh;
        padding: 70px 0 40px;
    }

    .page-header {
        padding: 80px 0 40px !important;
    }

    .section-padding {
        padding: 32px 0;
    }
}

/* ============================================================
   HIGH‑DPI — disable fixed attachment on retina devices
   ============================================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .page-header,
    .hero-section {
        background-attachment: scroll !important;
    }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration:       0.01ms !important;
        animation-iteration-count: 1     !important;
        transition-duration:      0.01ms !important;
        scroll-behavior:          auto   !important;
    }

    .card:hover,
    .mission-vision-card:hover,
    .contact-info-card:hover,
    .team-card:hover {
        transform: none;
    }
}

/* ============================================================
   FOCUS (ACCESSIBILITY)
   ============================================================ */
.btn:focus-visible,
.form-control:focus-visible,
.nav-link:focus-visible,
.navbar-toggler:focus-visible {
    outline: 3px solid var(--primary-color, #5bac59ff);
    outline-offset: 2px;
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
    .navbar,
    footer,
    .btn,
    .sidebar,
    .top-navbar,
    .page-header {
        display: none !important;
    }

    .main-content { margin-left: 0 !important; }

    .container {
        max-width: 100% !important;
        padding: 0 !important;
    }

    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
        break-inside: avoid;
    }

    .section-padding {
        padding: 16px 0 !important;
    }

    .masonry-gallery {
        column-count: 2 !important;
    }
}

/* ============================================================
   PAGE‑SPECIFIC FIXES
   ============================================================ */

/* Index — hero buttons stack on very small screens */
@media (max-width: 575.98px) {
    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-buttons .btn {
        width: 100%;
        text-align: center;
    }

    .cta-section .btn {
        width: 100%;
        margin: 0.35rem 0;
    }
}

/* Contact — full‑width submit button on mobile */
@media (max-width: 575.98px) {
    .btn-submit {
        width: 100%;
        padding: 0.9rem 1rem;
    }

    .quick-contact-btn {
        width: 100%;
        margin: 0.35rem 0;
    }
}

/* Gallery — hide overlay text on very small to improve touch */
@media (max-width: 575.98px) {
    .gallery-overlay {
        padding: 0.5rem;
    }

    .gallery-title {
        font-size: 0.9rem;
    }

    .gallery-description {
        display: none;
    }

    .play-icon {
        font-size: 2rem;
        width: 54px;
        height: 54px;
    }
}

/* Admissions — process steps always centered on mobile */
@media (max-width: 767.98px) {
    .process-step {
        padding: 1.75rem 1.25rem;
        margin-bottom: 1rem;
    }

    .step-number {
        width: 52px;
        height: 52px;
        font-size: 1.25rem;
    }
}

/* Admissions / Contact — map always full width */
.map-container iframe {
    width: 100%;
    display: block;
}

@media (max-width: 575.98px) {
    .map-container iframe {
        height: 280px;
    }

    .office-hours,
    .quick-contact {
        padding: 1.25rem 1rem;
    }
}

/* Accordion — make touch-friendly */
.accordion-button {
    min-height: 48px;
    font-size: 0.95rem;
}

/* Table overflow guard on admissions */
.tuition-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Requirement items wrap gracefully */
.requirement-item {
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Hours item — stacks on very narrow screens */
@media (max-width: 360px) {
    .hours-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }
}

/* ============================================================
   FOOTER MOBILE FIXES
   ============================================================ */
@media (max-width: 767.98px) {
    footer .row.align-items-center {
        text-align: center;
    }

    footer .col-md-6.text-md-end {
        text-align: center !important;
        margin-top: 0.75rem;
    }

    .social-links {
        justify-content: center;
    }
}

/* ============================================================
   NAVBAR MOBILE FIXES (supplement header.php inline styles)
   ============================================================ */
@media (max-width: 991.98px) {
    .navbar-brand {
        max-width: calc(100vw - 80px); /* prevent overlap with toggler */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 575.98px) {
    .navbar-brand {
        font-size: 1rem;
    }
}