/* اجتماعی امتحانات — template-exam-registration.php.
   Stepper, radio, summary, success and confirm rules are copied from
   admission.css and renamed (that wizard is dormant; nothing is shared).
   Every rule that gives a state-toggled element `display: X` is paired
   with its own `[hidden] { display: none; }` guard, as in admission.css.
   Rules for controls inside the form are prefixed `.exam-form` so they
   outrank style.css's `.field label` / `.field input` (0,1,1), which
   would otherwise make every radio, checkbox and file input a
   full-width 48px text control. */

.exam-year { color: var(--text-light); font-size: var(--text-sm); margin-bottom: var(--space-4); }

.exam-notice { margin-bottom: var(--space-5); }
.exam-notice h3 { margin-bottom: var(--space-2); }
.exam-notice p:last-child { margin-bottom: 0; }
.exam-notice--closed {
    background: var(--gold-light);
    border: 1.5px solid var(--gold);
    color: var(--on-gold-container, #2B1700);
}
.exam-notice--error { background: var(--md-error-container); color: var(--md-error); }
.exam-notice--error p { margin-bottom: var(--space-3); }

/* Stepper */
.exam-stepper { margin-bottom: var(--space-6); overflow-x: auto; }
.exam-stepper ol {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: var(--space-3);
    min-width: max-content;
}
.exam-stepper-item { display: flex; align-items: center; gap: var(--space-2); opacity: 0.5; }
.exam-stepper-item.is-active, .exam-stepper-item.is-complete { opacity: 1; }
.exam-stepper-dot {
    width: 28px; height: 28px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--surface-container-high);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
}
.exam-stepper-item.is-active .exam-stepper-dot { background: var(--primary); color: #FFFFFF; }
.exam-stepper-item.is-complete .exam-stepper-dot { background: var(--md-success-container); color: var(--md-success); }
.exam-stepper-label { font-size: var(--text-xs); color: var(--text-light); white-space: nowrap; }

/* Cards, hints, legends */
.exam-card { margin-bottom: var(--space-5); }
.exam-form .exam-hint {
    margin: 0 0 var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-light);
    overflow-wrap: anywhere;
}
.exam-legend {
    display: block;
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-light);
}
.exam-form .field[hidden], .exam-branch[hidden] { display: none; }

/* Radio groups: wrap on narrow screens; --stack = one option per line */
.exam-radio-group { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin-bottom: var(--space-2); }
.exam-radio-group--stack { flex-direction: column; gap: var(--space-2); }
.exam-form .exam-radio {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    margin: 0;
    font-size: var(--text-md);
    color: var(--text);
    cursor: pointer;
    overflow-wrap: anywhere;
}
.exam-form .exam-radio input,
.exam-form .exam-check input {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    accent-color: var(--primary);
}

/* Syllabus info card */
.exam-info-card {
    margin-bottom: var(--space-5);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    border-inline-start: 4px solid var(--primary);
    background: var(--surface-container);
    font-size: var(--text-sm);
}
.exam-info-card[hidden] { display: none; }
.exam-info-title { margin-bottom: var(--space-2); font-weight: var(--font-weight-semibold); }
.exam-info-card dl { margin: 0 0 var(--space-2); }
.exam-info-card dt { color: var(--text-light); font-size: var(--text-xs); }
.exam-info-card dd { margin: 0 0 var(--space-2); }
.exam-info-link { color: var(--primary); text-decoration: underline; text-underline-offset: 0.2em; }
.exam-info-legend { margin: 0; font-size: var(--text-xs); color: var(--text-light); }

/* Para checkbox grid */
.exam-para-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.5rem), 1fr));
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}
.exam-form .exam-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    margin: 0;
    padding: var(--space-2) var(--space-3);
    border: 1.5px solid var(--outline-variant);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--text);
    cursor: pointer;
    overflow-wrap: anywhere;
}
.exam-form .exam-check:has(input:checked) { border-color: var(--primary); background: var(--primary-container); }
.exam-form .exam-check--full { grid-column: 1 / -1; font-weight: var(--font-weight-medium); }
.exam-check-num { min-width: 1.5em; font-family: var(--font-en); font-weight: var(--font-weight-semibold); color: var(--primary); }

/* Photo */
.exam-photo { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.exam-photo-preview {
    width: 96px; height: 96px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--outline-variant);
}
.exam-photo-preview[hidden] { display: none; }
.exam-photo-actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.exam-form .exam-photo-btn {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin: 0;
    padding: var(--space-2) var(--space-4);
    border: 1.5px solid var(--primary);
    color: var(--primary);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    cursor: pointer;
}
.exam-photo-actions:focus-within .exam-photo-btn { box-shadow: var(--focus-ring); }
.exam-form .exam-photo input[type="file"] { width: 1px; height: 1px; padding: 0; border: 0; }
.exam-photo-status { font-size: var(--text-sm); color: var(--text-light); }

/* Summary */
.exam-summary-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); }
.exam-summary-header h3 { margin: 0; }
.exam-summary-photo img {
    width: 96px; height: 96px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--outline-variant);
    margin-bottom: var(--space-4);
}
.exam-summary-list { margin: 0 0 var(--space-4); }
.exam-summary-list dt { font-size: var(--text-xs); color: var(--text-light); }
.exam-summary-list dd { margin: 0 0 var(--space-3); overflow-wrap: anywhere; }
.exam-summary-edit { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.exam-summary-edit-btn {
    min-height: 44px;
    padding: 0;
    background: none;
    border: none;
    color: var(--primary);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
}

.exam-form-error { margin-bottom: var(--space-4); }

.exam-nav-actions { display: flex; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-6); }

/* Success screen */
.exam-success[hidden] { display: none; }
.exam-success { text-align: center; padding-block: var(--space-12); }
.exam-success-icon {
    width: 72px; height: 72px;
    margin: 0 auto var(--space-5);
    border-radius: 50%;
    background: var(--md-success-container);
    color: var(--md-success);
    display: flex; align-items: center; justify-content: center;
    font-size: var(--text-3xl);
}
.exam-success p { overflow-wrap: anywhere; }
.exam-success-actions { display: flex; justify-content: center; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-6); }

/* Confirm dialog */
.exam-confirm-overlay[hidden] { display: none; }
.exam-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(27, 28, 25, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: var(--space-5);
}
.exam-confirm-box { max-width: 420px; text-align: center; }
.exam-confirm-actions { display: flex; gap: var(--space-3); margin-top: var(--space-6); }
.exam-confirm-actions .btn { flex: 1; }

@media (max-width: 640px) {
    .exam-nav-actions { flex-direction: column-reverse; }
    .exam-success-actions { flex-direction: column; }
}

/* Phones: tighter card padding, and only the active step keeps its label
   so the 4-step stepper fits at 390px without scrolling. */
@media (max-width: 480px) {
    .exam-card { padding: var(--space-4); }
    .exam-stepper ol { min-width: 0; justify-content: space-between; }
    .exam-stepper-item:not(.is-active) .exam-stepper-label { display: none; }
}
