/* 
    SOPPA PORTAL - RESPONSIVE DESIGN SYSTEM
    Optimized for: All Devices, iOS Safari, iPhone Notches
    Premium NeoTowers Style Mobile Menu
*/

/* ── Global Configurations ─────────────────────────────────────────── */
:root {
    --mobile-side-padding: 35px;
    --section-padding-mobile: 60px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

/* ── 992px and below (Tablets & Mobile - Hamburger Mode) ─────────────── */
@media (max-width: 991px) {
    :root {
        --section-padding-mobile: 80px;
    }

    .utility-bar {
        display: none !important;
    }

    nav,
    #main-nav {
        top: 0 !important;
        height: 68px !important;
        background: rgba(0, 35, 51, 0.94) !important;
        backdrop-filter: blur(16px) saturate(180%);
        -webkit-backdrop-filter: blur(16px) saturate(180%);
        padding: 0 calc(20px + var(--safe-right)) 0 calc(20px + var(--safe-left)) !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        z-index: 2000 !important;
    }

    #main-nav.scrolled {
        width: calc(100% - 24px) !important;
        max-width: none !important;
        left: 12px !important;
        transform: none !important;
        top: calc(10px + var(--safe-top)) !important;
        height: 60px !important;
        border-radius: 50px !important;
        background: rgba(0, 35, 51, 0.96) !important;
        border: 1px solid rgba(252, 211, 77, 0.45) !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }

    nav .logo-wordmark .logo-name {
        color: #ffffff;
        font-size: 20px;
    }

    nav .logo-wordmark .logo-tagline {
        display: none !important;
    }

    .nav-links,
    .nav-cta,
    .nav-login-btn {
        display: none !important;
    }

    .mobile-toggle {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        cursor: pointer;
        z-index: 2005 !important;
        padding: 8px;
        margin-right: -8px;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
        transition: all 0.3s ease;
    }

    .mobile-toggle:hover {
        background: rgba(255, 255, 255, 0.15);
    }

    .mobile-toggle span {
        display: block;
        width: 22px;
        height: 2.5px;
        background: #ffffff !important;
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    .hero {
        padding-top: calc(100px + var(--safe-top)) !important;
        min-height: auto;
        padding-bottom: 60px;
    }

    .hero h1 {
        font-size: 2.4rem;
    }

    h2 {
        font-size: 2.2rem !important;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
}

/* ── 480px - 767px (Smartphones) ─────────────────────────────────────── */
@media (max-width: 767px) {
    :root {
        --mobile-side-padding: 20px;
        --section-padding-mobile: 50px;
    }

    nav,
    #main-nav {
        height: 64px !important;
        padding: 0 calc(16px + var(--safe-right)) 0 calc(16px + var(--safe-left)) !important;
    }

    #main-nav.scrolled {
        height: 56px !important;
        top: calc(8px + var(--safe-top)) !important;
    }

    .logo-container img {
        height: 40px !important;
        width: 40px !important;
    }

    .logo-name {
        font-size: 18px !important;
    }

    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

    .hero p {
        font-size: 16px !important;
        margin-bottom: 30px !important;
    }

    h2 {
        font-size: 1.8rem !important;
        line-height: 1.3 !important;
    }

    h3 {
        font-size: 1.4rem !important;
    }

    section {
        padding: var(--section-padding-mobile) var(--mobile-side-padding) !important;
        padding-left: calc(var(--mobile-side-padding) + var(--safe-left)) !important;
        padding-right: calc(var(--mobile-side-padding) + var(--safe-right)) !important;
    }
}

/* ── 320px - 479px (Compact Smartphones / iPhone SE / Galaxy Fold) ───── */
@media (max-width: 479px) {
    :root {
        --mobile-side-padding: 15px;
    }

    nav,
    #main-nav {
        height: 58px !important;
        padding: 0 calc(12px + var(--safe-right)) 0 calc(12px + var(--safe-left)) !important;
    }

    #main-nav.scrolled {
        height: 52px !important;
        top: calc(6px + var(--safe-top)) !important;
        left: 8px !important;
        width: calc(100% - 16px) !important;
        padding: 0 12px !important;
    }

    .logo-container img {
        height: 36px !important;
        width: 36px !important;
        border-radius: 8px !important;
    }

    .logo-name {
        font-size: 16px !important;
    }

    .mobile-toggle {
        width: 38px !important;
        height: 38px !important;
        padding: 6px !important;
    }

    .mobile-toggle span {
        width: 18px !important;
        height: 2px !important;
    }
}

/* ── Tablet & Mobile Shared Stacking (<= 991px) ────────────────────── */
@media (max-width: 991px) {
    /* Hero & First Section Top Clearance for Fixed Mobile Header */
    body > section:first-of-type,
    main > section:first-of-type,
    .mobile-menu-overlay + section,
    .hero,
    .page-header,
    section[style*="padding: 150px"],
    section[style*="padding: 140px"],
    section[style*="padding: 130px"],
    section[style*="padding: 120px"] {
        padding-top: calc(115px + var(--safe-top)) !important;
    }

    /* Force all grids to stack */
    .grid,
    .leader-grid,
    .initiative-grid,
    .event-portal-grid,
    .leadership-editorial-grid,
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .leader-card {
        flex-direction: column !important;
        padding: 30px 20px !important;
        gap: 25px !important;
    }

    .leader-img {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 4/5;
    }

    .leader-info {
        text-align: center;
    }

    .event-item {
        flex-direction: column !important;
        align-items: center;
        text-align: center;
        padding: 30px 20px !important;
    }

    .event-date-box {
        margin: 0 auto 15px;
    }

    .container {
        padding: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* ── New Apollo Component Fixes ────────────────────────── */
    .editorial-card {
        padding: 20px !important;
        border-radius: 20px !important;
    }

    .editorial-img-wrapper {
        height: 300px !important;
    }

    /* Fix Dual Pillar Layout in Leadership */
    [style*="grid-template-columns: repeat(2, 1fr)"],
    [style*="grid-template-columns: 0.8fr 1.2fr"] {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }

    /* Fix Admissions Card in Index */
    [style*="padding: 100px 80px"] {
        padding: 40px 20px !important;
        border-radius: 24px !important;
    }

    /* Fix Stats Grid in Admissions */
    [style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding-top: 30px !important;
    }

    [style*="border-right: 1px solid"] {
        border-right: none !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        padding-bottom: 20px;
    }

    /* Advocacy Flex */
    [style*="display: flex; gap: 80px; align-items: center"] {
        flex-direction: column !important;
        gap: 40px !important;
    }

    /* Button Full Width on Mobile */
    .cta-button,
    .btn-soft {
        width: 100% !important;
        min-width: 100% !important;
        justify-content: center !important;
    }

    .hero {
        min-height: 45vh !important;
        text-align: center !important;
    }

    .hero .container {
        text-align: center !important;
    }

    .hero h1 {
        font-size: 2.2rem !important;
        margin-bottom: 20px !important;
    }

    .hero p {
        font-size: 1.1rem !important;
        margin: 0 auto !important;
    }

    .hero-content {
        padding: 0 20px !important;
    }

    .hero-label {
        font-size: 9px !important;
        padding: 6px 16px !important;
    }

    /* Admissions Module Fixes */
    [style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding-top: 30px !important;
    }

    [style*="border-right: 1px solid"] {
        border-right: none !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
        padding-bottom: 25px !important;
    }

    [style*="text-align: center; border-right: 1px solid"] {
        border-right: none !important;
    }

    /* General Typography Scaling */
    h2 {
        font-size: 1.8rem !important;
    }

    p {
        font-size: 1rem !important;
    }

    .site-footer {
        padding: 60px var(--mobile-side-padding) 30px !important;
        padding-left: calc(var(--mobile-side-padding) + var(--safe-left)) !important;
        padding-right: calc(var(--mobile-side-padding) + var(--safe-right)) !important;
    }

    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 40px;
    }

    .footer-bottom {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 16px !important;
        padding-bottom: calc(95px + var(--safe-bottom)) !important;
    }

    /* Newsletter CTA Mobile Stacking Fix */
    .footer-cta-flex {
        flex-direction: column !important;
        text-align: center !important;
        gap: 24px !important;
    }

    .footer-cta-text {
        text-align: center !important;
        width: 100% !important;
    }

    .footer-newsletter {
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 12px !important;
    }

    .footer-newsletter input {
        width: 100% !important;
        text-align: center !important;
        padding: 14px 20px !important;
    }

    .footer-newsletter button {
        width: 100% !important;
        padding: 14px 20px !important;
    }

    /* Footer Bottom Nav & WhatsApp Float Clearance Fix */
    .footer-bottom-nav {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 10px 18px !important;
        width: 100% !important;
        margin-top: 8px !important;
    }

    .footer-bottom-nav a {
        font-size: 11px !important;
        white-space: nowrap !important;
        display: inline-block !important;
    }
}

/* ── 480px (Small Phones) ──────────────────────────────────────────── */
@media (max-width: 480px) {
    :root {
        --mobile-side-padding: 20px;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.6rem !important;
    }

    .cta-button {
        width: 100%;
        text-align: center;
        padding: 12px 20px !important;
    }

    .mobile-menu-links a {
        font-size: 18px !important;
        gap: 15px;
    }
}

/* ── Mobile Menu Overlay (NeoTowers Style) ─────────────────────────── */
.mobile-menu-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: #FFFFFF !important;
    /* Premium White */
    z-index: 9999 !important;
    display: none !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    padding: 0 !important;
}

.mobile-menu-overlay.active {
    display: flex !important;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px var(--mobile-side-padding);
    padding-top: calc(20px + var(--safe-top));
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mobile-menu-header .logo-container img {
    height: 48px;
    width: 48px;
    border: none;
    box-shadow: none;
}

.mobile-menu-header .logo-name {
    color: var(--brand-navy) !important;
    font-size: 18px;
    font-weight: 600;
}

.mobile-menu-close {
    font-size: 32px;
    color: var(--brand-navy);
    cursor: pointer;
    line-height: 1;
}

.mobile-menu-body {
    padding: 40px var(--mobile-side-padding);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

.mobile-menu-links {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.mobile-menu-links a {
    color: var(--brand-navy) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 20px !important;
    font-weight: 500 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    text-decoration: none !important;
    opacity: 0.85;
    transition: 0.3s;
}

.mobile-menu-links a:hover {
    opacity: 1;
    color: var(--brand-blue) !important;
}

.mobile-menu-links .cta-button {
    background: var(--brand-red) !important;
    color: white !important;
    padding: 14px 30px;
    font-size: 14px !important;
    text-align: center;
    border-radius: 4px;
    margin-top: 10px;
    display: inline-block;
}

.mobile-menu-footer {
    margin-top: auto;
    padding-top: 40px;
    padding-bottom: calc(40px + var(--safe-bottom));
}

.mobile-menu-footer .separator {
    width: 100%;
    height: 1px;
    background: rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
}

.mobile-menu-footer .phone-link {
    color: var(--brand-navy) !important;
    font-size: 18px !important;
    font-weight: 400 !important;
    text-decoration: none !important;
    display: block;
    margin-bottom: 25px;
    opacity: 0.8;
}

.mobile-socials {
    display: flex;
    gap: 25px;
}

.mobile-socials a {
    color: var(--brand-navy) !important;
    font-size: 22px !important;
    opacity: 0.8;
    transition: 0.3s;
}

.mobile-socials a:hover {
    opacity: 1;
    color: var(--brand-blue) !important;
}

/* ── iOS Special Tweaks ────────────────────────────────────────────── */
@supports (-webkit-touch-callout: none) {
    .hero {
        background-attachment: scroll !important;
    }

    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ── Responsive Impact Cards & Universal Device Fixes ───────────── */
img, svg, video, iframe {
    max-width: 100%;
    height: auto;
}

html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
}

.table-wrapper, .table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

@media (max-width: 992px) {
    /* Emblem Showcase 2-col inline grid fix */
    [style*="grid-template-columns: 480px 1fr"],
    [style*="grid-template-columns: 400px 1fr"],
    [style*="grid-template-columns: 1fr 2fr"],
    [style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 40px !important;
    }

    [style*="width: 480px; height: 480px"],
    [style*="width: 450px; height: 450px"] {
        width: 300px !important;
        height: 300px !important;
        margin: 0 auto !important;
    }

    /* 4-col & 3-col grids adjust to 2-col on tablets */
    .grid[style*="repeat(4, 1fr)"],
    [style*="grid-template-columns: repeat(4, 1fr)"],
    .grid[style*="repeat(3, 1fr)"],
    [style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }

    .medical-floating-sidebar {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .impact-item {
        flex: 0 0 88vw !important;
        flex-direction: column !important;
        min-height: auto !important;
    }

    .impact-img-card {
        flex: 0 0 180px !important;
        width: 100% !important;
        height: 180px !important;
    }

    .impact-content-card {
        padding: 24px 20px !important;
    }

    .impact-content-card h4 {
        font-size: 18px !important;
    }

    /* Force all 2, 3, 4 column grids & inline grids to 1-col stack on mobile */
    div.grid,
    div.leader-grid,
    div.initiative-grid,
    div.event-portal-grid,
    div.leadership-editorial-grid,
    div[style*="grid-template-columns"],
    div[style*="repeat("],
    .grid[style*="repeat(4, 1fr)"],
    [style*="grid-template-columns: repeat(4, 1fr)"],
    .grid[style*="repeat(3, 1fr)"],
    [style*="grid-template-columns: repeat(3, 1fr)"],
    .grid[style*="repeat(2, 1fr)"],
    [style*="grid-template-columns: repeat(2, 1fr)"] {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Edu Card, Trigger Card & Action Button Stacking on Mobile */
    .trigger-card,
    .edu-card [style*="display: flex"],
    .edu-card div[style*="padding-top"],
    .editorial-card div[style*="display: flex"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        width: 100% !important;
        gap: 10px !important;
    }

    .trigger-card > div {
        width: 100% !important;
    }

    .edu-card button,
    .edu-card .cta-button,
    .edu-card .btn-soft,
    .trigger-card button,
    .trigger-card .btn-soft {
        width: 100% !important;
        min-width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
        white-space: normal !important;
    }

    /* Social Icons Protection (Prevents Icon Circles from Stretching into Wide Bars) */
    a[style*="border-radius: 50%"],
    a[style*="border-radius:50%"],
    a[style*="width: 36px"],
    a[style*="width: 40px"],
    .social-icon,
    .footer-social-link {
        width: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        height: 36px !important;
        border-radius: 50% !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 0 0 36px !important;
    }

    [style*="padding-top: 18px"][style*="display: flex"],
    .social-links {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 12px !important;
        width: auto !important;
    }

    /* Section Header Flex Stacking on Mobile */
    [style*="display: flex; justify-content: space-between; align-items: flex-end"],
    [style*="display: flex; justify-content: space-between; align-items: center"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 16px !important;
        margin-bottom: 30px !important;
    }

    [style*="display: flex; justify-content: space-between; align-items: flex-end"] > div,
    [style*="display: flex; justify-content: space-between; align-items: center"] > div {
        max-width: 100% !important;
        width: 100% !important;
    }

    [style*="display: flex; justify-content: space-between; align-items: flex-end"] .btn-soft,
    [style*="display: flex; justify-content: space-between; align-items: flex-end"] .cta-button,
    [style*="display: flex; justify-content: space-between; align-items: flex-end"] a {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
        margin-top: 4px !important;
    }

    /* Inline padding fixes for mobile cards & sections */
    [style*="padding: 60px 40px"],
    [style*="padding: 100px 0"],
    [style*="padding: 90px 0"],
    [style*="padding: 80px 0"] {
        padding: 40px 16px !important;
    }

    /* Hero button actions stacked on mobile */
    .hero-actions {
        flex-direction: column !important;
        gap: 15px !important;
        width: 100% !important;
    }

    .hero-actions a,
    .hero-actions button,
    .hero-actions .cta-button,
    .hero-actions .btn-ghost {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
    }

    /* Pinned Announcement Banner */
    [style*="display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap"] {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    /* Floating Action Buttons Stacking on Mobile */
    .whatsapp-float {
        bottom: 25px !important;
        right: 20px !important;
        width: 46px !important;
        height: 46px !important;
    }

    #scroll-to-top {
        bottom: 80px !important;
        right: 21px !important;
        width: 44px !important;
        height: 44px !important;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px !important;
    }

    h1, .hero-title {
        font-size: 1.75rem !important;
        line-height: 1.25 !important;
    }

    h2 {
        font-size: 1.45rem !important;
        line-height: 1.3 !important;
    }

    h3 {
        font-size: 1.25rem !important;
    }

    .glass-card, .initiative-card, .leader-card {
        padding: 20px 16px !important;
    }

    /* Modal & Lightbox Mobile Max Width */
    .lightbox-modal-content,
    .modal-content {
        width: 94% !important;
        max-width: 94% !important;
        padding: 20px 16px !important;
        margin: 10px auto !important;
    }

    /* Table Mobile Horizontal Scroll Wrapper */
    table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Full width inputs on mobile forms */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    select,
    textarea {
        width: 100% !important;
        box-sizing: border-box !important;
    }
}