/* reCAPTCHA v2 injects a hidden challenge wrapper (parked at top:-10000px
   with visibility:hidden) containing position:fixed full-screen divs at
   z-index 2000000000. The fixed children re-attach to the viewport and keep
   pointer-events:auto, which silently intercepts every click on the page and
   makes all buttons appear unresponsive. Disable pointer-events on the hidden
   wrapper and its descendants; reCAPTCHA re-enables them when it shows the
   real challenge (which removes top:-10000px). */
body > div[style*="visibility: hidden"][style*="top: -10000px"],
body > div[style*="visibility: hidden"][style*="top: -10000px"] * {
    pointer-events: none !important;
}

/* Modern Login Page Styles */
.login-main-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
}
.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(44,122,123,0.13);
    padding: 48px 38px 32px 38px;
    max-width: 410px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.login-title {
    font-size: 2rem;
    color: var(--primary-dark);
    margin-bottom: 6px;
    font-weight: 700;
}
.login-subtitle {
    color: var(--text-gray);
    font-size: 1rem;
    margin-bottom: 22px;
}
.login-error {
    border-left: 4px solid #e53e3e;
    background: #fff5f5;
    color: #c53030;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 0.95rem;
    width: 100%;
}
.login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-group label {
    font-size: 0.97rem;
    color: var(--text-dark);
    font-weight: 500;
}
.form-group input {
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid #cbd5e1;
    font-size: 1rem;
    background: #f9fafb;
    transition: border 0.2s;
}
.form-group input:focus {
    outline: none;
    border: 1.5px solid var(--primary);
}
.login-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
    font-size: 0.95rem;
}
.remember-me-label {
    display: flex;
    align-items: center;
    gap: 6px;
}
.forgot-link {
    color: var(--secondary);
    text-decoration: underline;
    font-size: 0.93rem;
}
.login-demo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 0 0;
    font-size: 0.97rem;
}
.demo-dropdown {
    padding: 7px 12px;
    border-radius: var(--radius);
    border: 1px solid #cbd5e1;
    background: #f9fafb;
    font-size: 1rem;
}
.login-btn {
    width: 100%;
    margin-top: 18px;
    background: #38a169;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 13px 0;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(56,161,105,0.08);
    transition: background 0.2s;
}
.login-btn:hover {
    background: #2f855a;
}
.demo-login-section {
    width: 100%;
    margin: 28px 0 0 0;
    text-align: center;
}
.demo-login-label {
    color: var(--text-gray);
    font-size: 0.97rem;
    margin-bottom: 10px;
}
.demo-login-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 0;
}
.demo-btn {
    min-width: 90px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 7px;
    border: none;
    color: #fff;
    transition: background 0.2s;
}
.demo-student {
    background: #4299e1;
}
.demo-student:hover {
    background: #2b6cb0;
}
.demo-teacher {
    background: #ed8936;
}
.demo-teacher:hover {
    background: #c05621;
}
.demo-admin {
    background: #805ad5;
}
.demo-admin:hover {
    background: #553c9a;
}
.demo-icon {
    font-size: 1.2em;
}
.auth-switch {
    margin-top: 28px;
    color: var(--text-gray);
    font-size: 0.97rem;
    text-align: center;
}
.signup-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}
@media (max-width: 600px) {
    .login-card {
        padding: 28px 8px 18px 8px;
        max-width: 98vw;
    }
}
/* Event Details Modal Split-Panel */
.event-detail-modal-split .event-detail-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 0;
    min-height: 320px;
}
.event-detail-modal-split .event-detail-left {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 16px 0 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    min-width: 220px;
}
.event-detail-modal-split .event-detail-right {
    padding: 32px 28px 24px 28px;
    background: #fff;
    border-radius: 0 16px 16px 0;
    min-width: 260px;
}
@media (max-width: 700px) {
    .event-detail-modal-split .event-detail-grid {
        grid-template-columns: 1fr;
    }
    .event-detail-modal-split .event-detail-left {
        border-radius: 16px 16px 0 0;
        min-height: 120px;
        min-width: 0;
    }
    .event-detail-modal-split .event-detail-right {
        border-radius: 0 0 16px 16px;
        padding: 22px 12px 18px 12px;
        min-width: 0;
    }
}
:root {
    --primary: #2c7a7b;
    --primary-dark: #234e52;
    --secondary: #2b6cb0;
    --accent: #d69e2e;
    --bg-light: #f7fafc;
    --text-dark: #1a202c;
    --text-gray: #4a5568;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 8px;
    --font-main: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-padding-top: 80px; }
body {
    font-family: var(--font-main);
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }
button { cursor: pointer; border: none; font-family: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Skip-to-content link (accessibility) */
.skip-to-content {
    position: absolute;
    top: -100%;
    left: 16px;
    background: var(--primary);
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 9999;
    transition: top 0.2s;
}
.skip-to-content:focus {
    top: 10px;
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.section-padding { padding: 60px 0; }
.page-padding { padding: clamp(24px, 4vw, 40px) 0; }
.page-max-600 { max-width: 600px; margin-left: auto; margin-right: auto; }
.page-max-400 { max-width: 420px; margin-left: auto; margin-right: auto; }
.width-100-percent { width: 100%; display: block; }
.text-right { text-align: right; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

/* ── Announcement cards (used in dashboards and standalone page) ── */
.ann-post-box { background: #fff; border-radius: 14px; padding: 24px 28px; box-shadow: 0 2px 12px rgba(0,0,0,0.07); margin-bottom: 28px; }
.ann-post-box h3, .ann-post-box h4 { margin: 0 0 12px; }
.ann-card { background: #fff; border-radius: 14px; padding: 22px 28px; box-shadow: 0 2px 12px rgba(0,0,0,0.07); margin-bottom: 18px; border-left: 5px solid var(--primary); transition: box-shadow 0.2s; }
.ann-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.12); }
.ann-card.class-ann { border-left-color: #38a169; }
.ann-card-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }
.ann-card-meta { font-size: 0.8rem; color: var(--text-gray); margin-bottom: 12px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.ann-card-body { font-size: 0.95rem; line-height: 1.65; color: #374151; white-space: pre-wrap; }
.ann-badge { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 0.74rem; font-weight: 600; }
.ann-badge.everyone { background: #dbeafe; color: #1e40af; }
.ann-badge.class { background: #d1fae5; color: #065f46; }
.ann-empty { text-align: center; padding: 60px 20px; }
.ann-empty .icon { font-size: 3.5rem; margin-bottom: 16px; }
.ann-empty h3 { font-size: 1.2rem; margin-bottom: 8px; }
.ann-empty p { color: var(--text-gray); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 clamp(14px, 2.5vw, 24px); width: 100%; }
.row .container { display: flex; flex-wrap: wrap; padding: 0 20px; }
.col-lg-12 { width: 100%; }
.nopadding { padding: 0 !important; }

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary { background-color: var(--primary); color: var(--white); }
.btn-primary:hover { background-color: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background-color: var(--secondary); color: var(--white); }
.btn-secondary:hover { background-color: #1a4971; }
.btn-outline { border: 2px solid var(--primary); color: var(--primary); background: transparent; }
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-link { background: none; color: var(--secondary); padding: 0; text-decoration: underline; font-size: 0.9rem; }
.btn-sm { font-size: 0.8rem; padding: 6px 12px; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; transition: box-shadow 0.2s, transform 0.2s; }
.card:hover { box-shadow: 0 8px 16px -4px rgba(0,0,0,0.1), 0 4px 8px -2px rgba(0,0,0,0.06); }

header { background: var(--white); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }
.nav-container { display: flex; justify-content: space-between; align-items: center; height: 70px; padding: 0; gap: 0; flex-wrap: nowrap; overflow: visible; }
.logo-area { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-text { min-width: 0; }
.logo-text h1 { font-size: 1.05rem; color: var(--primary); line-height: 1.15; white-space: nowrap; font-weight: 700; }
.logo-img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); flex-shrink: 0; }
.logo-text span { font-size: 0.8rem; color: var(--text-gray); display: block; white-space: nowrap; }
.nav-links { display: flex; gap: 20px; align-items: center; flex-wrap: nowrap; flex-shrink: 1; min-width: 0; overflow: visible; }
.nav-links > a, .nav-links > .btn { white-space: nowrap; }
.nav-links a { font-weight: 500; color: var(--text-gray); font-size: 0.95rem; white-space: nowrap; }
.nav-links a:hover { color: var(--primary); }

/* Dropdown nav */
.nav-dropdown { position: relative; display: flex; align-items: center; }
.nav-dropdown-toggle {
    background: none; border: none; cursor: pointer;
    font-weight: 500; color: var(--text-gray); font-size: 0.95rem;
    padding: 0; display: flex; align-items: center; gap: 0;
    font-family: inherit;
    transition: color 0.2s;
    white-space: nowrap;
}
.nav-dropdown-toggle:hover,
.nav-dropdown:hover .nav-dropdown-toggle,
.nav-dropdown.open .nav-dropdown-toggle { color: var(--primary); }
.nav-dropdown-menu {
    display: flex;
    flex-direction: column;
    position: absolute; top: calc(100% + 8px); left: 0;
    transform: translateY(-6px);
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 160px;
    overflow: hidden;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.nav-dropdown-menu::before {
    content: '';
    position: absolute; top: -6px; left: 18px;
    border-width: 0 6px 6px; border-style: solid;
    border-color: transparent transparent var(--white);
}
.nav-dropdown-menu a {
    display: block; padding: 11px 20px;
    color: var(--text-gray); font-size: 0.9rem;
    white-space: nowrap; border-bottom: 1px solid #f0f0f0;
}
.nav-dropdown-menu a:last-child { border-bottom: none; }
.nav-dropdown-menu a:hover { background: var(--bg-light); color: var(--primary); }

/* Language switcher */
.lang-menu { min-width: 140px; left: auto; right: 0; }
.lang-btn {
    display: block; width: 100%; padding: 10px 20px;
    background: none; border: none; border-bottom: 1px solid #f0f0f0;
    color: var(--text-gray); font-size: 0.9rem; text-align: left;
    cursor: pointer; font-family: inherit; white-space: nowrap;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.lang-btn:last-child { border-bottom: none; }
.lang-btn:hover { background: var(--bg-light); color: var(--primary); }
.lang-btn.lang-active { color: var(--primary); font-weight: 600; background: #f0faf5; }
.lang-toggle { font-size: 0.85rem; gap: 4px; }
.lang-menu-hint { display:block; padding:6px 14px 4px; font-size:0.72rem; color:var(--text-gray); font-weight:600; text-transform:uppercase; letter-spacing:0.5px; border-bottom:1px solid #edf2f7; margin-bottom:4px; }

/* Spanish/French labels are longer — slightly tighter gap */
html[lang="es"] .nav-links { gap: 12px; }
html[lang="es"] .nav-dropdown-toggle { font-size: 0.88rem; }
html[lang="fr"] .nav-links { gap: 14px; }
html[lang="fr"] .nav-dropdown-toggle { font-size: 0.9rem; }

/* At narrow desktop widths (e.g. 1024px tablets in landscape) the longer
   Spanish / French nav labels overflow the brand row. Collapse to the
   hamburger menu earlier for those languages. */
@media (max-width: 1080px) {
    html[lang="es"] #nav-toggle,
    html[lang="fr"] #nav-toggle { display: inline-block !important; flex-shrink: 0; margin-left: auto; }
    html[lang="es"] .nav-links:not(.nav-open),
    html[lang="fr"] .nav-links:not(.nav-open) { display: none !important; }
    html[lang="es"] .nav-links.nav-open,
    html[lang="fr"] .nav-links.nav-open {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        position: fixed; top: 70px; left: 0; right: 0;
        background: var(--white);
        box-shadow: 0 6px 18px rgba(0,0,0,0.1);
        padding: 12px 20px 24px;
        gap: 4px;
        z-index: 1000;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }
    html[lang="es"] .nav-links.nav-open > a,
    html[lang="fr"] .nav-links.nav-open > a {
        display: block; width: 100%;
        padding: 10px 4px; font-size: 0.95rem; font-weight: 600;
        text-align: left; border-bottom: 1px solid #edf2f7; color: var(--text-dark);
    }
    html[lang="es"] .nav-links.nav-open .nav-dropdown,
    html[lang="fr"] .nav-links.nav-open .nav-dropdown {
        flex-direction: column; width: 100%; align-items: stretch;
        border-bottom: 1px solid #edf2f7;
    }
    html[lang="es"] .nav-links.nav-open .nav-dropdown-toggle,
    html[lang="fr"] .nav-links.nav-open .nav-dropdown-toggle {
        width: 100%; justify-content: space-between;
        padding: 10px 4px; font-size: 0.95rem;
        font-weight: 600; color: var(--text-dark);
    }
    html[lang="es"] .nav-links.nav-open .nav-dropdown-menu,
    html[lang="fr"] .nav-links.nav-open .nav-dropdown-menu {
        position: static; transform: none !important;
        opacity: 1; pointer-events: auto;
        box-shadow: none; border-radius: 0;
        background: var(--bg-light);
        min-width: 100%; left: auto;
        display: none;
        padding: 4px 0 4px 14px;
    }
    html[lang="es"] .nav-links.nav-open .nav-dropdown.open .nav-dropdown-menu,
    html[lang="fr"] .nav-links.nav-open .nav-dropdown.open .nav-dropdown-menu { display: flex; flex-direction: column; }
    html[lang="es"] .nav-links.nav-open .btn,
    html[lang="fr"] .nav-links.nav-open .btn {
        width: 100%; text-align: center; margin-top: 4px;
    }
}

.nav-arrow { font-size: 0.7em; margin-left: 2px; vertical-align: middle; line-height: 1; }

#nav-portal-btn { font-size: 0.9rem; padding: 7px 16px; white-space: nowrap; }

/* Notification bell */
.nav-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    line-height: 1;
    text-decoration: none;
    padding: 4px 6px;
    border-radius: 8px;
    transition: background 0.15s;
}
.nav-bell:hover { background: rgba(0,0,0,0.06); }
.nav-bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 17px;
    height: 17px;
    border-radius: 99px;
    background: #e53e3e;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    padding: 0 4px;
    pointer-events: none;
}

.nav-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    line-height: 1;
    text-decoration: none;
    padding: 4px 6px;
    border-radius: 8px;
    transition: background 0.15s;
}
.nav-bell:hover { background: rgba(0,0,0,0.06); }
.nav-bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e53e3e;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    min-width: 17px;
    height: 17px;
    border-radius: 9px;
    padding: 2px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.nav-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    background-color: #e2e8f0;
    flex-shrink: 0;
}
.user-profile-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f7fafc;
    padding: 4px 10px;
    border-radius: 30px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.user-profile-dropdown:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(44,122,123,0.1); }
.user-profile-info { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.user-name { font-weight: 600; font-size: 0.82rem; color: var(--text-dark); white-space: nowrap; }
.user-role { font-size: 0.7rem; color: var(--text-gray); white-space: nowrap; }
.user-account-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Make Logout link visually distinct (red) wherever it appears so users can find it quickly */
.user-account-actions a[href*="logout"],
.user-account-actions a[href*="/logout/"] {
    background: #fee2e2 !important;
    border: 1px solid #fecaca !important;
    color: #b91c1c !important;
    font-weight: 600 !important;
}
.user-account-actions a[href*="logout"]:hover {
    background: #fecaca !important;
    color: #991b1b !important;
}

/* Caret indicator next to avatar so users know it's a clickable dropdown */
@media (min-width: 769px) {
    .user-profile-dropdown { padding-right: 14px; }
    .user-profile-dropdown::before {
        content: '▾';
        position: absolute;
        right: 6px; top: 50%;
        transform: translateY(-50%);
        font-size: 0.75rem;
        color: var(--text-gray);
        pointer-events: none;
        transition: transform 0.2s;
    }
    .user-profile-dropdown.open::before { transform: translateY(-50%) rotate(180deg); }
}

/* Desktop: force single row, hide user name to save space */
@media (min-width: 769px) {
    .nav-container { flex-wrap: nowrap; }
    .nav-links { flex-wrap: nowrap; }
    .user-profile-info { display: none; }
    .user-account-actions .btn {
        font-size: 0.74rem;
        padding: 5px 8px;
    }
    #nav-toggle { display: none; }

    /* Dropdown behavior for all desktop sizes */
    .user-profile-dropdown {
        position: relative;
        cursor: pointer;
    }
    .user-account-actions {
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        background: var(--white);
        border-radius: var(--radius);
        box-shadow: 0 8px 24px rgba(0,0,0,0.13);
        border: 1px solid #edf2f7;
        padding: 4px 0;
        min-width: 190px;
        z-index: 300;
        display: none;
        flex-direction: column;
        gap: 0;
        flex-wrap: nowrap;
    }
    .user-account-actions::before {
        content: '';
        position: absolute;
        top: -6px; right: 14px;
        border-width: 0 6px 6px;
        border-style: solid;
        border-color: transparent transparent var(--white);
    }
    .user-profile-dropdown:focus-within .user-account-actions,
    .user-profile-dropdown.open .user-account-actions {
        display: flex;
    }
    .user-profile-dropdown::after {
        content: '';
        position: absolute;
        bottom: -12px;
        left: -8px;
        right: -8px;
        height: 12px;
        background: transparent;
    }
    .user-account-actions .btn {
        display: block;
        width: 100%;
        text-align: left;
        border-radius: 0;
        padding: 11px 18px;
        font-size: 0.9rem;
        color: var(--text-gray);
        background: transparent;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        font-weight: 500;
    }
    .user-account-actions .btn:last-child { border-bottom: none; }
    .user-account-actions .btn:hover {
        background: var(--bg-light);
        color: var(--primary);
    }
}

/* Mid-size desktops/tablets: tighten nav controls to avoid horizontal overflow */
@media (min-width: 769px) and (max-width: 1280px) {
    .nav-container {
        height: 70px;
        padding: 0;
        align-items: center;
    }
    .logo-text h1 { font-size: 0.95rem; }
    .logo-text span { font-size: 0.72rem; }
    .nav-links {
        gap: 8px;
        flex-wrap: nowrap;
        justify-content: flex-end;
        max-width: none;
        row-gap: 0;
    }
    .nav-links > a { font-size: 0.86rem; }
    .nav-links > .btn {
        padding: 6px 8px;
        font-size: 0.76rem;
        line-height: 1;
        text-align: center;
        white-space: nowrap;
    }
}

.hero {
    background: linear-gradient(rgba(44, 122, 123, 0.85), rgba(43, 108, 176, 0.85)), url('https://picsum.photos/seed/school/1920/1080');
    background-size: cover; background-position: center; color: var(--white); padding: 100px 0; text-align: center;
}
.hero h2 { font-size: 3rem; margin-bottom: 20px; }
.hero p { font-size: 1.25rem; margin-bottom: 30px; max-width: 700px; margin-left: auto; margin-right: auto; }
.hero .btn + .btn { margin-left: 12px; }

/* nav-active highlights current-page links, but should NOT override button colors
   (e.g. the Portal button uses btn-secondary white text on blue and must stay readable) */
.nav-active:not(.btn) { color: var(--primary) !important; font-weight: 700 !important; }
.btn.nav-active { box-shadow: inset 0 -2px 0 rgba(255,255,255,0.45); }

.btn:disabled { opacity: 0.65; cursor: not-allowed; }

.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.service-card { text-align: center; border-top: 4px solid var(--primary); transition: transform 0.3s; }
.service-card:hover { transform: translateY(-5px); }
.service-icon { font-size: 2.5rem; margin-bottom: 15px; display: block; }
.service-card h3 { margin-bottom: 10px; color: var(--text-dark); }
.service-card ul { text-align: left; margin-top: 15px; padding-left: 20px; list-style: disc; color: var(--text-gray); }

.home-header-subtitle { font-size: 1.1rem; color: var(--text-gray); margin-top: 5px; }
.filter-placeholder {
    background: var(--white); padding: 20px; border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 30px; display: flex; align-items: center; gap: 15px; flex-wrap: wrap;
}
.filter-placeholder label { font-weight: 600; color: var(--text-dark); }
.filter-placeholder select {
    padding: 8px; border-radius: 4px; border: 1px solid #cbd5e0; min-width: 200px;
}
.filter-placeholder #event-search {
    padding: 8px 12px; border-radius: 4px; border: 1px solid #cbd5e0;
    min-width: 220px; flex: 1; font-size: 0.9rem;
}
.filter-placeholder #event-search:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74,144,226,0.15);
}

.event-card {
    background: var(--white); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform 0.3s; position: relative;
}
.event-card:hover { transform: translateY(-5px); }
.event-img {
    height: 160px; background-color: #e2e8f0; background-size: cover; background-position: center;
}
.event-body { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }

.badge-container { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.badge {
    font-size: 0.75rem; padding: 4px 8px; border-radius: 4px; font-weight: 700; text-transform: uppercase;
}
.badge-virtual { background-color: #e3f2fd; color: #1565c0; }
.badge-hybrid { background-color: #f3e5f5; color: #7b1fa2; }
.badge-person { background-color: #e8f5e9; color: #2e7d32; }
.badge-spots { background-color: #fff3e0; color: #ef6c00; margin-left: auto; }
.badge-category { background-color: #2d3748; color: white; }

.event-date { font-size: 0.85rem; color: var(--secondary); font-weight: 700; text-transform: uppercase; margin-bottom: 5px; }
.event-title { font-size: 1.2rem; font-weight: bold; margin-bottom: 10px; color: var(--text-dark); }

.event-schedule-line {
    font-size: 0.85rem; color: var(--text-gray); margin-bottom: 10px; font-weight: 500; display: flex; align-items: center; gap: 5px;
}

.event-meta {
    font-size: 0.85rem; color: var(--text-gray); margin-top: auto; padding-top: 15px;
    border-top: 1px solid #eee; display: grid; grid-template-columns: 1fr 1fr; gap: 5px;
}
.meta-item { display: flex; flex-direction: column; }
.meta-label { font-weight: 600; font-size: 0.75rem; color: #718096; }

.event-footer { margin-top: 15px; display: flex; gap: 10px; }
.btn-small { font-size: 0.8rem; padding: 8px 0; flex: 1; text-align: center; }

.detail-row {
    display: flex; justify-content: space-between; margin-bottom: 10px; border-bottom: 1px solid #eee; padding-bottom: 5px;
}
.detail-label { font-weight: bold; color: var(--text-dark); width: 40%; }
.detail-value { color: var(--text-gray); width: 60%; text-align: right; }
.instructor-pending { color: #e53e3e; font-style: italic; }
.instructor-assigned { color: #38a169; font-weight: bold; }

.schedule-list { list-style: disc; padding-left: 20px; margin-bottom: 15px; color: var(--text-gray); }
.registration-message {
    background: #ebf8ff; border-left: 4px solid var(--secondary); padding: 15px;
    margin-bottom: 20px; font-size: 0.9rem; color: #2c5282;
}

.contact-form-wrapper {
    background: var(--white); padding: 30px; border-radius: var(--radius);
    box-shadow: var(--shadow); max-width: 600px; margin: 0 auto; width: 100%;
}
.contact-form-wrapper .form-group { margin-bottom: 20px; }
.contact-form-wrapper label { display: block; margin-bottom: 8px; font-weight: 600; }
.contact-form-wrapper input, .contact-form-wrapper textarea {
    width: 100%; padding: 12px; border: 1px solid #cbd5e0; border-radius: var(--radius); font-family: inherit;
}
.contact-form-wrapper textarea { resize: vertical; min-height: 120px; }

.dashboard-container { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 70px); }
.sidebar { background: var(--primary-dark); color: var(--white); padding: 20px; }
.sidebar h3 { margin-bottom: 30px; padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.2); }
.sidebar-menu li { margin-bottom: 10px; }
.sidebar-menu button {
    width: 100%; text-align: left; background: none; color: rgba(255,255,255,0.8);
    padding: 10px; border-radius: var(--radius);
}
.sidebar-menu button:hover, .sidebar-menu button.active {
    background: rgba(255,255,255,0.1); color: var(--white);
}
.dashboard-content { padding: clamp(18px, 3vw, 30px); background: #edf2f7; min-width: 0; }
.dashboard-content > * {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }

/* Auto-scroll any card that contains a data-table to prevent horizontal overflow */
.card:has(.data-table) { overflow-x: auto; }
.data-table { width: auto; min-width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: clip; box-shadow: var(--shadow); }
.data-table th, .data-table td { padding: 15px; text-align: left; border-bottom: 1px solid #e2e8f0; vertical-align: middle; }
.data-table th { background: var(--primary); color: var(--white); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.data-table tbody tr:hover { background: #f7fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }
.status-badge { padding: 4px 8px; border-radius: 12px; font-size: 0.8rem; font-weight: 600; }
.status-pass { background: #c6f6d5; color: #22543d; }
.status-pending { background: #feebc8; color: #744210; }
.status-fail { background: #fed7d7; color: #822727; }

.widget-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: var(--white); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); border-left: 5px solid var(--secondary); }
.stat-number { font-size: 2rem; font-weight: bold; color: var(--secondary); }

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center;
    z-index: 1000; opacity: 0; pointer-events: none; transition: 0.3s;
    overflow-y: auto;
    padding: 16px;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
    background: var(--white); padding: 30px; border-radius: var(--radius);
    width: 90%; max-width: 500px; position: relative; max-height: 92vh; overflow-y: auto;
    display: flex; flex-direction: column;
}
.modal-lg { max-width: 800px; }

.close-modal { position: absolute; top: 15px; right: 15px; font-size: 1.5rem; background: none; color: var(--text-gray); }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 11px 12px; border: 1px solid #cbd5e0; border-radius: var(--radius); font-family: inherit; font-size: 0.95rem; transition: border-color 0.2s, box-shadow 0.2s; box-sizing: border-box; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(44,122,123,0.15); }
.form-group textarea { resize: vertical; min-height: 100px; }
.form-row { display: flex; gap: 15px; }
.form-row .form-group { flex: 1; }
.auth-switch { text-align: center; margin-top: 15px; font-size: 0.9rem; }
.auth-switch a { color: var(--primary); font-weight: 600; cursor: pointer; text-decoration: underline; }
.login-options { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 15px; }

/* Admin/Accounting form fields */
.adm-field { margin-bottom: 14px; }
.adm-field label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 0.88rem; color: var(--text-dark); }

/* Remember Me checkbox label */
.remember-me-label {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    color: var(--text-gray);
    font-size: 0.88rem;
    user-select: none;
}
.remember-me-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    margin: 0;
}

/* Demo login section */
.demo-login-section {
    margin-top: 22px;
    border-top: 1px solid #e2e8f0;
    padding-top: 18px;
}
.demo-login-label {
    text-align: center;
    font-size: 0.8rem;
    color: #a0aec0;
    margin-bottom: 12px;
    letter-spacing: 0.03em;
}
.demo-login-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.demo-btn {
    flex: 1;
    text-align: center;
    font-size: 0.8rem;
    padding: 8px 6px;
    border-radius: var(--radius);
    font-weight: 600;
    transition: all 0.2s;
    border: 2px solid transparent;
}
.demo-student {
    background: #e6fffa;
    color: #276749;
    border-color: #81e6d9;
}
.demo-student:hover { background: #b2f5ea; color: #1d4731; }
.demo-teacher {
    background: #ebf8ff;
    color: #2c5282;
    border-color: #90cdf4;
}
.demo-teacher:hover { background: #bee3f8; color: #1a365d; }
.demo-admin {
    background: #faf5ff;
    color: #553c9a;
    border-color: #d6bcfa;
}
.demo-admin:hover { background: #e9d8fd; color: #322659; }

/* Small breathing room before the footer; dashboards keep extra room for the floating Help FAB */
main, #main-content {
    padding-bottom: 24px;
}
.sd-main, .t-main, .pd-main, .dashboard-content, .a-main {
    padding-bottom: 96px;
}
/* Table responsive guard — any table inside a card/panel scrolls horizontally instead of overflowing */
.card table, .sd-panel table, .t-panel table, .pd-panel table, .dashboard-content table,
.sd-card table, .t-card table, .pd-card table, .dash-card table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}
.card table thead, .sd-panel table thead, .t-panel table thead, .pd-panel table thead,
.dashboard-content table thead, .sd-card table thead, .t-card table thead,
.pd-card table thead, .dash-card table thead {
    display: table-header-group;
}

#toast-container { position: fixed; bottom: 20px; right: 220px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 240px); }
.toast { background: var(--text-dark); color: var(--white); padding: 12px 24px; border-radius: var(--radius); box-shadow: var(--shadow); animation: slideIn 0.3s ease-out forwards; min-width: 250px; display: flex; justify-content: space-between; align-items: center; }
.toast.success { border-left: 5px solid #48bb78; }
.toast.error { border-left: 5px solid #f56565; }
.toast.info { border-left: 5px solid var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@media (max-width: 768px) {
    #toast-container { top: 128px; bottom: auto; left: 12px; right: 12px; max-width: none; align-items: stretch; width: auto; }
    .toast { min-width: 0; width: 100%; font-size: 0.88rem; padding: 10px 14px; }
    @keyframes slideIn { from { transform: translateY(-100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
}
/* Bottom padding for FAB safety on mobile */
@media (max-width: 768px) {
    .dashboard-content, .pd-panel, .t-main { padding-bottom: max(80px, calc(70px + env(safe-area-inset-bottom, 0px))); }
    main > .container { padding-bottom: 24px; }
}

/* ── Legal / FAQ shared styles ── */
.legal-hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    padding: 56px 0 40px;
    text-align: center;
}
.legal-title { font-size: 2.2rem; font-weight: 800; margin-bottom: 8px; }
.legal-subtitle { font-size: 0.92rem; color: rgba(255,255,255,0.65); }
.legal-body { padding: 48px 0 64px; background: var(--bg-light); }
.legal-container { display: grid; grid-template-columns: 220px 1fr; gap: 48px; align-items: flex-start; }
.legal-toc {
    position: sticky;
    top: 86px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.legal-toc-title { font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-gray); margin-bottom: 6px; }
.legal-toc a { font-size: 0.85rem; color: var(--text-gray); text-decoration: none; transition: color 0.2s, padding-left 0.2s; }
.legal-toc a:hover { color: var(--primary); padding-left: 4px; }
.legal-content { display: flex; flex-direction: column; gap: 0; }
.legal-section { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px 36px; margin-bottom: 20px; }
.legal-section h2 { font-size: 1.15rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 18px; padding-bottom: 10px; border-bottom: 2px solid var(--bg-light); }
.legal-section p { font-size: 0.93rem; color: var(--text-gray); line-height: 1.8; margin-bottom: 10px; }
.legal-section ul, .legal-section ol { font-size: 0.93rem; color: var(--text-gray); line-height: 1.8; padding-left: 20px; margin-bottom: 10px; }
.legal-section a { color: var(--primary); }

/* FAQ accordion */
.faq-item { border-bottom: 1px solid #edf2f7; }
.faq-item:last-of-type { border-bottom: none; }
.faq-item summary {
    font-size: 0.95rem; font-weight: 600; color: var(--text-dark);
    padding: 16px 0; cursor: pointer; list-style: none;
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; transition: color 0.2s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: '+'; font-size: 1.3rem; color: var(--primary);
    font-weight: 400; flex-shrink: 0; transition: transform 0.25s;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary:hover { color: var(--primary); }
.faq-item > p, .faq-item > div {
    font-size: 0.93rem; color: var(--text-gray); line-height: 1.8; padding: 0 0 18px 0;
}

@media (max-width: 768px) {
    .legal-container { grid-template-columns: 1fr; }
    .legal-toc { position: static; }
    .legal-section { padding: 22px 18px; }
    .legal-title { font-size: 1.6rem; }
}

footer {
    background: linear-gradient(160deg, #0f2027 0%, #1a3a3c 55%, #234e52 100%);
    color: var(--white);
    padding: 0;
    margin-top: auto;
}
.footer-inner {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1.2fr;
    gap: 48px;
    padding: 36px 0 28px;
    align-items: flex-start;
}

/* Brand column */
.footer-brand {}
.footer-logo-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}
.footer-logo-img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    box-shadow: 0 0 0 4px rgba(44,122,123,0.25);
}
.footer-logo-name {
    font-weight: 800;
    font-size: 1rem;
    color: var(--white);
    line-height: 1.3;
    letter-spacing: 0.01em;
}
.footer-logo-sub {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.footer-tagline {
    font-size: 0.87rem;
    color: rgba(255,255,255,0.55);
    line-height: 1.75;
    max-width: 280px;
    margin-bottom: 22px;
}
.footer-divider {
    width: 40px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}

/* Link columns */
.footer-col { display: flex; flex-direction: column; gap: 11px; }
.footer-col-title {
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 6px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer-col a {
    color: rgba(255,255,255,0.62);
    font-size: 0.88rem;
    transition: color 0.2s, padding-left 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.footer-col a::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    flex-shrink: 0;
    transition: background 0.2s;
}
.footer-col a:hover { color: var(--white); padding-left: 4px; }
.footer-col a:hover::before { background: var(--accent); }

/* Social buttons */
.footer-socials { display: flex; flex-direction: column; gap: 10px; }
.footer-social-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.65);
    font-size: 0.88rem;
    font-weight: 500;
    transition: color 0.2s, transform 0.2s;
    text-decoration: none;
}
.footer-social-btn:hover { color: var(--white); transform: translateX(4px); }
.footer-social-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s;
}
.footer-social-btn:hover .footer-social-icon {
    background: var(--primary);
    border-color: var(--primary);
}

/* Bottom bar */
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 0 0 24px 0;
    text-align: center;
}
.footer-copyright {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.35);
    margin: 0;
    letter-spacing: 0.01em;
}
@media (max-width: 768px) {
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 28px;
        padding: 80px 0 20px;
    }
    .footer-logo-row {
        flex-direction: row;
        gap: 14px;
        margin-bottom: 18px;
    }
    .footer-logo-img {
        width: 56px;
        height: 56px;
    }
    .footer-logo-name {
        font-size: 1rem;
    }
    .footer-logo-sub {
        font-size: 0.75rem;
    }
    .footer-tagline {
        max-width: 280px;
        margin-bottom: 22px;
    }
    .footer-col {
        align-items: flex-start;
        gap: 11px;
    }
    .footer-col-title {
        font-size: 1.1rem;
        margin-bottom: 6px;
    }
    .footer-socials {
        flex-direction: column;
        gap: 10px;
        justify-content: flex-start;
    }
    .footer-bottom {
        padding: 18px 0;
        text-align: center;
    }
    .footer-copyright {
        font-size: 0.78rem;
        color: rgba(255,255,255,0.35);
        margin: 0;
        letter-spacing: 0.01em;
    }
}
@media (max-width: 600px) {
    .footer-inner { grid-template-columns: 1fr; gap: 28px; padding: 80px 0 20px; }
    .footer-tagline { max-width: 100%; }
}

/* About page */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; margin-bottom: 50px; }
.about-images { display: flex; flex-direction: column; gap: 15px; }
.about-img { width: 100%; border-radius: var(--radius); object-fit: cover; }
.about-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 40px; }

/* Testimonials */
.testimonial-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.testimonial-img { width: 100%; height: 200px; object-fit: cover; }
.testimonial-body { padding: 20px; flex-grow: 1; }
.testimonial-quote { font-style: italic; color: var(--text-gray); margin-bottom: 12px; line-height: 1.7; }
.testimonial-author { font-weight: 600; color: var(--primary); font-size: 0.9rem; }

/* Section title */
.section-title { text-align: center; margin-bottom: 40px; }
.section-title h2 { font-size: 2rem; color: var(--text-dark); margin-bottom: 10px; }
.section-title p { color: var(--text-gray); font-size: 1.05rem; }

#nav-toggle { display: none; font-size: 1.4rem; padding: 6px 12px; line-height: 1; }

/* Sidebar admin link */
.sidebar a.btn-outline {
    text-align: center;
    font-size: 0.85rem;
}

/* Detail actions */
.detail-actions { margin-top: 20px; border-top: 1px solid #eee; padding-top: 20px; }

/* Dashboard search input */
.dashboard-search {
    padding: 10px 14px;
    border: 1px solid #cbd5e0;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    width: 100%;
    max-width: 340px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.dashboard-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44,122,123,0.15);
}

/* Event form date inputs */
input[type="date"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e0;
    border-radius: var(--radius);
    font-family: inherit;
    transition: border-color 0.2s;
}
input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44,122,123,0.15);
}

/* Cancel button in tables */
.btn-danger { background: #fed7d7; color: #c53030; border: none; }
.btn-danger:hover { background: #feb2b2; }

@media (max-width: 768px) {
    /* ── Nav hamburger ── */
    #nav-toggle { display: inline-block; flex-shrink: 0; margin-left: auto; font-size: 1.3rem; padding: 6px 10px; }
    /* Allow logo to shrink so hamburger is never clipped at narrow widths (e.g. 320px) */
    .logo-area { flex-shrink: 1; min-width: 0; overflow: hidden; }
    .logo-text { min-width: 0; overflow: hidden; }
    .logo-text h1 { overflow: hidden; text-overflow: ellipsis; }
    .logo-text span { display: block; font-size: 0.82rem; color: var(--primary); font-weight: 700; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
    /* Mobile dropdown panel — full-width, clean column, scrolls internally so Logout is always reachable */
    .nav-links {
        display: none;
        flex-direction: column;
        position: fixed; top: 70px; left: 0; right: 0;
        background: var(--white);
        box-shadow: 0 6px 18px rgba(0,0,0,0.1);
        padding: 12px 20px calc(24px + env(safe-area-inset-bottom, 0px));
        gap: 4px;
        z-index: 99;
        flex-wrap: nowrap;
        align-items: stretch;
        border-top: 2px solid var(--primary);
        max-height: calc(100vh - 70px);
        max-height: calc(100dvh - 70px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    .nav-links.nav-open { display: flex; }
    /* Each direct link */
    .nav-links > a {
        font-size: 0.95rem;
        font-weight: 600;
        padding: 9px 4px;
        border-bottom: 1px solid #edf2f7;
        color: var(--text-dark);
        display: block;
        width: 100%;
    }
    .nav-links > a:last-of-type { border-bottom: none; }
    /* Dropdown rows */
    .nav-dropdown { flex-direction: column; width: 100%; align-items: stretch; border-bottom: 1px solid #edf2f7; }
    .nav-dropdown:last-child { border-bottom: none; }
    .nav-dropdown-toggle {
        width: 100%; justify-content: space-between;
        padding: 9px 4px; font-size: 0.95rem;
        font-weight: 600; color: var(--text-dark);
    }
    /* Sub-menu inside mobile */
    .nav-dropdown-menu {
        position: static; transform: none !important;
        opacity: 1; pointer-events: auto;
        box-shadow: none; border-radius: 0;
        background: var(--bg-light);
        min-width: 100%; left: auto;
        display: none;
        padding: 4px 0 4px 14px;
    }
    .nav-dropdown-menu::before { display: none; }
    .nav-dropdown-menu a { padding: 8px 8px; font-size: 0.9rem; border-bottom: none; color: var(--text-gray); }
    .nav-dropdown.open .nav-dropdown-menu { display: flex; }
    /* Auth buttons row */
    .nav-links .btn { font-size: 0.9rem; padding: 9px 16px; text-align: center; display: block; width: 100%; margin-top: 4px; }
    .user-profile-dropdown { flex-direction: row; flex-wrap: wrap; border-radius: var(--radius); width: 100%; justify-content: space-between; padding: 10px 14px; }
    .user-profile-info { display: flex; text-align: left; }
    .user-account-actions {
        width: 100%;
        display: flex;
        gap: 8px;
        justify-content: stretch;
    }
    .user-account-actions .btn {
        flex: 1 1 calc(33.333% - 8px);
        min-width: 110px;
        text-align: center;
        margin-top: 0;
        font-size: 0.82rem;
        padding: 9px 8px;
    }

    /* ── Logged-in user profile inside mobile nav ── */
    .user-profile-dropdown { flex-direction: row; flex-wrap: wrap; border-radius: var(--radius); width: 100%; justify-content: space-between; padding: 10px 14px; }
    .user-profile-info { display: flex; text-align: left; }

    /* ── Modals — scrollable on small screens ── */
    .modal-overlay { align-items: center; padding: 12px 8px; }
    .modal { width: 94vw !important; max-width: 94vw !important; margin: auto; max-height: min(90vh, 900px) !important; }

    /* ── Layout ── */
    .dashboard-container { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .mobile-tab-nav { display: flex !important; }
    .form-row { flex-direction: column; gap: 0; }
    .event-detail-grid { grid-template-columns: 1fr !important; }
    .about-grid { grid-template-columns: 1fr; }
    .about-stats { grid-template-columns: repeat(2, 1fr); }

    /* ── Typography ── */
    .hero h2 { font-size: 2rem; }
    .section-title h2 { font-size: 1.6rem; }

    /* ── Footer ── */
    .footer-inner { gap: 28px; padding: 32px 0 20px; }
}

@media (max-width: 420px) {
    .container { padding: 0 12px; }
    .dashboard-content { padding: 14px; }
}

/* Section jump behavior for in-page navigation links */
html {
    scroll-behavior: smooth;
    overflow-x: clip; /* prevent document-level horizontal scroll from table/card overflow */
}

:target {
    scroll-margin-top: 92px;
}

/* Global responsive safety net for all templates and dynamic content */
img,
video,
canvas,
svg,
iframe {
    max-width: 100%;
    height: auto;
}

p,
h1,
h2,
h3,
h4,
h5,
h6,
span,
li,
a,
label,
small {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Table cells: only break on long unbreakable words, not short names */
td,
th {
    overflow-wrap: break-word;
}

/* Key table columns: preserve names/emails on one line when space allows */
.data-table td:nth-child(2),
.data-table th:nth-child(2) { min-width: 100px; white-space: nowrap; }
.data-table td:nth-child(3),
.data-table th:nth-child(3) { min-width: 140px; }

.table-responsive,
.sd-table-wrap,
.t-table-wrap,
.table-wrap,
.overflow-table {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    max-width: 100%;
}

input,
select,
textarea,
button {
    max-width: 100%;
}

@media (max-width: 768px) {
    .container {
        width: 100%;
        max-width: 100%;
        padding-left: 14px;
        padding-right: 14px;
    }

    .btn,
    button,
    input[type="submit"],
    input[type="button"] {
        white-space: normal;
    }
}

/* ── Mobile Tab Navigation (shows when sidebar is hidden) ── */
.mobile-tab-nav {
    display: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #1a202c;
    padding: 10px 12px;
    gap: 6px;
    flex-wrap: nowrap;
    scrollbar-width: none;
}
.mobile-tab-nav::-webkit-scrollbar { display: none; }
.mobile-tab-nav button {
    flex-shrink: 0;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
    border: none;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}
.mobile-tab-nav button:hover,
.mobile-tab-nav button.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
/* ── Admin mobile nav scroll-hint wrapper ── */
.mobile-tab-nav-wrap {
    display: none; /* hidden on desktop; shown via media query below */
    position: sticky; top: 70px; z-index: 20;
    /* Clip to viewport so the inner overflow-x:auto can actually scroll
       when the parent grid container has expanded beyond the viewport. */
    overflow: hidden; max-width: 100vw; width: 100%;
}
.mobile-tab-nav-wrap > .mobile-tab-nav { width: 100%; max-width: 100%; }
.mobile-tab-nav-wrap::after {
    content: ''; position: absolute; right: 0; top: 0; bottom: 0;
    width: 26px; pointer-events: none; z-index: 1; display: none;
    background: linear-gradient(to right, transparent, rgba(20,26,44,0.9));
}
@media (max-width: 768px) {
    .mobile-tab-nav-wrap { display: block; }
    .mobile-tab-nav-wrap::after { display: block; }
}
@media (max-width: 360px) {
    .mobile-tab-nav { padding: 5px 6px !important; gap: 3px !important; }
    .mobile-tab-nav button { padding: 4px 7px !important; font-size: 0.62rem !important; }
}

/* ── Modal: contain horizontal overflow from fixed-width widgets (reCAPTCHA iframe) ── */
.modal { overflow-x: hidden; }
.modal .g-recaptcha { max-width: 100%; overflow-x: auto; }
@media (max-width: 360px) {
    /* Scale down the reCAPTCHA widget to fit very narrow screens */
    .modal .g-recaptcha { transform: scale(0.86); transform-origin: 0 0; }
    .modal .g-recaptcha > div { width: 304px !important; }
}

/* ── Accounting dashboard responsive polish ── */
@media (max-width: 768px) {
    .acct-card { padding: 16px 14px; border-radius: 10px; }
    .acct-card h3 { font-size: 1rem; }
    .widget-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
    .stat-card { padding: 14px 10px; }
    .stat-card .stat-number { font-size: 1.2rem; }
    .data-table th, .data-table td { padding: 8px 6px; font-size: 0.78rem; }
    .data-table { min-width: 500px; }    .adm-field { margin-bottom: 12px; }
    .adm-field label { font-size: 0.82rem; }
    .ann-post-box { padding: 16px; border-radius: 10px; }
    .ann-card { padding: 16px; border-radius: 10px; }
    .ann-card-title { font-size: 1rem; }
    .ann-card-body { font-size: 0.88rem; }
    .dashboard-header { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 20px; }
    .dashboard-header h2 { font-size: 1.2rem; }
    .dashboard-header .btn { font-size: 0.82rem; padding: 8px 14px; }
}

@media (max-width: 420px) {
    .widget-grid { grid-template-columns: 1fr !important; }
    .mobile-tab-nav { padding: 8px 8px; gap: 5px; }
    .mobile-tab-nav button { padding: 7px 10px; font-size: 0.72rem; }
    .ann-post-box { padding: 12px; }
    .ann-card { padding: 12px; }
}

/* ── Cross-device safety net (added 2026-05-31) ── */
/* Pair body's overflow with html's existing overflow-x: clip so iOS Safari
   does not allow horizontal scroll from third-party widgets, and prevent
   iOS landscape font auto-enlarge that breaks fixed-width layouts. */
body {
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Prevent iOS auto-zoom when focusing form fields below the 16px threshold.
   Applies only on small viewports so desktop typography is unchanged. */
@media (max-width: 600px) {
    input:not([type='checkbox']):not([type='radio']):not([type='range']),
    select,
    textarea {
        font-size: max(16px, 1rem);
    }
}
