/* ============================================================================
   NEW CLEAN UI/UX - Main App Styles
   This file overrides old conflicting styles with a clean, simple approach
   ============================================================================ */

/* Main Content Area - Clean Simple Structure */
.app-main-content {
    margin-top: 73px !important;
    margin-left: 250px !important;
    padding: 24px !important;
    min-height: calc(100vh - 73px) !important;
    background: #f8fafc !important;
    overflow-y: auto !important;
    transition: margin-left 0.3s ease !important;
    position: relative !important;
}

/* Content Container - Wraps all sections */
.content-container {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100% !important;
}

/* Content Sections - SIMPLE show/hide system */
/* Override ALL old CSS rules with maximum specificity */
.app-main-content .content-container .content-section,
.content-container .content-section,
.app-main-content .content-section {
    display: none !important;
    width: 100% !important;
    position: relative !important;
    margin: 0 !important;
    padding: 0 !important;
    animation: fadeIn 0.3s ease !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Active section - ONLY this one is visible */
.app-main-content .content-container .content-section.active,
.content-container .content-section.active,
.app-main-content .content-section.active,
.content-section.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    pointer-events: auto !important;
}

/* Ensure hidden sections don't take space */
.app-main-content .content-container .content-section:not(.active),
.content-container .content-section:not(.active),
.app-main-content .content-section:not(.active),
.content-section:not(.active) {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Override any conflicting styles from old CSS */
.main-content {
    display: none !important; /* Hide old main-content class */
}

/* CRITICAL: Override ALL old content-section rules with maximum specificity */
#mainApp .content-section,
.app-main-content .content-section,
.content-container .content-section,
.content-section {
    /* Reset all old styles */
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Active section - show it */
#mainApp .content-section.active,
.app-main-content .content-section.active,
.content-container .content-section.active,
.content-section.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    pointer-events: auto !important;
}

/* SPECIAL: Results section fullscreen mode - override normal positioning */
/* Results section should always be fullscreen when active */
#results.content-section.active,
#results.content-section:not([style*="display: none"]) {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: #ffffff !important;
    z-index: 1050 !important;
    overflow-y: auto !important;
    padding: 20px !important;
    margin: 0 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    left: auto !important;
    top: auto !important;
}

/* Hide body overflow when results is active */
body:has(#results.content-section.active) {
    overflow: hidden !important;
}

/* Fee collection — fullscreen cashier workbench (covers sidebar + main chrome) */
#fees-collection.content-section.active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    width: 100dvw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    background: #f8fafc !important;
    /* Below Bootstrap modals (~1055) so payment dialogs stay on top */
    z-index: 1040 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

#fees-collection.content-section.active > .fc-fullscreen-topbar {
    flex: 0 0 auto !important;
    z-index: 2;
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px)) !important;
    padding-left: max(0.5rem, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(0.5rem, env(safe-area-inset-right, 0px)) !important;
}

#fees-collection.content-section.active > .fc-fullscreen-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px)) !important;
}

body:has(#fees-collection.content-section.active) {
    overflow: hidden !important;
}

/* Hamburger sits above default navbar; tuck it under fee collection fullscreen */
body:has(#fees-collection.content-section.active) .navbar-mobile-toggle {
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Override old CSS rules that might hide sections */
#mainApp .content-section:not(.active),
.app-main-content .content-section:not(.active),
.content-container .content-section:not(.active),
body.section-loaded .content-section:not(.active),
.content-section:not(.active) {
    display: none !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
}

/* Mobile Responsive */
@media (max-width: 767px) {
    .app-main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 16px !important;
        padding-left: max(16px, env(safe-area-inset-left)) !important;
        padding-right: max(16px, env(safe-area-inset-right)) !important;
        padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
    }

    .app-main-content .table-responsive {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
        scrollbar-color: rgba(100, 116, 139, 0.5) transparent;
    }
}

/* --------------------------------------------------------------------------
   Student modal — full-screen layout + Class Fee Setup–style wizard chrome
   (mirrors class-billing-wizard-modal in fees-main.js)
   -------------------------------------------------------------------------- */
#studentModal.modal {
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

#studentModal.student-modal-wizard-active.modal {
    padding: 0;
}

/* --------------------------------------------------------------------------
   Admissions portal wizard — split sidebar + main (reference UI)
   -------------------------------------------------------------------------- */
#studentModal .student-enrollment-modal {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#studentModal.student-modal-wizard-active .student-enrollment-modal {
    display: grid;
    grid-template-columns: minmax(200px, 26%) 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "sidebar head"
        "sidebar body"
        "sidebar foot";
}

#studentModal #studentAdmissionsSidebar {
    display: none;
}

#studentModal.student-modal-wizard-active #studentAdmissionsSidebar {
    display: flex;
    flex-direction: column;
    grid-area: sidebar;
    background: #1e293b;
    color: #e2e8f0;
    padding: 1.25rem 1rem 1.5rem;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    min-height: 0;
    overflow-y: auto;
}

#studentModal #studentAdmissionsMainHeader {
    display: none;
}

#studentModal.student-modal-wizard-active #studentAdmissionsMainHeader {
    display: block;
    grid-area: head;
    background: #fff;
    border-bottom: 1px solid #e8ecf2;
    padding: 1rem 1.25rem 0.85rem;
}

[data-bs-theme="dark"] #studentModal.student-modal-wizard-active #studentAdmissionsMainHeader {
    background: var(--bs-body-bg);
    border-bottom-color: var(--bs-border-color);
}

#studentModal.student-modal-wizard-active .student-wizard-modal-body {
    grid-area: body;
}

#studentModal.student-modal-wizard-active .student-wizard-modal-footer {
    grid-area: foot;
    background: #fff !important;
    border-top: 1px solid #e8ecf2;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0)) !important;
}

[data-bs-theme="dark"] #studentModal.student-modal-wizard-active .student-wizard-modal-footer {
    background: var(--bs-body-bg) !important;
    border-top-color: var(--bs-border-color);
}

#studentModal.student-modal-wizard-active .student-wizard-edit-hero {
    display: none !important;
}

#studentModal:not(.student-modal-wizard-active) #studentAdmissionsSidebar,
#studentModal:not(.student-modal-wizard-active) #studentAdmissionsMainHeader {
    display: none !important;
}

#studentModal:not(.student-modal-wizard-active) .student-wizard-edit-hero {
    display: flex;
}

#studentModal.student-modal-wizard-active .student-modal-fee-body {
    background: #fff;
}

[data-bs-theme="dark"] #studentModal.student-modal-wizard-active .student-modal-fee-body {
    background: var(--bs-body-bg);
}

#studentModal.student-modal-wizard-active .student-wizard-hide-in-admissions {
    display: none !important;
}

/* Sidebar brand */
#studentModal .sa-brand {
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#studentModal .sa-brand-title {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: #f4d03f;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

#studentModal .sa-brand-sub {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #94a3b8;
    margin-top: 0.35rem;
}

/* Vertical stepper */
#studentModal .sa-steps-list {
    position: relative;
    padding-left: 0;
}

#studentModal .sa-step {
    position: relative;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding-bottom: 1.35rem;
    list-style: none;
}

#studentModal .sa-step:last-child {
    padding-bottom: 0;
}

#studentModal .sa-step:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 1rem;
    top: 2.25rem;
    bottom: 0;
    width: 2px;
    background: rgba(148, 163, 184, 0.35);
    transform: translateX(-50%);
}

#studentModal .sa-step-num {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    background: #334155;
    color: #94a3b8;
    border: 2px solid #475569;
    z-index: 1;
}

#studentModal .sa-step.sew-step-active .sa-step-num {
    background: #f4d03f;
    color: #0f172a;
    border-color: #f4d03f;
    box-shadow: 0 0 0 4px rgba(244, 208, 63, 0.2);
}

#studentModal .sa-step.sew-step-done .sa-step-num {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.45);
}

#studentModal .sa-step-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    padding-top: 0.15rem;
}

#studentModal .sa-step-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #f1f5f9;
}

#studentModal .sa-step.sew-step-active .sa-step-title {
    color: #fff;
}

#studentModal .sa-step.sa-step-todo .sa-step-title {
    color: #94a3b8;
}

#studentModal .sa-step-desc {
    font-size: 0.68rem;
    color: #64748b;
    line-height: 1.3;
}

#studentModal .sa-step.sew-step-active .sa-step-desc {
    color: #cbd5e1;
}

/* Main header */
#studentModal .sa-main-header-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

#studentModal .sa-main-title {
    font-weight: 700;
    color: #0f2847;
    letter-spacing: -0.02em;
}

[data-bs-theme="dark"] #studentModal .sa-main-title {
    color: var(--bs-body-color);
}

#studentModal .sa-main-progress-track {
    height: 4px;
    background: #e8ecf2;
    border-radius: 4px;
    overflow: hidden;
}

[data-bs-theme="dark"] #studentModal .sa-main-progress-track {
    background: var(--bs-secondary-bg);
}

#studentModal .sa-main-progress-fill {
    height: 100%;
    width: 25%;
    background: #f4d03f;
    border-radius: 4px;
    transition: width 0.35s ease;
}

#studentModal[data-sw-step="2"] .sa-main-progress-fill {
    width: 50%;
}

#studentModal[data-sw-step="3"] .sa-main-progress-fill {
    width: 75%;
}

#studentModal[data-sw-step="4"] .sa-main-progress-fill {
    width: 100%;
}

#studentModal[data-sw-success="1"] .sa-main-progress-fill {
    width: 100%;
}

#studentModal .sa-id-badge {
    background: #f8fafc;
    border-color: #e2e8f0 !important;
    max-width: 100%;
}

[data-bs-theme="dark"] #studentModal .sa-id-badge {
    background: var(--bs-secondary-bg);
    border-color: var(--bs-border-color) !important;
}

#studentModal .sa-id-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f4d03f;
    flex-shrink: 0;
}

/* Step 1 sections (reference) */
#studentModal .sa-form-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #94a3b8;
    margin-bottom: 0.35rem;
}

#studentModal .sa-form-section-rule {
    height: 1px;
    background: linear-gradient(90deg, #e2e8f0, transparent);
    margin-bottom: 0.85rem;
}

[data-bs-theme="dark"] #studentModal .sa-form-section-rule {
    background: linear-gradient(90deg, var(--bs-border-color), transparent);
}

#studentModal .sa-photo-dropzone {
    position: relative;
    display: block;
    min-height: 7.5rem;
    border: 2px dashed #b8d4f5;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fbff 0%, #f0f6fc 100%);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

#studentModal .sa-photo-dropzone:hover {
    border-color: #6ea8fe;
    background: #f0f7ff;
    box-shadow: 0 4px 20px rgba(13, 110, 253, 0.08);
}

#studentModal .sa-photo-dropzone.sa-photo-dropzone--active {
    border-color: #0d6efd;
    background: #e7f1ff;
}

#studentModal .sa-photo-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

#studentModal .sa-photo-dropzone-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.25rem 1rem;
    pointer-events: none;
}

#studentModal .sa-photo-drop-icon {
    font-size: 1.75rem;
    color: #0d6efd;
    margin-bottom: 0.35rem;
    opacity: 0.85;
}

#studentModal .sa-photo-section .sw-photo-ring,
#studentModal .sa-photo-section .sw-photo-ring .sw-photo-img,
#studentModal .sa-photo-section .sw-photo-ring .sw-photo-placeholder {
    width: 5.5rem;
    height: 5.5rem;
}

#studentModal .sa-photo-section .sw-photo-placeholder .bi {
    font-size: 2rem;
}

@media (min-width: 992px) {
    #studentModal .sa-photo-section .sw-photo-ring,
    #studentModal .sa-photo-section .sw-photo-ring .sw-photo-img,
    #studentModal .sa-photo-section .sw-photo-ring .sw-photo-placeholder {
        width: 6.5rem;
        height: 6.5rem;
    }
}

#studentModal .sa-main-close {
    opacity: 0.55;
    margin-top: 0.15rem;
}

#studentModal .sa-main-close:hover {
    opacity: 1;
}

/* Guardian wizard — parent phone lookup */
#studentModal .wizard-parent-lookup-results .wizard-parent-pick-card {
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

#studentModal .wizard-parent-lookup-results .wizard-parent-pick-card:hover {
    border-color: rgba(13, 110, 253, 0.35) !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

@media (max-width: 767.98px) {
    #studentModal.student-modal-wizard-active .student-enrollment-modal {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto;
        grid-template-areas:
            "sidebar"
            "head"
            "body"
            "foot";
    }

    #studentModal #studentAdmissionsSidebar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.75rem 1rem;
        padding: 0.85rem 1rem;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    #studentModal .sa-brand {
        flex: 1 1 100%;
        margin-bottom: 0.5rem;
        padding-bottom: 0.65rem;
    }

    #studentModal .sa-steps-list {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        width: 100%;
        justify-content: space-between;
        gap: 0.35rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.25rem;
    }

    #studentModal .sa-step {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding-bottom: 0;
        flex: 1 1 0;
        min-width: 4.25rem;
    }

    #studentModal .sa-step:not(:last-child)::before {
        display: none;
    }

    #studentModal .sa-step-text {
        padding-top: 0.35rem;
    }

    #studentModal .sa-step-title {
        font-size: 0.62rem;
    }

    #studentModal .sa-step-desc {
        display: none;
    }

    #studentModal .sa-step-num {
        width: 1.65rem;
        height: 1.65rem;
        font-size: 0.7rem;
    }
}

.student-wizard-dialog.modal-fullscreen {
    margin: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 100dvh;
    max-height: 100dvh;
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.student-wizard-dialog.modal-fullscreen .modal-content {
    min-height: 100%;
    max-height: 100dvh;
    height: 100%;
}

.student-wizard-dialog .modal-header {
    flex-shrink: 0;
}

/* Add-student wizard: lock to viewport; edit mode: allow body scroll */
#studentModal.student-modal-wizard-active .student-wizard-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-left: max(0.5rem, env(safe-area-inset-left));
    padding-right: max(0.5rem, env(safe-area-inset-right));
    -webkit-overflow-scrolling: touch;
}

#studentModal:not(.student-modal-wizard-active) .student-wizard-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    -webkit-overflow-scrolling: touch;
}

#studentModal.student-modal-wizard-active .student-wizard-panes {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#studentModal:not(.student-modal-wizard-active) .student-wizard-panes {
    display: block;
    flex: none;
    min-height: auto;
}

#studentModal:not(.student-modal-wizard-active) .student-wizard-pane {
    flex: none !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
}

#studentModal:not(.student-modal-wizard-active) .student-wizard-pane .h-100,
#studentModal:not(.student-modal-wizard-active) .student-wizard-fill-card.h-100 {
    height: auto !important;
}

/* Visible wizard step fills space between chrome and footer */
#studentModal.student-modal-wizard-active .student-wizard-pane:not(.d-none) {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

#studentModal.student-modal-wizard-active .student-wizard-fill-card {
    min-height: 0;
}

/* Step 1: keep fields + photo on one screen (row fits height) */
#studentModal.student-modal-wizard-active .student-wizard-step1-grid {
    flex: 1 1 auto;
    min-height: 0;
    align-content: start;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

@media (max-width: 991.98px) {
    #studentModal.student-modal-wizard-active .sw-enroll-step1-grid .col-lg-7 {
        order: 1;
    }
    #studentModal.student-modal-wizard-active .sw-enroll-step1-grid .col-lg-5 {
        order: 0;
    }
}

/* Guardian step: scroll the whole step (lookup + form) so relationship isn’t trapped in a tiny inner pane */
#studentModal.student-modal-wizard-active .student-wizard-guardian-body {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

#studentModal.student-modal-wizard-active .student-wizard-guardian-grid {
    align-content: start;
    flex: 0 0 auto;
    min-height: 0;
}

/* Keep long parent lookup lists from consuming the whole viewport */
#studentModal .wizard-parent-lookup-results {
    max-height: min(40vh, 16rem);
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Review / success: scroll inside step only when content exceeds viewport */
#studentModal.student-modal-wizard-active .student-wizard-review-column {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

@media (max-height: 700px) {
    #studentModal.student-modal-wizard-active .student-wizard-edit-hero .modal-title {
        font-size: 1rem;
    }
    #studentModal.student-modal-wizard-active .sa-main-title {
        font-size: 1.05rem;
    }
    #studentModal.student-modal-wizard-active .sa-step:not(:last-child) {
        padding-bottom: 0.85rem;
    }
    #studentModal.student-modal-wizard-active .sa-step-num {
        width: 1.65rem;
        height: 1.65rem;
        font-size: 0.72rem;
    }
    #studentModal.student-modal-wizard-active .sa-photo-section .sw-photo-ring,
    #studentModal.student-modal-wizard-active .sa-photo-section .sw-photo-ring .sw-photo-img,
    #studentModal.student-modal-wizard-active .sa-photo-section .sw-photo-ring .sw-photo-placeholder {
        width: 4.5rem !important;
        height: 4.5rem !important;
    }
    #studentModal.student-modal-wizard-active .sa-photo-section .sw-photo-placeholder .bi {
        font-size: 1.5rem !important;
    }
}


/* Hero header — same gradient as Class Fee Setup */
#studentModal .student-modal-fee-hero {
    background: linear-gradient(135deg, #0d6efd 0%, #6f42c1 55%, #d63384 100%);
}

/* Body wash — matches fee wizard modal-body */
#studentModal .student-modal-fee-body {
    background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
}

[data-bs-theme="dark"] #studentModal .student-modal-fee-body {
    background: var(--bs-body-bg);
}

/* Form labels — bold for quick scanning */
#studentModal .student-enrollment-modal .form-label,
#studentModal .student-enrollment-modal label.col-form-label {
    font-weight: 700;
    color: var(--bs-body-color);
}

#studentModal .student-enrollment-modal .form-label.small,
#studentModal .student-enrollment-modal label.sw-enroll-label {
    font-weight: 700;
}

/* Inputs & selects — light green fill so fields are easy to spot */
#studentModal .student-enrollment-modal .form-control,
#studentModal .student-enrollment-modal .form-select {
    background-color: #ecfdf5;
    border-color: #bbf7d0;
    color: var(--bs-body-color);
}

#studentModal .student-enrollment-modal .form-control::placeholder {
    color: #64748b;
    opacity: 1;
}

#studentModal .student-enrollment-modal .form-control:focus,
#studentModal .student-enrollment-modal .form-select:focus {
    background-color: #f0fdf4;
    border-color: #22c55e;
    box-shadow: 0 0 0 0.2rem rgba(34, 197, 94, 0.22);
    color: var(--bs-body-color);
}

#studentModal .student-enrollment-modal .form-control:hover:not(:disabled):not([readonly]),
#studentModal .student-enrollment-modal .form-select:hover:not(:disabled) {
    border-color: #86efac;
}

#studentModal .student-enrollment-modal .input-group .form-control {
    background-color: #ecfdf5;
}

#studentModal .student-enrollment-modal .input-group:focus-within .form-control {
    border-color: #22c55e;
}

[data-bs-theme="dark"] #studentModal .student-enrollment-modal .form-control,
[data-bs-theme="dark"] #studentModal .student-enrollment-modal .form-select {
    background-color: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.4);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] #studentModal .student-enrollment-modal .form-control:focus,
[data-bs-theme="dark"] #studentModal .student-enrollment-modal .form-select:focus {
    background-color: rgba(34, 197, 94, 0.2);
    border-color: #4ade80;
    box-shadow: 0 0 0 0.2rem rgba(74, 222, 128, 0.18);
}

[data-bs-theme="dark"] #studentModal .student-enrollment-modal .form-control::placeholder {
    color: #94a3b8;
}

/* Step pills — same behavior as .cb-step-pill */
#studentModal .sew-step-pill {
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

#studentModal .sew-step-pill.sew-step-active {
    background: linear-gradient(135deg, #0d6efd, #6f42c1) !important;
    color: #fff !important;
    box-shadow: 0 0.25rem 0.75rem rgba(13, 110, 253, 0.35);
}

#studentModal .sew-step-pill.sew-step-done {
    background: #e7f1ff !important;
    color: #0d6efd !important;
    border: 1px solid rgba(13, 110, 253, 0.25);
}

#studentModal .sew-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    font-size: 0.75rem;
    margin-right: 0.25rem;
    background: rgba(255, 255, 255, 0.25);
}

#studentModal .sew-step-pill.sew-step-active .sew-step-num {
    background: rgba(255, 255, 255, 0.3);
}

#studentModal .sew-step-pill.sew-step-done .sew-step-num {
    background: rgba(13, 110, 253, 0.15);
    color: #0d6efd;
}

#studentModal .sew-step-pill.text-muted.bg-light .sew-step-num {
    background: #dee2e6;
    color: #6c757d;
}

.student-wizard-photo {
    max-width: 220px;
}

/* Default photo size (edit mode / non–step-1 contexts) */
#studentModal .sw-photo-ring {
    position: relative;
    width: 140px;
    height: 140px;
    margin-left: auto;
    margin-right: auto;
}

#studentModal .sw-photo-ring .sw-photo-img,
#studentModal .sw-photo-placeholder {
    position: absolute;
    inset: 0;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    margin: auto;
}

#studentModal .sw-photo-img {
    object-fit: cover;
    border: 3px solid #dbe6f5;
    box-shadow: 0 8px 24px rgba(13, 110, 253, 0.12);
}

#studentModal .sw-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px dashed #dbe6f5;
    background: #f3f7ff;
    color: var(--bs-secondary-color);
}

#studentModal .sw-photo-placeholder .bi {
    font-size: 3.25rem;
    opacity: 0.55;
}

/* --------------------------------------------------------------------------
   Step 1 enrollment — responsive grid: fields (main) + photo panel (sidebar)
   -------------------------------------------------------------------------- */
#studentModal .sw-enroll-step1-grid {
    --sw-enroll-photo-max: 13.5rem;
}

#studentModal .sw-enroll-photo-panel {
    max-width: var(--sw-enroll-photo-max);
    width: 100%;
}

#studentModal .sw-enroll-card-step1 .student-wizard-photo {
    max-width: 100%;
}

#studentModal .sw-enroll-photo-file {
    width: 100%;
    max-width: 100%;
}

#studentModal .sw-enroll-card-step1 .sw-enroll-label {
    font-size: 0.8rem;
    margin-bottom: 0.2rem;
}

#studentModal .sw-enroll-card-step1 .sw-photo-ring {
    width: 5.25rem;
    height: 5.25rem;
    margin-left: auto;
    margin-right: auto;
}

#studentModal .sw-enroll-card-step1 .sw-photo-ring .sw-photo-img,
#studentModal .sw-enroll-card-step1 .sw-photo-ring .sw-photo-placeholder {
    width: 5.25rem;
    height: 5.25rem;
}

#studentModal .sw-enroll-card-step1 .sw-photo-placeholder .bi {
    font-size: 1.85rem;
}

@media (min-width: 576px) {
    #studentModal .sw-enroll-card-step1 .sw-photo-ring,
    #studentModal .sw-enroll-card-step1 .sw-photo-ring .sw-photo-img,
    #studentModal .sw-enroll-card-step1 .sw-photo-ring .sw-photo-placeholder {
        width: 6rem;
        height: 6rem;
    }

    #studentModal .sw-enroll-card-step1 .sw-photo-placeholder .bi {
        font-size: 2.15rem;
    }
}

@media (min-width: 992px) {
    #studentModal .sw-enroll-card-step1 .sw-photo-ring,
    #studentModal .sw-enroll-card-step1 .sw-photo-ring .sw-photo-img,
    #studentModal .sw-enroll-card-step1 .sw-photo-ring .sw-photo-placeholder {
        width: 7.25rem;
        height: 7.25rem;
    }

    #studentModal .sw-enroll-card-step1 .sw-photo-placeholder .bi {
        font-size: 2.6rem;
    }
}

@media (min-width: 1200px) {
    #studentModal .sw-enroll-card-step1 .form-select-sm,
    #studentModal .sw-enroll-card-step1 .form-control-sm {
        min-height: 2.375rem;
        padding-top: 0.375rem;
        padding-bottom: 0.375rem;
        font-size: 1rem;
    }

    #studentModal .sw-enroll-card-step1 .sw-enroll-input-main {
        min-height: 2.375rem;
        font-size: 1rem;
        padding: 0.375rem 0.75rem;
    }

    #studentModal .sw-enroll-card-step1 .input-group-sm > .form-control,
    #studentModal .sw-enroll-card-step1 .input-group-sm > .btn {
        padding-top: 0.375rem;
        padding-bottom: 0.375rem;
        font-size: 1rem;
    }
}

/* Wizard add flow: keep compact controls on large screens (avoid oversized fields) */
@media (min-width: 1200px) {
    #studentModal.student-modal-wizard-active .sw-enroll-card-step1 .form-select-sm,
    #studentModal.student-modal-wizard-active .sw-enroll-card-step1 .form-control-sm,
    #studentModal.student-modal-wizard-active .sw-enroll-card-step1 .sw-enroll-input-main,
    #studentModal.student-modal-wizard-active .sw-enroll-card-step1 .input-group-sm > .form-control,
    #studentModal.student-modal-wizard-active .sw-enroll-card-step1 .input-group-sm > .btn {
        min-height: calc(1.5em + 0.5rem + 2px);
        font-size: 0.875rem;
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }

    #studentModal.student-modal-wizard-active .sw-enroll-card-step1 .sw-enroll-input-main {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Slightly tighter modal body on small screens so step 1 fits better */
@media (max-width: 767.98px) {
    #studentModal .student-modal-fee-body {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
}

#studentModal .sw-review-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bs-secondary-color);
    margin-bottom: 0.15rem;
}

#studentModal .sw-review-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--bs-body-color);
    word-break: break-word;
}

/* Enrollment review (step 4) — dense layout to reduce scrolling */
#studentModal.student-modal-wizard-active[data-sw-step="4"] .student-modal-fee-body {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

#studentModal .sw-review-step-pane .sw-review-section-title {
    font-size: 0.65rem;
    margin-bottom: 0.25rem !important;
}

#studentModal .sw-review-step-pane .sw-review-merged-body {
    padding: 0.5rem 0.65rem !important;
}

#studentModal .sw-review-step-pane .sw-review-label {
    font-size: 0.58rem;
    font-weight: 700;
    margin-bottom: 0.05rem;
}

#studentModal .sw-review-step-pane .sw-review-value {
    font-size: 0.8rem;
    line-height: 1.25;
}

#studentModal .sew-success-card {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.1), rgba(13, 110, 253, 0.05));
    border: 1px solid rgba(25, 135, 84, 0.35) !important;
}

#studentModal .sw-success-icon {
    width: 2.25rem;
    height: 2.25rem;
    background: var(--bs-success);
    color: #fff;
    font-size: 1.1rem;
}

#studentModal .sw-portal-login {
    padding: 0.5rem 0.75rem;
    background: var(--bs-body-bg);
    border-radius: 0.5rem;
    border: 1px solid var(--bs-border-color);
}

/* Legacy pill steps (if used elsewhere) */
.student-wizard-steps .student-wizard-step {
    display: block;
    width: 100%;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    cursor: default;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.student-wizard-steps .student-wizard-step.active {
    border-color: var(--bs-primary);
    background: rgba(13, 110, 253, 0.07);
    color: var(--bs-primary);
    font-weight: 600;
}

.student-wizard-steps .student-wizard-step.text-muted:not(.active) {
    opacity: 0.85;
}

@media (max-width: 575.98px) {
    .student-wizard-dialog.modal-fullscreen .modal-footer .btn {
        min-height: 44px;
    }
}

/* --------------------------------------------------------------------------
   Student profile — Parent tab (split layout, no Bootstrap cards)
   -------------------------------------------------------------------------- */
.sbapro-student-parent-tab {
    width: 100%;
    max-width: 100%;
    margin: 0;
}

.sbapro-student-parent-tab__intro {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.sbapro-student-parent-tab__title {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin: 0 0 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sbapro-student-parent-tab__title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.12), rgba(99, 102, 241, 0.08));
    color: #0d6efd;
    font-size: 1.1rem;
}

.sbapro-student-parent-tab__lede {
    font-size: 0.875rem;
    line-height: 1.55;
    color: #64748b;
    margin: 0;
    max-width: 52rem;
}

.sbapro-parent-split-wrap {
    margin-bottom: 2rem;
}

.sbapro-parent-split-wrap:last-child {
    margin-bottom: 0;
}

.sbapro-parent-split-wrap + .sbapro-parent-split-wrap {
    padding-top: 2rem;
    margin-top: 0;
    border-top: 1px solid rgba(15, 23, 42, 0.07);
}

/* True half-page split: flex 50% / 50% (no reliance on Bootstrap grid) */
.sbapro-parent-bs-split {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.09);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 8px 24px -8px rgba(15, 23, 42, 0.12);
    background: #fff;
    min-height: 300px;
}

@media (min-width: 768px) {
    .sbapro-parent-bs-split {
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .sbapro-parent-half {
        flex: 0 0 50%;
        width: 50%;
        max-width: 50%;
        min-width: 0;
    }
}

@media (max-width: 767.98px) {
    .sbapro-parent-half {
        flex: 1 1 auto;
        width: 100%;
        max-width: 100%;
    }
}

.sbapro-parent-bs-col {
    min-height: 0;
    min-width: 0;
}

.sbapro-parent-bs-col--left {
    background: linear-gradient(165deg, #f8fafc 0%, #f1f5f9 55%, #eef2f7 100%);
}

@media (min-width: 768px) {
    .sbapro-parent-bs-col--left {
        border-right: 1px solid rgba(15, 23, 42, 0.1);
    }
}

@media (max-width: 767.98px) {
    .sbapro-parent-bs-col--left {
        border-bottom: 1px solid rgba(15, 23, 42, 0.1);
    }
}

.sbapro-parent-bs-col--right {
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
}

@media (min-width: 768px) {
    .sbapro-parent-bs-col--right {
        box-shadow: inset 3px 0 0 #0d6efd;
    }
}

@media (max-width: 767.98px) {
    .sbapro-parent-bs-col--right {
        box-shadow: inset 0 3px 0 #0d6efd;
    }
}

.sbapro-parent-bs-col-head {
    flex-shrink: 0;
    padding: 0.65rem 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
}

.sbapro-parent-bs-col-head--left {
    background: rgba(15, 23, 42, 0.06);
    color: #334155;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.sbapro-parent-bs-col-head--right {
    background: linear-gradient(90deg, rgba(13, 110, 253, 0.1), rgba(99, 102, 241, 0.06));
    color: #1e40af;
    border-bottom: 1px solid rgba(13, 110, 253, 0.15);
}

.sbapro-parent-col-inner {
    padding: 1.5rem 1.35rem 1.65rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

@media (min-width: 992px) {
    .sbapro-parent-col-inner {
        padding: 1.65rem 1.65rem 1.85rem;
    }
}

.sbapro-parent-identity {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1.35rem;
}

.sbapro-parent-avatar {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #0d6efd, #6366f1);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.35);
}

.sbapro-parent-identity-text {
    min-width: 0;
}

.sbapro-parent-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin: 0 0 0.35rem;
}

.sbapro-parent-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
}

.sbapro-parent-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.06);
    color: #475569;
}

.sbapro-parent-pill--primary {
    background: rgba(13, 110, 253, 0.12);
    color: #0d4ed8;
}

.sbapro-parent-info-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.sbapro-parent-info-row {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
}

.sbapro-parent-info-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(15, 23, 42, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.95rem;
}

.sbapro-parent-info-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
    margin-bottom: 0.15rem;
}

.sbapro-parent-info-value {
    font-size: 0.9rem;
    color: #1e293b;
    line-height: 1.45;
    word-break: break-word;
}

.sbapro-parent-portal-current {
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.sbapro-parent-portal-current-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.35rem 0.75rem;
    margin-bottom: 0.65rem;
}

.sbapro-parent-portal-current-row:last-child {
    margin-bottom: 0;
}

.sbapro-parent-portal-k {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}

.sbapro-parent-portal-user {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85rem;
    font-weight: 500;
    color: #0f172a;
    background: #fff;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.sbapro-parent-pwd-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 500;
}

.sbapro-parent-pwd-status--ok {
    color: #0f5132;
}

.sbapro-parent-pwd-status--no {
    color: #64748b;
}

.sbapro-parent-instructions {
    font-size: 0.78rem;
    line-height: 1.55;
    color: #64748b;
    margin: 0 0 1rem;
    padding: 0.65rem 0.75rem;
    background: rgba(13, 110, 253, 0.04);
    border-radius: 8px;
    border-left: 3px solid rgba(13, 110, 253, 0.35);
}

.sbapro-parent-instructions ol {
    margin: 0;
    padding-left: 1.15rem;
}

.sbapro-parent-instructions li {
    margin-bottom: 0.35rem;
}

.sbapro-parent-instructions li:last-child {
    margin-bottom: 0;
}

.sbapro-parent-portal-form .form-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.3rem;
}

.sbapro-parent-portal-form .form-control {
    border-radius: 8px;
    border-color: rgba(15, 23, 42, 0.12);
    font-size: 0.875rem;
}

.sbapro-parent-portal-form .form-control:focus {
    border-color: rgba(13, 110, 253, 0.55);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.12);
}

.sbapro-parent-save-btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 0.45rem 1.1rem;
    margin-top: 0.25rem;
}

.sbapro-parent-empty,
.sbapro-parent-loading {
    text-align: center;
    padding: 2.5rem 1.25rem;
    border-radius: 14px;
    border: 1px dashed rgba(15, 23, 42, 0.12);
    background: linear-gradient(180deg, #fafbfc, #f8fafc);
    color: #64748b;
}

.sbapro-parent-empty strong {
    color: #334155;
}

/* --------------------------------------------------------------------------
   Admin — Parents & portal (directory ~65% + manual link)
   -------------------------------------------------------------------------- */
#admin-parents .admin-parents-split {
    align-items: stretch;
}

@media (min-width: 992px) {
    #admin-parents .admin-parents-split {
        flex-wrap: nowrap;
    }

    #admin-parents .admin-parents-directory-wrap {
        flex: 0 0 65%;
        max-width: 65%;
        min-width: 0;
    }

    #admin-parents .admin-parents-manual-wrap {
        flex: 0 0 35%;
        max-width: 35%;
        min-width: 0;
    }
}

#admin-parents .admin-parents-directory-card {
    border-radius: 12px;
    overflow: hidden;
}

#admin-parents .admin-parents-table-wrap {
    max-height: min(70vh, 36rem);
    overflow: auto;
}

#admin-parents .admin-parents-table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    font-weight: 600;
    white-space: nowrap;
    border-bottom-width: 1px;
}

#admin-parents .admin-parents-table tbody td {
    vertical-align: middle;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

#admin-parents .admin-parents-table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.04);
}

#admin-parents .admin-parents-actions-col {
    min-width: 9.5rem;
}

#admin-parents .admin-parents-links-line {
    line-height: 1.35;
    max-width: 28rem;
}

@media (max-width: 575.98px) {
    #admin-parents .admin-parents-actions-col {
        min-width: 7rem;
    }
}

