/* Student Home Portal - Central Stylesheet */

:root {
    --primary: #4f46e5;
    --primary-light: rgba(79, 70, 229, 0.1);
    --primary-hover: #4338ca;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --bg-gradient: radial-gradient(circle at top right, #f8fafc, #e2e8f0);
    --glass: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Outfit', sans-serif;
    color: #1e293b;
    background: #f8fafc;
    min-height: 100vh;
    margin: 0;
}

/* Only set while student home drawer (#mainSidebar) is open on mobile */
@media (max-width: 991.98px) {
    body.student-home-sidebar-open {
        overflow: hidden;
    }
}

/* Layout */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: #fff;
    position: fixed;
    top: 0;
    left: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    z-index: 1030;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sidebar nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.sidebar .sidebar-footer .nav-link {
    margin: 4px 16px;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.main-content {
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/*
 * Pages that omit includes/sidebar.php (payment bridge, gateway confirm/return,
 * mobile online payment, etc.) must not reserve sidebar space.
 */
body:not(:has(#mainSidebar)) .main-content {
    margin-left: 0;
}

body.sidebar-collapsed:not(:has(#mainSidebar)) .main-content {
    margin-left: 0;
}

/* Center standalone content on no-sidebar pages (auth & payment-response style themselves). */
body:not(:has(#mainSidebar)):not(.auth-page):not(.payment-response-page) .main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

body:not(:has(#mainSidebar)):not(.auth-page):not(.payment-response-page) .main-content > .row,
body:not(:has(#mainSidebar)):not(.auth-page):not(.payment-response-page) .main-content > .glass-card,
body:not(:has(#mainSidebar)):not(.auth-page):not(.payment-response-page) .main-content > .alert,
body:not(:has(#mainSidebar)):not(.auth-page):not(.payment-response-page) .main-content > #pageAlertArea {
    width: 100%;
    max-width: 960px;
}

/*
 * Mobile drawer — scoped to portal/student/home (#mainSidebar + #studentHomeSidebarOverlay only).
 * Other portals (staff, legacy student) use their own CSS and are unaffected.
 */
@media (max-width: 991.98px) {
    #mainSidebar.sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
        z-index: 1050;
    }

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

    #studentHomeSidebarOverlay {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 1040;
        display: none;
    }

    #studentHomeSidebarOverlay.show {
        display: block;
    }

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

    .mobile-top-bar {
        z-index: 1060;
    }
}

.sidebar.collapsed .sidebar-header h5,
.sidebar.collapsed .nav-link span:not(.material-symbols-outlined) {
    display: none;
}

/* Keep logout visible when collapsed (icon-only, same as other nav items) */
.sidebar.collapsed .sidebar-footer {
    display: block;
    margin-top: auto;
    padding-bottom: 0.75rem;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-footer hr {
    margin: 0.5rem 0.65rem;
    opacity: 0.12;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
}

/* Sidebar Nav */
.nav-link {
    color: #64748b;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 12px;
    margin: 4px 16px;
    transition: all 0.2s;
    text-decoration: none;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-link .material-symbols-outlined {
    font-size: 22px;
}

/* Modals above mobile drawer (1050) on student home pages only (this stylesheet) */
.modal-backdrop {
    z-index: 1070;
}
.modal {
    z-index: 1080;
}

/* Cards & Glassmorphism */
.glass-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
}

.stat-card {
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    border: 1px solid #f1f5f9;
}

/* Buttons */
.btn-gradient {
    background: var(--primary-gradient);
    border: none;
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.2);
}

.btn-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
    color: #fff;
}

/* Forms */
.form-control {
    border-radius: 12px;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.form-control:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Authentication Pages (login, register, forgot password) */
body.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem 1rem;
    background: linear-gradient(165deg, #eef2ff 0%, #f8fafc 42%, #e8eeff 100%);
}

body.auth-page.bg-login {
    background:
        radial-gradient(ellipse 80% 50% at 100% 0%, rgba(124, 58, 237, 0.12), transparent 55%),
        radial-gradient(ellipse 70% 45% at 0% 100%, rgba(79, 70, 229, 0.1), transparent 50%),
        linear-gradient(165deg, #eef2ff 0%, #f8fafc 45%, #e8eeff 100%);
}

body.auth-page .mobile-top-bar {
    display: none !important;
}

.auth-shell {
    width: 100%;
    max-width: 380px;
    position: relative;
    z-index: 2;
}

.auth-shell--wide {
    max-width: 520px;
}

.auth-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.1), 0 2px 8px rgba(15, 23, 42, 0.04);
    padding: 1.25rem 1.35rem;
    position: relative;
}

@media (min-width: 576px) {
    .auth-card {
        padding: 1.4rem 1.6rem;
    }
}

body.auth-page .glass-card.auth-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.1), 0 2px 8px rgba(15, 23, 42, 0.04);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.auth-brand {
    text-align: center;
    margin-bottom: 1rem;
}

.auth-brand img {
    max-height: 72px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.08));
}

@media (min-width: 576px) {
    .auth-brand img {
        max-height: 80px;
    }
}

.auth-brand h1,
.auth-brand .auth-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0.45rem 0 0;
    line-height: 1.3;
}

.auth-brand p,
.auth-brand .auth-subtitle {
    font-size: 0.8125rem;
    color: #64748b;
    margin: 0.2rem 0 0;
}

.auth-footer-link {
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: #64748b;
}

.auth-page .form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #475569;
}

.auth-page .form-control {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border-radius: 10px;
    background: #f8fafc;
    border-color: #e2e8f0;
}

.auth-page .form-control:focus {
    background: #ffffff;
}

.auth-page .input-group-text {
    padding: 0.45rem 0.6rem;
    border-radius: 10px;
    background: #f8fafc !important;
    border-color: #e2e8f0;
}

.auth-page .input-group .form-control {
    border-radius: 0 10px 10px 0;
}

.auth-page .input-group .input-group-text:first-child {
    border-radius: 10px 0 0 10px;
}

.auth-page .btn-gradient {
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    border-radius: 10px;
}

.auth-page .btn-light.btn-lg,
.auth-page .btn-gradient.btn-lg {
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
}

.auth-page .alert {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    margin-bottom: 0.75rem;
    border-radius: 10px;
}

.auth-page .form-step h5 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.auth-page .form-step > p.text-muted.small {
    margin-bottom: 0.75rem;
}

.auth-page .student-info-card {
    padding: 0.65rem 0.85rem !important;
    margin-bottom: 0.75rem !important;
    border-radius: 12px !important;
}

.auth-page .student-info-card .material-symbols-outlined {
    font-size: 32px !important;
}

.auth-page .student-info-card .fw-bold.fs-5 {
    font-size: 1rem !important;
}

.auth-page .step-indicator {
    margin-bottom: 1rem !important;
}

.auth-page .step-dot {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
}

.auth-page .otp-digit {
    width: 42px !important;
    height: 48px !important;
    max-width: 42px;
    font-size: 1.2rem !important;
    border-radius: 8px !important;
    border: 1.5px solid #cbd5e1 !important;
    background: #fff !important;
    padding: 0.25rem !important;
}

.auth-page .otp-digit:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12) !important;
}

.auth-page .chip-option {
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
}

.auth-page .loading-overlay {
    border-radius: 16px !important;
}

.auth-page #successMessage .material-symbols-outlined {
    font-size: 56px !important;
}

.auth-page #successMessage h3 {
    font-size: 1.25rem;
}

/* Legacy aliases */
.login-overlay {
    display: none;
}

/* Width helper only — do not override .auth-card surface */
.login-card.auth-card {
    width: 100%;
}

.reg-container {
    width: 100%;
    max-width: 520px;
    padding: 0;
}

.step-indicator {
    position: relative;
    display: flex;
    justify-content: space-between;
}

.step-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #e2e8f0;
    transform: translateY(-50%);
    z-index: 1;
}

.step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
    color: #94a3b8;

}

.step-dot.active {
    border-color: var(--primary);
    background: var(--primary-gradient);
    color: #fff;
}

.step-dot.completed {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

.chip-option {
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.chip-option:hover,
.chip-option.selected {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

/* Utilities */
.fw-600 {
    font-weight: 600;
}

.cursor-pointer {
    cursor: pointer;
}

.bg-primary-light {
    background-color: var(--primary-light);
}

.border-bottom-dashed {
    border-bottom: 1px dashed #e2e8f0;
}

.text-primary-grad {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}