﻿/* =========================================================
   Student Registration Page Styles
   Supports LTR & RTL automatically via [dir="rtl"] selector
   Focus: Clean card box layout, responsive steps, white buttons
   ========================================================= */

/* ---------- Root Theme Tokens ---------- */
:root {
    --color-primary: #6e59a4;
    --color-primary-rgb: 110, 89, 164;
    --color-primary-light: #8e76d9;
    --color-success: #2fa772;
    --color-danger: #d64d4d;
    --color-border: #e1e5e9;
    --color-text: #222;
    --color-muted: #555;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-card: 0 8px 28px rgba(0,0,0,0.08);
    --shadow-focus: 0 0 0 .15rem rgba(var(--color-primary-rgb), .28);
    --transition: .25s cubic-bezier(.4,.2,.2,1);
    --step-size: 44px;
    --content-max: 900px;
    --card-pad-desktop: 40px 42px 46px;
    --card-pad-mobile: 28px 24px 34px;
    font-family: 'Cairo', system-ui, Arial, sans-serif;
}

/* Provide the same tokens for RTL (can override if needed) */
[dir="rtl"] {
    --color-text: #222;
}

/* ---------- Global Layout Fixes ---------- */
html, body {
    height: auto;
    min-height: 100%;
    overflow-y: auto !important;
    scroll-behavior: smooth;
    background: #f5f6fa;
}

    body.login-page {
        overflow-y: auto !important;
    }

body {
    font-family: 'Cairo', system-ui, Arial, sans-serif;
    line-height: 1.45;
    color: var(--color-text);
}

/* ---------- Page Split (Image + Form) ---------- */
.form-page {
    display: flex;
    min-height: 100dvh;
    background: #f5f6fa;
}

.form-page__img {
    flex: 1 1 45%;
    max-width: 45%;
    position: relative;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

@media (max-width: 1200px) {
    .form-page__img {
        display: none !important;
    }
}

.form-page__content {
    flex: 1 1 55%;
    max-width: 55%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 50px 40px 80px;
    overflow-y: auto;
}

@media (max-width: 1200px) {
    .form-page__content {
        max-width: 100%;
        flex: 1;
        padding: 32px 18px 90px;
    }
}

/* ---------- Card Box Container ---------- */
.registration-card {
    width: 100%;
    max-width: var(--content-max);
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--card-pad-desktop);
    position: relative;
}

@media (max-width: 992px) {
    .registration-card {
        padding: var(--card-pad-mobile);
        border-radius: 14px;
    }
}

.registration-title {
    font-size: clamp(1.6rem, 2.2vw, 2.05rem);
    font-weight: 700;
    margin: 0;
    color: var(--color-text);
}

.muted-intro {
    margin: 8px 0 18px;
    font-size: .93rem;
    color: var(--color-muted);
    font-weight: 500;
}

[dir="rtl"] .registration-card {
    text-align: right;
}

/* ---------- Instructions Box ---------- */
.instructions {
    background: #f6f7fb;
    border: 1px solid #e4e6ef;
    border-radius: 14px;
    padding: 16px 18px 14px;
    margin-bottom: 26px;
}

    .instructions h5 {
        margin: 0 0 10px;
        font-size: 15px;
        font-weight: 700;
        color: var(--color-primary);
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .instructions ul {
        margin: 0;
        padding-inline-start: 18px;
        font-size: 12.6px;
        line-height: 1.55;
    }

    .instructions li {
        margin-bottom: 4px;
        color: var(--color-muted);
    }

/* ---------- Stepper ---------- */
.wizard-steps {
    display: flex;
    gap: 12px;
    margin: 10px 0 30px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
}

    .wizard-steps::-webkit-scrollbar {
        height: 6px;
    }

    .wizard-steps::-webkit-scrollbar-thumb {
        background: rgba(var(--color-primary-rgb), 0.45);
        border-radius: 10px;
    }

    .wizard-steps .step {
        flex: 0 0 var(--step-size);
        height: var(--step-size);
        width: var(--step-size);
        border-radius: 50%;
        background: #ece9f6;
        color: var(--color-primary);
        font-weight: 700;
        font-size: 15px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid #d5cdec;
        transition: var(--transition);
        position: relative;
        user-select: none;
    }

        .wizard-steps .step.active {
            background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
            color: #fff;
            border-color: var(--color-primary);
            box-shadow: 0 4px 14px rgba(var(--color-primary-rgb), 0.35);
            transform: translateY(-2px);
        }

        .wizard-steps .step.completed {
            background: #ffffff;
            color: var(--color-primary);
            border-color: var(--color-primary);
        }

/* ---------- Steps Content ---------- */
.form-step {
    display: none;
    animation: fadeStep .35s ease;
}

    .form-step.active {
        display: block;
    }

@keyframes fadeStep {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-step h4 {
    margin-top: 0;
    margin-bottom: 18px;
    font-size: 18px;
    display: flex;
    gap: 6px;
    align-items: center;
    font-weight: 600;
    color: var(--color-primary);
}

/* ---------- Form Inputs ---------- */
label.form-label {
    font-weight: 600;
    margin-bottom: 6px;
    color: #2d2d2d;
    font-size: 13.5px;
}

.form-control,
.form-select {
    border: 2px solid var(--color-border);
    border-radius: 11px;
    padding: 11px 14px;
    transition: var(--transition);
    font-size: 14px;
    background: #fff;
}

    .form-control:focus,
    .form-select:focus {
        border-color: var(--color-primary);
        box-shadow: var(--shadow-focus);
        outline: none;
    }

.form-check-input:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 .15rem rgba(var(--color-primary-rgb), .35);
    outline: none;
}

/* ---------- Subject & Teacher Selection ---------- */
.subject-selection {
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 14px 16px 12px;
    margin-bottom: 14px;
    cursor: pointer;
    background: #fff;
    transition: var(--transition);
}

    .subject-selection:hover {
        border-color: var(--color-primary);
        box-shadow: 0 4px 12px rgba(var(--color-primary-rgb), .18);
    }

    .subject-selection.selected {
        background: #f4f0ff;
        border-color: var(--color-primary);
    }

.teacher-option {
    border: 1px solid #dcdce3;
    border-radius: 9px;
    padding: 10px 12px;
    margin-bottom: 8px;
    transition: .18s;
    background: #fff;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

    .teacher-option:hover {
        background: #f3f0fa;
        border-color: var(--color-primary);
    }

    .teacher-option.selected {
        background: #ebe5fa;
        border-color: var(--color-primary);
        box-shadow: inset 0 0 0 2px var(--color-primary);
    }

/* ---------- Schedule Options ---------- */
#scheduleSelection > .schedule-item,
.schedule-options .form-check {
    border: 1px solid #e3e6ee;
    border-radius: 10px;
    padding: 10px 14px;
    background: #fff;
    transition: .2s;
}

    .schedule-options .form-check:not(:last-child) {
        margin-bottom: 10px;
    }

    .schedule-options .form-check:hover {
        border-color: var(--color-primary);
        background: #f7f4ff;
    }

.schedule-options .form-check-input:checked ~ label strong {
    color: var(--color-primary);
}

/* ---------- Alerts ---------- */
.alert {
    border-radius: 12px;
    border: 1px solid transparent;
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.45;
}

.alert-info {
    background: #f0f6ff;
    border-color: #c2defd;
    color: #2e4a66;
}

.alert-success {
    background: #e5fff2;
    border-color: #b9f3d7;
    color: #14633c;
}

.alert-danger {
    background: #ffe9ea;
    border-color: #ffc5ca;
    color: #892029;
}

/* ---------- Buttons (White Style) ---------- */
.btn-theme,
.btn-theme-secondary,
.btn-theme-success {
    border: 2px solid var(--color-primary);
    border-radius: 11px;
    padding: 13px 24px;
    font-size: 15px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition);
    background: #fff;
    color: var(--color-primary);
    position: relative;
    min-width: 140px;
    line-height: 1.1;
    text-decoration: none;
}

.btn-theme-success {
    border-color: var(--color-success);
    color: var(--color-success);
}

.btn-theme-secondary {
    border-color: #bdbdbd;
    color: #444;
}

.btn-theme:hover {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 6px 18px rgba(var(--color-primary-rgb), .35);
    transform: translateY(-2px);
}

.btn-theme-success:hover {
    background: var(--color-success);
    color: #fff;
    box-shadow: 0 6px 16px rgba(47, 167, 114, .35);
    transform: translateY(-2px);
}

.btn-theme-secondary:hover {
    background: #444;
    color: #fff;
}

.btn-theme:focus-visible,
.btn-theme-secondary:focus-visible,
.btn-theme-success:focus-visible {
    outline: none;
    box-shadow: 0 0 0 .2rem rgba(var(--color-primary-rgb), .35);
}

/* ---------- Navigation Buttons Wrapper ---------- */
.navigation-buttons {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 38px;
    flex-wrap: wrap;
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, rgb(0 0 0 / 97%) 65%, rgba(255, 255, 255, 0));
 
    padding: 18px 4px 6px;
    z-index: 20;
}

@media (max-width: 576px) {
    .navigation-buttons {
        gap: 10px;
    }

    .btn-theme,
    .btn-theme-secondary,
    .btn-theme-success {
        flex: 1;
        min-width: auto;
        padding: 12px 14px;
    }
}

/* ---------- Summary / Misc ---------- */
#registrationSummary {
    background: #faf9fd;
    border: 1px solid #e2deee;
    border-radius: 12px;
    padding: 18px 20px;
    font-size: 14px;
}

.security-note {
    margin-top: 26px;
    font-size: 11.5px;
    color: #666;
    text-align: center;
    opacity: .85;
}

#selectedSubjectsList .border {
    border: 1px solid #ddd !important;
    background: #fff;
}

/* ---------- Loading Overlay ---------- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17,16,29,.78);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.loading-spinner {
    background: #fff;
    padding: 34px 36px;
    border-radius: 18px;
    text-align: center;
    min-width: 260px;
    box-shadow: 0 10px 32px rgba(0,0,0,.25);
}

    .loading-spinner p {
        margin-top: 14px;
        font-size: 14px;
        color: var(--color-primary);
        font-weight: 600;
    }

.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: .35em;
}

/* ---------- Utilities ---------- */
.flex-grow-1 {
    flex-grow: 1;
}

.text-purple-1 {
    color: var(--color-primary);
}

.d-flex {
    display: flex;
}

.gap-4 {
    gap: 1rem;
}

[dir="rtl"] .d-flex {
    direction: rtl;
}

/* Make sure elements inside card never overflow horizontally */
.registration-card * {
    min-width: 0;
    box-sizing: border-box;
}

/* Accessibility focus for any interactive element */
.registration-card a:focus-visible,
.registration-card button:focus-visible,
.registration-card input:focus-visible,
.registration-card select:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
    border-color: var(--color-primary);
}

/* ---------- RTL Adjustments ---------- */
[dir="rtl"] .wizard-steps .step {
    font-size: 14px;
}

[dir="rtl"] .instructions ul {
    padding-inline-start: 22px; /* still inward */
}

[dir="rtl"] label.form-label {
    letter-spacing: .2px;
}

[dir="rtl"] .navigation-buttons {
    direction: rtl;
}

[dir="rtl"] .btn-theme i,
[dir="rtl"] .btn-theme-success i,
[dir="rtl"] .btn-theme-secondary i {
    order: 0;
}

/* Keep consistent white background on content area even if parent theme is dark */
.form-page__content,
.registration-card {
    background: #1c1c1c !important ;
}
.content-wrapper > section * {
    color: #ffffff !important;
    border-color: rgb(207 207 207 / 51%) !important;
}
