/* =========================================================
   Enrollment Modal — Premium Design
   ========================================================= */
/* ============ CRITICAL: force [hidden] to override display:flex ============ */
[hidden] {
    display: none !important;
}
.enroll-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(10, 22, 40, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: grid;
    place-items: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.enroll-modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
}

.enroll-modal-overlay.show ~ body,
body:has(.enroll-modal-overlay.show) {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

.enroll-modal {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px 28px 28px;
    border-radius: 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow:
        0 32px 64px rgba(10, 22, 40, 0.28),
        0 8px 24px rgba(10, 22, 40, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateY(20px) scale(0.96);
    transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
    scrollbar-width: thin;
}

.enroll-modal-overlay.show .enroll-modal {
    transform: translateY(0) scale(1);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .enroll-modal {
        background: linear-gradient(180deg, #111827 0%, #0B1220 100%);
        box-shadow:
            0 32px 64px rgba(0, 0, 0, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }
}

/* --- Close button --- */
.enroll-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.8);
    color: #475569;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.enroll-close:hover {
    background: #EF4444;
    color: #fff;
    transform: rotate(90deg);
}

/* --- Progress bar --- */
.enroll-progress {
    margin-bottom: 24px;
}
.enroll-progress-bar {
    height: 6px;
    background: #E2E8F0;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 12px;
}
.enroll-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1A4FD6, #0EA5E9, #38BDF8);
    border-radius: 999px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}
.enroll-steps {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    font-weight: 600;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.enroll-step.active {
    color: #1A4FD6;
}
.enroll-step.done {
    color: #10B981;
}

/* --- Header --- */
.enroll-header {
    text-align: center;
    margin-bottom: 24px;
}
.enroll-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(26, 79, 214, 0.1), rgba(14, 165, 233, 0.1));
    color: #1A4FD6;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 12px;
}
.enroll-header h2 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: #0F172A;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}
@media (prefers-color-scheme: dark) {
    .enroll-header h2 { color: #F1F5F9; }
}
.enroll-header p {
    color: #64748B;
    font-size: 0.9rem;
    margin: 0;
}

/* --- Form fields --- */
.enroll-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.enroll-step-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: enroll-slide-in 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.enroll-step-panel[hidden] {
    display: none !important;
}

@keyframes enroll-slide-in {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}

.enroll-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.enroll-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
}
@media (prefers-color-scheme: dark) {
    .enroll-field { color: #CBD5E1; }
}
.enroll-field > span {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.enroll-field .muted {
    color: #94A3B8;
    font-weight: 400;
    font-size: 0.78rem;
}
.enroll-field input,
.enroll-field select,
.enroll-field textarea {
    padding: 12px 14px;
    border: 1.5px solid #E2E8F0;
    border-radius: 12px;
    background: #fff;
    color: #0F172A;
    font: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
}
@media (prefers-color-scheme: dark) {
    .enroll-field input,
    .enroll-field select,
    .enroll-field textarea {
        background: #1F2937;
        border-color: #374151;
        color: #F1F5F9;
    }
}
.enroll-field input:focus,
.enroll-field select:focus,
.enroll-field textarea:focus {
    border-color: #1A4FD6;
    box-shadow: 0 0 0 4px rgba(26, 79, 214, 0.12);
    background: #fff;
}
@media (prefers-color-scheme: dark) {
    .enroll-field input:focus,
    .enroll-field select:focus,
    .enroll-field textarea:focus {
        background: #111827;
    }
}
.enroll-field.has-error input,
.enroll-field.has-error select {
    border-color: #EF4444;
    background: #FEF2F2;
}
.enroll-error {
    color: #EF4444;
    font-size: 0.78rem;
    font-weight: 500;
    min-height: 0;
    transition: min-height 0.2s ease;
}
.enroll-error:not(:empty) {
    min-height: 1em;
}

/* --- Review panel --- */
.enroll-review {
    padding: 16px;
    background: rgba(26, 79, 214, 0.04);
    border-radius: 14px;
    border: 1px dashed rgba(26, 79, 214, 0.24);
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.9rem;
}
.enroll-review-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}
.enroll-review-row:last-child { border-bottom: 0; padding-bottom: 0; }
.enroll-review-row .label { color: #64748B; font-weight: 500; }
.enroll-review-row .value { color: #0F172A; font-weight: 600; text-align: right; }
@media (prefers-color-scheme: dark) {
    .enroll-review-row .value { color: #F1F5F9; }
}

/* --- Checkbox --- */
.enroll-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    color: #475569;
    margin-top: 8px;
    cursor: pointer;
    font-weight: 400;
}
.enroll-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: #1A4FD6;
    flex-shrink: 0;
    cursor: pointer;
}
.enroll-checkbox a {
    color: #1A4FD6;
    text-decoration: underline;
}

/* --- Actions --- */
.enroll-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}
.btn-primary,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: inherit;
}
.btn-primary {
    background: linear-gradient(135deg, #1A4FD6, #0EA5E9);
    color: #fff;
    box-shadow: 0 8px 20px rgba(26, 79, 214, 0.3);
    min-width: 160px;
    margin-left: auto;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(26, 79, 214, 0.4);
}
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.btn-ghost {
    background: transparent;
    color: #64748B;
    border: 1px solid #E2E8F0;
}
.btn-ghost:hover {
    background: #F1F5F9;
    color: #0F172A;
}

/* --- Spinner --- */
.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: enroll-spin 0.7s linear infinite;
}
@keyframes enroll-spin {
    to { transform: rotate(360deg); }
}

/* --- Success state --- */
.enroll-success {
    text-align: center;
    padding: 12px 0;
    animation: enroll-slide-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.enroll-success[hidden] {
    display: none !important;
}

.enroll-success-icon {
    width: 88px;
    height: 88px;
    margin: 0 auto 20px;
}
.enroll-success-icon svg {
    width: 100%;
    height: 100%;
    stroke: #10B981;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}
.enroll-success-icon circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: enroll-draw 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}
.enroll-success-icon path {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: enroll-draw 0.5s cubic-bezier(0.65, 0, 0.45, 1) 0.4s forwards;
}
@keyframes enroll-draw {
    to { stroke-dashoffset: 0; }
}
.enroll-success h2 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.6rem;
    color: #0F172A;
    margin: 0 0 12px;
}
@media (prefers-color-scheme: dark) {
    .enroll-success h2 { color: #F1F5F9; }
}
.enroll-success p {
    color: #475569;
    margin: 0 0 8px;
    font-size: 0.95rem;
}
.enroll-success strong {
    font-family: 'JetBrains Mono', monospace;
    color: #1A4FD6;
    font-size: 1.05rem;
    background: rgba(26, 79, 214, 0.08);
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
    margin-top: 4px;
}
.enroll-success .btn-primary {
    margin: 20px auto 0;
    margin-left: auto;
    margin-right: auto;
}

/* --- Mobile --- */
@media (max-width: 560px) {
    .enroll-modal {
        padding: 28px 20px 20px;
        border-radius: 20px;
    }
    .enroll-field-row {
        grid-template-columns: 1fr;
    }
    .enroll-header h2 {
        font-size: 1.35rem;
    }
    .enroll-actions {
        flex-direction: column-reverse;
    }
    .enroll-actions .btn-primary,
    .enroll-actions .btn-ghost {
        width: 100%;
        margin-left: 0;
    }
}
