@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(to bottom, #f9f7f3 0%, #fffaf0 100%);
    color: #2d3748;
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Ensures body fills viewport */
    scroll-behavior: smooth;
    padding-top: 80px;
}
/* Logged-in users already have an account — hide signup / free-access CTAs */
html.is-logged-in .guest-only,
html.is-logged-in a.el-btn[href="signup.html"],
html.is-logged-in a.header-signup-btn,
html.is-logged-in a.cta-primary[href="signup.html"] {
    display: none !important;
}
.main-content {
    flex-grow: 1; /* Pushes footer to bottom */
    padding: 2rem;
    max-width: 1100px;
    margin: 0 auto;
}
/* Header - Fixed, responsive grid (avoids absolute-center overlap) */
header,
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.85rem 1.75rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 1rem;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    min-height: 64px;
}
header nav,
.site-header nav {
    position: static;
    left: auto;
    transform: none;
    justify-self: center;
    max-width: 100%;
}
.logo {
    font-size: 1.45rem;
    font-weight: 700;
    color: #4a90e2;
    text-decoration: none;
    letter-spacing: -0.5px;
    flex-shrink: 1;
    min-width: 0;
    z-index: 1;
    justify-self: start;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.logo .logo-full { display: inline; }
.logo .logo-short { display: none; }
.beta-sub {
    font-size: 0.45em;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1;
    color: #4a90e2;
    margin-left: 0.18em;
    vertical-align: sub;
}
nav ul .beta-sub {
    font-size: 0.55em;
}
nav ul {
    display: flex;
    list-style: none;
    gap: clamp(0.65rem, 1.6vw, 2rem);
    align-items: center;
    flex-wrap: nowrap;
    margin: 0;
    padding: 0;
}
nav ul li a {
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    font-size: clamp(0.8rem, 1.05vw, 1rem);
    transition: color 0.3s;
    white-space: nowrap;
}
nav ul li a:hover {
    color: #4a90e2;
}
.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(0.5rem, 1.2vw, 1.25rem);
    flex-shrink: 1;
    min-width: 0;
    z-index: 1;
    justify-self: end;
}
.header-dashboard-link {
    color: #4a5568;
    text-decoration: none;
    font-weight: 600;
    font-size: clamp(0.8rem, 1.05vw, 1rem);
    white-space: nowrap;
    transition: color 0.3s;
}
.header-dashboard-link:hover {
    color: #4a90e2;
}
.header-admin-badge {
    margin-left: 0.25rem;
    font-size: 0.7rem;
    background: #1e40af;
    color: white;
    padding: 2px 8px;
    border-radius: 9999px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.header-approved-badge {
    margin-left: 0.25rem;
    font-size: 0.7rem;
    background: #166534;
    color: #dcfce7;
    padding: 2px 8px;
    border-radius: 9999px;
    white-space: nowrap;
}
.account-menu {
    position: relative;
}
.account-btn {
    background: none;
    border: none;
    color: #4a90e2;
    font-weight: 600;
    cursor: pointer;
    font-size: clamp(0.8rem, 1.05vw, 1rem);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0;
    white-space: nowrap;
}
.dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: white;
    min-width: 200px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 0.75rem 0;
    display: none;
    flex-direction: column;
    border: 1px solid #e2e8f0;
    z-index: 1100;
}
.dropdown.open,
.account-menu.open .dropdown {
    display: flex;
}
.dropdown a {
    padding: 0.75rem 1.25rem;
    color: #4a5568;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.2s;
}
.dropdown a:hover {
    background: #f7fafc;
    color: #4a90e2;
}
/* Hover account menu only on fine pointers / wider screens */
@media (hover: hover) and (min-width: 901px) {
    .account-menu:hover .dropdown {
        display: flex;
    }
}

/* Hamburger – hidden on desktop */
.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin: 0;
    padding: 0;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    color: #4a90e2;
    cursor: pointer;
    flex-shrink: 0;
    z-index: 2;
    transition: background 0.2s, border-color 0.2s;
}
.nav-toggle:hover {
    background: #f0f7ff;
    border-color: #93c5fd;
}
.nav-toggle-bars {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 18px;
}
.nav-toggle-bars span {
    display: block;
    height: 2px;
    width: 100%;
    background: #4a90e2;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}
.site-header.nav-open .nav-toggle-bars span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.site-header.nav-open .nav-toggle-bars span:nth-child(2) {
    opacity: 0;
}
.site-header.nav-open .nav-toggle-bars span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}
.nav-mobile-cta {
    display: none;
}
/* Page Title */
.page-title {
    text-align: center;
    font-size: 2.2rem;
    color: #2d3748;
    margin-bottom: 1rem;
    font-weight: 600;
}
/* Subtitle */
.subtitle {
    text-align: center;
    color: #718096;
    font-size: 1.1rem;
    margin-bottom: 3rem;
}
/* Option Grid (Consolidated: Vertical stack enforced everywhere) */
.options-grid {
    display: grid;
    grid-template-columns: 1fr; /* Single column for vertical stacking on all devices */
    gap: 2rem; /* Consistent with original; can use 20px if preferred */
    max-width: 1200px;
    margin: 3rem auto; /* Combined from originals */
}
.option-card {
    background: white; /* From original */
    border: 1px solid #edf2f7; /* From original, with fallback to #ddd if needed */
    border-radius: 16px; /* From original */
    padding: 2rem; /* From original */
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06); /* From original */
    transition: all 0.3s ease; /* From original */
    cursor: pointer;
    width: 96%; /* Increased by 20% from previous 80% base */
    margin: 0 auto; /* Centers the cards */
}
.option-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(74, 144, 226, 0.15);
    border-color: #4a90e2;
}
.option-icon {
    font-size: 2.8rem;
    color: #4a90e2;
    margin-bottom: 1rem;
}
.option-title {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
}
.option-desc {
    color: #718096;
    font-size: 0.9rem;
}
/* Footer */
footer {
    background: #ffffff;
    padding: 2rem;
    text-align: center;
    color: #718096;
    font-size: 0.9rem;
    border-top: 1px solid #e2e8f0;
    margin-top: auto; /* Ensures it sticks to bottom */
}
footer a {
    color: #4a90e2;
    text-decoration: none;
    margin: 0 0.5rem;
}
footer a:hover {
    text-decoration: underline;
}
/* ── Header responsive breakpoints ── */

/* Tablet / medium desktop: shrink type, keep single row */
@media (max-width: 1100px) {
    header,
    .site-header {
        padding: 0.75rem 1.15rem;
        column-gap: 0.65rem;
    }
    .logo {
        font-size: 1.2rem;
    }
    nav ul li a,
    .header-dashboard-link,
    .account-btn {
        font-size: 0.85rem;
    }
    .header-admin-badge,
    .header-approved-badge {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
}

/* Narrow tablet: hide verbose badges, tighten further */
@media (max-width: 960px) {
    .logo {
        font-size: 1.05rem;
    }
    .header-admin-badge .badge-full,
    .header-approved-badge {
        display: none;
    }
    .header-admin-badge::after {
        content: 'ADMIN';
    }
    nav ul {
        gap: 0.55rem;
    }
    nav ul li a {
        font-size: 0.8rem;
    }
}

/* Mobile / compact: hamburger + slide-down panel */
@media (max-width: 860px) {
    body {
        padding-top: 64px;
    }
    header,
    .site-header {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        padding: 0.65rem 0.9rem;
        min-height: 56px;
        row-gap: 0;
    }
    .logo {
        font-size: 1.05rem;
        order: 1;
        max-width: calc(100% - 110px);
    }
    .logo .logo-full { display: none; }
    .logo .logo-short { display: inline; }
    .header-right {
        order: 2;
        gap: 0.4rem;
    }
    .header-dashboard-link,
    .header-right-public .header-auth-link,
    .header-right-public .header-signup-btn {
        display: none; /* moved into mobile nav panel / avoid clutter */
    }
    .header-admin-badge,
    .header-approved-badge {
        display: none;
    }
    .nav-toggle {
        display: inline-flex;
        order: 3;
        margin-left: 0.15rem;
    }
    header nav,
    .site-header nav {
        order: 4;
        flex-basis: 100%;
        width: 100%;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        transition: max-height 0.28s ease, opacity 0.2s ease, visibility 0.2s;
        justify-self: stretch;
        border-top: 0 solid transparent;
    }
    .site-header.nav-open nav,
    header.nav-open nav {
        max-height: 70vh;
        overflow-y: auto;
        opacity: 1;
        visibility: visible;
        margin-top: 0.65rem;
        padding-top: 0.65rem;
        border-top: 1px solid #e2e8f0;
    }
    nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
    }
    nav ul li {
        width: 100%;
        border-bottom: 1px solid #f1f5f9;
    }
    nav ul li:last-child {
        border-bottom: none;
    }
    nav ul li a {
        display: block;
        font-size: 1rem;
        font-weight: 600;
        padding: 0.85rem 0.35rem;
        white-space: normal;
    }
    .nav-mobile-cta {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem 0.35rem 0.35rem;
        margin-top: 0.25rem;
        border-top: 1px solid #f1f5f9;
    }
    .nav-mobile-cta a {
        text-align: center;
        text-decoration: none;
        font-weight: 600;
        font-size: 0.95rem;
        border-radius: 10px;
        padding: 0.7rem 1rem;
    }
    .nav-mobile-cta .cta-secondary {
        color: #4a90e2;
        border: 1.5px solid #4a90e2;
        background: #fff;
    }
    .nav-mobile-cta .cta-primary {
        color: #fff;
        background: #4a90e2;
        border: 1.5px solid #4a90e2;
    }
    .account-btn {
        font-size: 0.9rem;
    }
    .dropdown {
        position: fixed;
        top: auto;
        right: 0.75rem;
        left: 0.75rem;
        min-width: 0;
        width: auto;
        max-height: min(70vh, 420px);
        overflow-y: auto;
        border-radius: 14px;
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
    }
}

@media (max-width: 400px) {
    .logo {
        font-size: 0.95rem;
    }
    .account-btn .account-label {
        display: none;
    }
    .account-btn::after {
        content: 'Account ▾';
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .options-grid {
        grid-template-columns: 1fr;
    }
    .main-content {
        padding: 1.25rem 1rem;
    }
    .page-title {
        font-size: 1.65rem;
    }
    .subtitle {
        font-size: 1rem;
        margin-bottom: 1.75rem;
    }
}
.form-input {
    width: 100%;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border 0.3s;
    background: #ffffff;
}
.form-input:focus {
    border-color: #4a90e2;
    outline: none;
}
.text-btn {
    background: none;
    border: none;
    color: #4a90e2;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    transition: color 0.3s;
}
.text-btn:hover {
    color: #2980b9;
    text-decoration: underline;
}
/* NEW: Nav Dropdown Styles (append at end to avoid regressions) */
nav ul li {
    position: relative; /* Allows absolute positioning of dropdown */
}
.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 0.75rem 0;
    display: none;
    flex-direction: column;
    border: 1px solid #e2e8f0;
    z-index: 1000; /* Ensures it overlays content */
}
.nav-dropdown a {
    padding: 0.75rem 1.25rem;
    color: #4a5568;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.2s;
}
.nav-dropdown a:hover {
    background: #f7fafc;
    color: #4a90e2;
}
nav ul li:hover .nav-dropdown {
    display: flex; /* Shows on hover, like account dropdown */
}
/* Optional Aesthetic Enhancement: Fade-in transition */
.nav-dropdown {
    opacity: 0;
    transition: opacity 0.3s ease;
}
nav ul li:hover .nav-dropdown {
    opacity: 1;
}
/* Add for timer if not already */
#timer {
  position: absolute;
  top: 100px; /* Below header; adjust based on your header height */
  right: 20px;
  font-size: 18px;
  color: red;
}
/* Commented out conflicting media query to enforce vertical stack everywhere */
/* @media (min-width: 768px) { 
  .options-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
  }
  .option-card {
    width: 100%; 
  }
} */

/* Centering container for elements like buttons */
.center {
    text-align: center;
    margin: 2rem 0;
}

/* Begin button style: Larger, no border/box, fits color scheme */
.begin-btn {
    background: none;
    border: none;
    color: #4a90e2; /* Matches accents like links/logo */
    font-size: 1.5rem; /* Larger for prominence */
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    transition: color 0.3s;
}
.begin-btn:hover {
    color: #2980b9; /* Darker blue on hover, from .text-btn */
    text-decoration: underline;
}

/* Minor timer adjustment: Ensure below header (adjust top if header height changes) */
#timer {
    position: absolute;
    top: 100px; /* Below fixed header (~80px + padding) */
    right: 20px;
    font-size: 18px;
    color: red;
}

/* ============================================================
   Phone / tablet — keep every flow usable on a small screen
   ============================================================ */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
img, video, canvas, svg {
    max-width: 100%;
    height: auto;
}
button, .begin-btn, .submit-btn, .el-btn, .header-signup-btn {
    -webkit-tap-highlight-color: rgba(74, 144, 226, 0.18);
    touch-action: manipulation;
}

@media (max-width: 860px) {
    html, body {
        overflow-x: hidden;
    }
    body {
        padding-top: max(56px, env(safe-area-inset-top, 0px) + 56px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    /* Exam hall pages manage their own top bar */
    body:has(#exam-topbar) {
        padding-top: 0;
        padding-bottom: 0;
    }
    .main-content {
        padding: 1rem 0.9rem 1.75rem;
        width: 100%;
        max-width: 100%;
    }
    .page-title { font-size: 1.55rem; margin-bottom: 0.65rem; }
    .subtitle { font-size: 0.98rem; margin-bottom: 1.35rem; line-height: 1.45; }

    input, select, textarea, .form-input {
        font-size: 16px !important; /* stop iOS zoom-on-focus */
        max-width: 100%;
    }
    .form-input, .submit-btn, .begin-btn {
        min-height: 44px;
    }
    .submit-btn, .begin-btn, button[type="submit"] {
        width: 100%;
    }

    footer {
        padding: 1.15rem 0.9rem calc(1.15rem + env(safe-area-inset-bottom, 0px));
        font-size: 0.82rem;
        line-height: 1.45;
    }

    /* Public login: form first, skip heavy media */
    .login-visual { display: none; }
    .login-form {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1.35rem 1.1rem !important;
        border-radius: 14px !important;
        box-shadow: 0 6px 20px rgba(0,0,0,0.06) !important;
    }
    .login-split { display: block; }

    /* Cards / settings pages with fat inline padding */
    .signup-card, .auth-card, .profile-card {
        padding: 1.25rem 1rem !important;
        border-radius: 14px !important;
    }

    /* Wide tables stay swipeable */
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Tiles: shorter so more of the hub fits on one screen */
    .el-tile {
        min-height: 168px !important;
        padding: 1.25rem 1.15rem !important;
        border-radius: 18px !important;
    }
    .el-tile-wide { min-height: 176px !important; }
    .el-cta-row {
        flex-direction: column;
        width: 100%;
        gap: 0.65rem;
    }
    .el-cta-row .el-btn {
        width: 100%;
        min-height: 46px;
    }

    /* Disable hover-scale on touch (it feels like a miss-tap) */
    .el-tile:hover { transform: none; }

    /* Home / landing sections */
    .el-section-inner { padding-left: 0.9rem; padding-right: 0.9rem; }
    .el-hero { padding: 2rem 1rem 1.35rem !important; }
    .home-logged .el-hero h1 { font-size: 1.85rem !important; }
    .home-logged .el-hero .el-sub { font-size: 1rem !important; }

    .owner-board { margin-top: 1.35rem; border-radius: 16px; }
    .owner-board-head { padding: 1rem 1.1rem 0.6rem; }
    .owner-board-head h2 { font-size: 1.05rem; }
    .owner-board-list { padding: 0 0.9rem 1rem; gap: 0.65rem; }
    .owner-update { padding: 0.8rem 0.95rem; }
    .owner-board-composer { margin: 0 0.9rem 1rem; padding: 0.9rem 0.95rem 1rem; }
    .owner-board-composer-row { flex-direction: column; align-items: stretch; }
    .owner-board-post { width: 100%; min-height: 44px; }

    .racs-dates-box {
        width: 100%;
        height: min(52vh, 360px);
        max-height: min(52vh, 360px);
    }
    .hero-visual { max-width: 100% !important; }

    .home-countdown-placeholder,
    .home-logged .exam-countdown-card,
    .home-panel {
        padding: 1.15rem 1.1rem !important;
        border-radius: 16px !important;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    .hero-buttons a { width: 100%; min-height: 46px; }

    /* Admin action buttons stay tappable in tables */
    .btn-approve, .btn-reject, .racs-admin-actions button {
        min-height: 40px;
        min-width: 72px;
    }
}

@media (max-width: 860px) and (hover: none) {
    .el-tile:hover .el-tile-arrow {
        transform: none;
        background: rgba(74, 144, 226, 0.12);
        color: #4a90e2;
    }
    .el-tile-dark:hover .el-tile-arrow {
        background: rgba(255, 255, 255, 0.12);
        color: #fff;
    }
}

@media (max-width: 480px) {
    .page-title { font-size: 1.4rem; }
    .hero-text h1 { font-size: 2rem !important; line-height: 1.1 !important; }
    .racs-dates-box {
        height: min(48vh, 320px);
        max-height: min(48vh, 320px);
    }
}