/**
 * Enrollment wizard — extends auth-recovery.css (chem-bg, tokens)
 */

.enroll-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 140px var(--space-3) var(--space-6);
    position: relative;
    z-index: 1;
}

.enroll-card {
    background: var(--eman-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-elevated);
    width: 100%;
    max-width: 900px;
    overflow: visible;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--eman-border);
    position: relative;
    z-index: 2;
}

html[dir="rtl"] .enroll-card { direction: rtl; text-align: right; }
html[dir="ltr"] .enroll-card { direction: ltr; text-align: left; }

.stepper-header {
    background: linear-gradient(135deg, #fdfbfd, #f4eff9);
    padding: 40px 30px 30px;
    text-align: center;
    border-bottom: 1px solid var(--eman-border-light);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stepper-logo { width: 70px; margin-bottom: 15px; }
.stepper-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 5px; color: var(--eman-purple); }
.stepper-subtitle { font-size: 0.95rem; color: var(--eman-text-light); }

.steps-container {
    display: flex;
    justify-content: space-between;
    padding: 0 40px;
    margin-top: 35px;
    position: relative;
}

.enroll-card .step-item {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}

.enroll-card .step-item.active { opacity: 1; }
.enroll-card .step-item.completed .step-circle {
    background: var(--eman-success);
    border-color: var(--eman-success);
    color: #fff;
}

.step-circle {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--eman-bg);
    border: 2px solid var(--eman-border-light);
    color: var(--eman-text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 14px;
}

.enroll-card .active .step-circle {
    background: var(--eman-purple);
    color: #fff;
    border-color: var(--eman-purple);
    box-shadow: var(--shadow-card);
}

.step-label { font-size: 0.85rem; font-weight: 700; color: var(--eman-text-dark); }

.steps-line {
    position: absolute;
    top: 18px;
    left: 60px;
    right: 60px;
    height: 2px;
    background: var(--eman-border-light);
    z-index: 1;
}

.steps-progress {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    background: var(--eman-success);
    width: 0%;
    transition: width 0.4s ease;
}

.mobile-progress-container {
    display: none;
    margin-top: 20px;
    text-align: center;
}

.mobile-progress-text {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--eman-purple);
    margin-bottom: 5px;
}

.mobile-progress-bar {
    height: 6px;
    background: var(--eman-border-light);
    border-radius: var(--radius-pill);
    overflow: hidden;
    width: 100%;
}

.mobile-progress-fill {
    height: 100%;
    background: var(--eman-purple);
    width: 0%;
    transition: width 0.4s ease;
}

.enroll-card .form-content {
    padding: 40px 50px;
    min-height: 420px;
    position: relative;
    z-index: 2;
}

/* Keep inactive steps in the document. display:none on iOS Safari
   drops file inputs, radio state and the last typed value, then leaves
   a ghost keyboard layer that swallows taps on the review/terms step. */
.enroll-card .tab-pane {
    display: block;
    visibility: hidden;
    position: absolute;
    inset-inline-start: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
    opacity: 0;
    transform: none;
}

.enroll-card .tab-pane.active {
    visibility: visible;
    position: relative;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    pointer-events: auto;
    opacity: 1;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--eman-text-dark);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 2px solid var(--eman-border-light);
    padding-bottom: 15px;
}

.section-title .icon {
    color: var(--eman-purple);
    background: rgba(106, 27, 154, 0.08);
    padding: 8px;
    border-radius: var(--radius-sm);
}

.enroll-card .form-group { margin-bottom: 20px; text-align: start; }

.enroll-card .form-label {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 8px;
    display: block;
    color: var(--eman-text-dark);
}

.enroll-card .form-control {
    width: 100%;
    height: 52px;
    padding: 0 15px;
    border: 2px solid var(--eman-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    background: var(--eman-bg);
    color: var(--eman-text-dark);
}

.enroll-card input[type="email"],
.enroll-card input[type="password"],
.enroll-card input[type="tel"],
.enroll-card #nationalId {
    text-align: left;
    direction: ltr;
    font-family: 'Work Sans', sans-serif;
}

.enroll-card .form-control:focus {
    border-color: var(--input-focus);
    box-shadow: var(--focus-ring);
    outline: none;
}

.enroll-card .form-control.is-invalid {
    border-color: var(--eman-error);
    background-color: var(--eman-error-bg);
}

.enroll-card .form-control.is-valid {
    border-color: var(--eman-success);
    background-color: var(--eman-success-bg);
}

.enroll-card .text-danger {
    color: var(--eman-error);
    font-size: 0.8rem;
    margin-top: 5px;
    display: block;
    font-weight: 600;
}

.enroll-card select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 15px center;
    background-size: 16px;
}

.gender-options { display: flex; gap: 15px; flex-wrap: wrap; }
.gender-options.is-invalid .gender-card { border-color: var(--eman-error); }
.gender-label { flex: 1; cursor: pointer; position: relative; }

.gender-card {
    border: 2px solid var(--eman-border);
    border-radius: var(--radius-md);
    padding: 15px;
    text-align: center;
    background: var(--eman-bg);
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0.7;
}

.gender-card i { width: 32px; height: 32px; }
.gender-card span { font-weight: 700; font-size: 0.9rem; }

.gender-input:checked + .gender-card {
    border-color: var(--eman-purple);
    background: rgba(106, 27, 154, 0.04);
    opacity: 1;
    box-shadow: var(--shadow-card);
}

.gender-input:checked + .gender-card i { color: var(--eman-purple); }

.gender-card small {
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--eman-text-light);
    line-height: 1.4;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--eman-text-light);
    margin: -4px 0 12px;
}

.nid-upload { display: block; cursor: pointer; position: relative; }
.nid-upload input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}
.nid-upload__box {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    border: 2px dashed var(--eman-border);
    border-radius: var(--radius-md);
    background: var(--eman-bg);
    overflow: hidden;
    padding: 12px;
}
.nid-upload__hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--eman-text-light);
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
}
.nid-upload__hint i { width: 28px; height: 28px; }
.nid-upload__box img {
    max-height: 160px;
    max-width: 100%;
    border-radius: 8px;
    object-fit: contain;
}

#major-group {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    margin-bottom: 0 !important;
    transition: max-height 0.35s ease, opacity 0.35s ease, margin 0.35s ease;
}

#major-group.is-visible {
    max-height: 120px;
    opacity: 1;
    margin-bottom: 20px !important;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 25px;
    border-top: 1px solid var(--eman-border-light);
}

html[dir="rtl"] .form-actions { flex-direction: row-reverse; }
html[dir="ltr"] .form-actions { flex-direction: row; }

.btn-nav {
    padding: 12px 35px;
    border-radius: var(--radius-md);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    font-size: 1rem;
    font-family: inherit;
}

.btn-next {
    background: var(--eman-purple);
    color: #fff;
    box-shadow: var(--shadow-card);
}

.btn-next:hover:not(:disabled) {
    background: var(--eman-purple-dark);
    transform: translateY(-2px);
}

.btn-next:disabled {
    background: var(--eman-border-light);
    color: var(--eman-text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-prev {
    background: var(--eman-bg);
    color: var(--eman-text-dark);
    border: 2px solid var(--eman-border);
}

.btn-prev:hover { background: var(--eman-bg-light); }

.review-box {
    background: var(--eman-bg-light);
    border: 1px solid var(--eman-border-light);
    border-radius: var(--radius-md);
    padding: 0;
    overflow: hidden;
    text-align: start;
}

.review-section { padding: 20px; border-bottom: 1px solid var(--eman-border-light); }
.review-section:last-child { border-bottom: none; }

.review-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--eman-purple);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.review-item label { font-size: 0.8rem; color: var(--eman-text-muted); display: block; margin-bottom: 3px; }
.review-item p { font-size: 1rem; font-weight: 600; color: var(--eman-text-dark); margin: 0; }

.terms-box {
    background: var(--eman-warning-bg, #fff8e1);
    border: 1px solid #ffe0b2;
    border-radius: var(--radius-md);
    padding: 15px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 3;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin: 0;
    width: 100%;
    min-height: 48px;
    position: relative;
    z-index: 3;
    -webkit-tap-highlight-color: rgba(106, 27, 154, 0.12);
}

.custom-checkbox input {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    accent-color: var(--eman-purple);
    flex-shrink: 0;
    pointer-events: auto;
    position: relative;
    z-index: 3;
}

.terms-text { font-size: 0.95rem; color: var(--eman-text-light); font-weight: 700; }

.terms-link-btn {
    background: var(--eman-bg);
    border: 1px solid var(--eman-purple);
    color: var(--eman-purple);
    padding: 5px 15px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: all var(--transition-fast);
    margin-inline-start: auto;
}

.terms-link-btn:hover { background: var(--eman-purple); color: #fff; }

.enroll-card .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: enroll-spin 0.8s linear infinite;
    display: none;
}

.btn-loading .spinner { display: inline-block; }
.btn-loading .btn-text { display: none; }

@keyframes enroll-spin { to { transform: rotate(360deg); } }

.custom-toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 12px 25px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-elevated);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.custom-toast.show { opacity: 1; visibility: visible; top: 110px; }
.custom-toast.success { background: var(--eman-success); }
.custom-toast.error { background: var(--eman-error); }

@media (prefers-reduced-motion: reduce) {
    .chem-icon, .tab-pane, .btn-next, .custom-toast, .mobile-progress-fill, .steps-progress, #major-group {
        animation: none !important;
        transition: none !important;
    }
}

@media (max-width: 767px) {
    .enroll-card { border-radius: 15px; }
    .stepper-header { padding: 25px 20px; border-radius: 15px 15px 0 0; }
    .steps-container { display: none; }
    .mobile-progress-container { display: block; }
    .enroll-card .form-content { padding: 25px 20px; min-height: 0; }
    .form-actions,
    html[dir="rtl"] .form-actions,
    html[dir="ltr"] .form-actions {
        flex-direction: column-reverse;
        gap: 15px;
    }
    .btn-nav { width: 100%; justify-content: center; touch-action: manipulation; }
    .review-grid { grid-template-columns: 1fr; }
    .terms-box { flex-direction: column; align-items: stretch; }
    .terms-link-btn { width: 100%; text-align: center; margin-top: 10px; margin-inline-start: 0; }
    .gender-options { flex-direction: column; }
    .enroll-card .form-control,
    .enroll-card .gender-label,
    .custom-checkbox,
    .custom-checkbox input {
        touch-action: manipulation;
    }

    /* Closed mobile drawer is opacity:0 but its children keep pointer-events,
       so an invisible 86vw panel steals every tap on the form and terms box. */
    .header.-type-4 .header-menu:not(.-is-el-visible),
    .header.-type-4 .header-menu:not(.-is-el-visible) .header-menu__content,
    .header.-type-4 .header-menu:not(.-is-el-visible) .header-menu-bg,
    .header.-type-4 .header-menu:not(.-is-el-visible) * {
        pointer-events: none !important;
    }
}
