/* ==========================================================================
   Sheikh El-Hara - Candidate Registration Form Styles
   RTL Arabic Multi-Step Form
   ========================================================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
    --sh-primary: #2563eb;
    --sh-primary-light: #3b82f6;
    --sh-primary-dark: #1d4ed8;
    --sh-primary-bg: #eff6ff;
    --sh-dark: #1e293b;
    --sh-dark-light: #334155;
    --sh-success: #10b981;
    --sh-success-bg: #ecfdf5;
    --sh-warning: #f59e0b;
    --sh-warning-bg: #fffbeb;
    --sh-error: #ef4444;
    --sh-error-bg: #fef2f2;
    --sh-gray-50: #f8fafc;
    --sh-gray-100: #f1f5f9;
    --sh-gray-200: #e2e8f0;
    --sh-gray-300: #cbd5e1;
    --sh-gray-400: #94a3b8;
    --sh-gray-500: #64748b;
    --sh-gray-600: #475569;
    --sh-gray-700: #334155;
    --sh-text: #1e293b;
    --sh-text-muted: #64748b;
    --sh-border: #e2e8f0;
    --sh-radius: 8px;
    --sh-radius-lg: 12px;
    --sh-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --sh-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --sh-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --sh-transition: 0.2s ease;
    --sh-font-family: 'Tajawal', 'Cairo', 'Segoe UI', Tahoma, sans-serif;
}

/* ---------- Base / Wrapper ---------- */
.sh-candidate-form-wrapper {
    direction: rtl;
    text-align: right;
    font-family: var(--sh-font-family);
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: var(--sh-radius-lg);
    box-shadow: var(--sh-shadow-lg);
    color: var(--sh-text);
    line-height: 1.7;
}

.sh-candidate-form-wrapper *,
.sh-candidate-form-wrapper *::before,
.sh-candidate-form-wrapper *::after {
    box-sizing: border-box;
}

/* ---------- Form Title ---------- */
.sh-form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sh-dark);
    margin: 0 0 0.25rem;
    text-align: center;
}

.sh-form-subtitle {
    font-size: 0.95rem;
    color: var(--sh-text-muted);
    margin: 0 0 1.5rem;
    text-align: center;
}

/* ---------- Progress Bar / Stepper ---------- */
.sh-progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
    direction: rtl;
}

.sh-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.sh-progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 18px;
    left: -50%;
    width: 100%;
    height: 3px;
    background: var(--sh-gray-200);
    z-index: 0;
    transition: background var(--sh-transition);
}

.sh-progress-step.completed:not(:last-child)::after {
    background: var(--sh-success);
}

.sh-progress-step.active:not(:last-child)::after {
    background: linear-gradient(to left, var(--sh-primary), var(--sh-gray-200));
}

.sh-progress-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--sh-gray-200);
    color: var(--sh-gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
    transition: all var(--sh-transition);
    border: 3px solid transparent;
}

.sh-progress-step.active .sh-progress-circle {
    background: var(--sh-primary);
    color: #fff;
    border-color: var(--sh-primary-bg);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.sh-progress-step.completed .sh-progress-circle {
    background: var(--sh-success);
    color: #fff;
    border-color: var(--sh-success-bg);
}

.sh-progress-step.completed .sh-progress-circle::after {
    content: '\2713';
    font-size: 1rem;
}

.sh-progress-step.completed .sh-progress-circle .sh-step-number {
    display: none;
}

.sh-progress-label {
    font-size: 0.75rem;
    color: var(--sh-gray-400);
    margin-top: 0.5rem;
    white-space: nowrap;
    transition: color var(--sh-transition);
}

.sh-progress-step.active .sh-progress-label {
    color: var(--sh-primary);
    font-weight: 600;
}

.sh-progress-step.completed .sh-progress-label {
    color: var(--sh-success);
}

/* ---------- Steps ---------- */
.sh-step {
    display: none;
    animation: shFadeIn 0.35s ease;
}

.sh-step.active {
    display: block;
}

@keyframes shFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sh-step-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--sh-dark);
    margin-bottom: 0.25rem;
}

.sh-step-desc {
    font-size: 0.9rem;
    color: var(--sh-text-muted);
    margin-bottom: 1.5rem;
}

/* ---------- Role Selector Grid ---------- */
.sh-role-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.sh-role-card {
    background: #fff;
    border: 2px solid var(--sh-gray-200);
    border-radius: var(--sh-radius);
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--sh-transition);
    position: relative;
    overflow: hidden;
}

.sh-role-card:hover {
    border-color: var(--sh-primary-light);
    transform: translateY(-2px);
    box-shadow: var(--sh-shadow-md);
}

.sh-role-card.selected {
    border-color: var(--sh-primary);
    background: var(--sh-primary-bg);
}

.sh-role-card.selected::after {
    content: '\2713';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    background: var(--sh-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.sh-role-card__icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.sh-role-card__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--sh-dark);
}

.sh-role-card input[type="radio"] {
    display: none;
}

/* ---------- Form Groups ---------- */
.sh-form-group {
    margin-bottom: 1.25rem;
}

.sh-form-group label,
.sh-form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--sh-dark);
    margin-bottom: 0.4rem;
}

.sh-form-label .sh-required {
    color: var(--sh-error);
    margin-right: 2px;
}

.sh-form-hint {
    font-size: 0.8rem;
    color: var(--sh-text-muted);
    margin-top: 0.25rem;
}

.sh-form-row {
    display: flex;
    gap: 1rem;
}

.sh-form-row .sh-form-group {
    flex: 1;
}

/* ---------- Inputs ---------- */
.sh-input,
.sh-select,
.sh-textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
    font-family: var(--sh-font-family);
    color: var(--sh-text);
    background: #fff;
    border: 1.5px solid var(--sh-gray-300);
    border-radius: var(--sh-radius);
    transition: border-color var(--sh-transition), box-shadow var(--sh-transition);
    direction: rtl;
    text-align: right;
    appearance: none;
    -webkit-appearance: none;
}

.sh-input:focus,
.sh-select:focus,
.sh-textarea:focus {
    outline: none;
    border-color: var(--sh-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.sh-input.sh-input--error,
.sh-select.sh-input--error,
.sh-textarea.sh-input--error {
    border-color: var(--sh-error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.sh-input::placeholder,
.sh-textarea::placeholder {
    color: var(--sh-gray-400);
}

.sh-textarea {
    min-height: 100px;
    resize: vertical;
}

.sh-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    padding-left: 2rem;
}

.sh-field-error {
    font-size: 0.8rem;
    color: var(--sh-error);
    margin-top: 0.25rem;
    display: none;
}

.sh-form-group.has-error .sh-field-error {
    display: block;
}

.sh-form-group.has-error .sh-input,
.sh-form-group.has-error .sh-select,
.sh-form-group.has-error .sh-textarea {
    border-color: var(--sh-error);
}

/* ---------- Custom Radio Buttons ---------- */
.sh-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sh-radio-item {
    position: relative;
}

.sh-radio-item input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.sh-radio-item label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1.5px solid var(--sh-gray-300);
    border-radius: var(--sh-radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--sh-transition);
    background: #fff;
}

.sh-radio-item label::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid var(--sh-gray-300);
    border-radius: 50%;
    transition: all var(--sh-transition);
    flex-shrink: 0;
}

.sh-radio-item input[type="radio"]:checked + label {
    border-color: var(--sh-primary);
    background: var(--sh-primary-bg);
    color: var(--sh-primary);
}

.sh-radio-item input[type="radio"]:checked + label::before {
    border-color: var(--sh-primary);
    background: var(--sh-primary);
    box-shadow: inset 0 0 0 3px #fff;
}

/* ---------- Custom Checkboxes ---------- */
.sh-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sh-checkbox-item {
    position: relative;
}

.sh-checkbox-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.sh-checkbox-item label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1.5px solid var(--sh-gray-300);
    border-radius: var(--sh-radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--sh-transition);
    background: #fff;
}

.sh-checkbox-item label::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid var(--sh-gray-300);
    border-radius: 4px;
    transition: all var(--sh-transition);
    flex-shrink: 0;
}

.sh-checkbox-item input[type="checkbox"]:checked + label {
    border-color: var(--sh-primary);
    background: var(--sh-primary-bg);
    color: var(--sh-primary);
}

.sh-checkbox-item input[type="checkbox"]:checked + label::before {
    border-color: var(--sh-primary);
    background: var(--sh-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M10 3L4.5 8.5 2 6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

/* ---------- Multi-Choice Pill / Tag Selector ---------- */
.sh-pill-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sh-pill-item {
    position: relative;
}

.sh-pill-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.sh-pill-item label {
    display: inline-block;
    padding: 0.4rem 1rem;
    border: 1.5px solid var(--sh-gray-300);
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--sh-transition);
    background: #fff;
    white-space: nowrap;
}

.sh-pill-item label:hover {
    border-color: var(--sh-primary-light);
    background: var(--sh-primary-bg);
}

.sh-pill-item input[type="checkbox"]:checked + label {
    border-color: var(--sh-primary);
    background: var(--sh-primary);
    color: #fff;
}

/* ---------- Scale Input (1-10 horizontal) ---------- */
.sh-scale-group {
    display: flex;
    gap: 0;
    border: 1.5px solid var(--sh-gray-300);
    border-radius: var(--sh-radius);
    overflow: hidden;
    direction: rtl;
}

.sh-scale-item {
    flex: 1;
    position: relative;
}

.sh-scale-item input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.sh-scale-item label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 0;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--sh-gray-500);
    transition: all var(--sh-transition);
    border-left: 1px solid var(--sh-gray-200);
    text-align: center;
    margin: 0;
}

.sh-scale-item:last-child label {
    border-left: none;
}

.sh-scale-item label:hover {
    background: var(--sh-primary-bg);
    color: var(--sh-primary);
}

.sh-scale-item input[type="radio"]:checked + label {
    background: var(--sh-primary);
    color: #fff;
}

.sh-scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--sh-text-muted);
    margin-top: 0.25rem;
    padding: 0 0.25rem;
}

/* ---------- File Upload Zone ---------- */
.sh-upload-zone {
    border: 2px dashed var(--sh-gray-300);
    border-radius: var(--sh-radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--sh-transition);
    background: var(--sh-gray-50);
}

.sh-upload-zone:hover,
.sh-upload-zone.dragover {
    border-color: var(--sh-primary);
    background: var(--sh-primary-bg);
}

.sh-upload-zone__icon {
    font-size: 2.5rem;
    color: var(--sh-gray-400);
    margin-bottom: 0.5rem;
}

.sh-upload-zone.dragover .sh-upload-zone__icon {
    color: var(--sh-primary);
}

.sh-upload-zone__text {
    font-size: 0.95rem;
    color: var(--sh-text-muted);
    margin-bottom: 0.25rem;
}

.sh-upload-zone__text strong {
    color: var(--sh-primary);
}

.sh-upload-zone__hint {
    font-size: 0.8rem;
    color: var(--sh-gray-400);
}

.sh-upload-zone input[type="file"] {
    display: none;
}

.sh-upload-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--sh-gray-50);
    border-radius: var(--sh-radius);
    border: 1px solid var(--sh-gray-200);
}

.sh-upload-preview__name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--sh-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sh-upload-preview__size {
    font-size: 0.8rem;
    color: var(--sh-text-muted);
}

.sh-upload-preview__remove {
    background: none;
    border: none;
    color: var(--sh-error);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem;
    line-height: 1;
}

.sh-upload-progress {
    width: 100%;
    height: 4px;
    background: var(--sh-gray-200);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.sh-upload-progress__bar {
    height: 100%;
    background: var(--sh-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

/* ---------- Buttons ---------- */
.sh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--sh-font-family);
    border: 2px solid transparent;
    border-radius: var(--sh-radius);
    cursor: pointer;
    transition: all var(--sh-transition);
    text-decoration: none;
    line-height: 1.4;
}

.sh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sh-btn--primary {
    background: var(--sh-primary);
    color: #fff;
    border-color: var(--sh-primary);
}

.sh-btn--primary:hover:not(:disabled) {
    background: var(--sh-primary-dark);
    border-color: var(--sh-primary-dark);
}

.sh-btn--secondary {
    background: #fff;
    color: var(--sh-dark);
    border-color: var(--sh-gray-300);
}

.sh-btn--secondary:hover:not(:disabled) {
    background: var(--sh-gray-50);
    border-color: var(--sh-gray-400);
}

.sh-btn--success {
    background: var(--sh-success);
    color: #fff;
    border-color: var(--sh-success);
}

.sh-btn--danger {
    background: var(--sh-error);
    color: #fff;
    border-color: var(--sh-error);
}

.sh-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--sh-gray-200);
}

.sh-btn-next {
    margin-inline-start: auto;
}

.sh-btn-prev {
    margin-inline-end: auto;
}

/* ---------- Review Step ---------- */
.sh-review-section {
    margin-bottom: 1.5rem;
}

.sh-review-section__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--sh-dark);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--sh-primary-bg);
}

.sh-review-table {
    width: 100%;
    border-collapse: collapse;
}

.sh-review-table tr {
    border-bottom: 1px solid var(--sh-gray-100);
}

.sh-review-table tr:last-child {
    border-bottom: none;
}

.sh-review-table th {
    text-align: right;
    padding: 0.6rem 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--sh-text-muted);
    width: 35%;
    vertical-align: top;
}

.sh-review-table td {
    padding: 0.6rem 0.5rem;
    font-size: 0.9rem;
    color: var(--sh-dark);
}

.sh-review-edit {
    font-size: 0.8rem;
    color: var(--sh-primary);
    cursor: pointer;
    text-decoration: underline;
    background: none;
    border: none;
    font-family: var(--sh-font-family);
}

/* ---------- Success Message ---------- */
.sh-success-message {
    text-align: center;
    padding: 3rem 1.5rem;
}

.sh-success-message__icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--sh-success-bg);
    color: var(--sh-success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.25rem;
}

.sh-success-message__title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--sh-dark);
    margin-bottom: 0.5rem;
}

.sh-success-message__text {
    font-size: 0.95rem;
    color: var(--sh-text-muted);
    margin-bottom: 1.5rem;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- Loading / Spinner Overlay ---------- */
.sh-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: var(--sh-radius-lg);
}

.sh-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--sh-gray-200);
    border-top-color: var(--sh-primary);
    border-radius: 50%;
    animation: shSpin 0.7s linear infinite;
}

@keyframes shSpin {
    to { transform: rotate(360deg); }
}

.sh-loading-text {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--sh-text-muted);
}

.sh-candidate-form-wrapper {
    position: relative;
}

/* ---------- Alert / Notice ---------- */
.sh-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--sh-radius);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.sh-alert--error {
    background: var(--sh-error-bg);
    color: var(--sh-error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.sh-alert--success {
    background: var(--sh-success-bg);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.sh-alert--warning {
    background: var(--sh-warning-bg);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ---------- Conditional Fields ---------- */
.sh-conditional-field {
    display: none;
    padding-right: 1rem;
    border-right: 3px solid var(--sh-primary-bg);
    margin-top: 0.75rem;
}

.sh-conditional-field.visible {
    display: block;
    animation: shFadeIn 0.3s ease;
}

/* ---------- Responsive ---------- */

/* Tablet */
@media (max-width: 1024px) {
    .sh-candidate-form-wrapper {
        margin: 1.5rem auto;
        padding: 1.5rem;
    }

    .sh-role-selector {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet small */
@media (max-width: 768px) {
    .sh-candidate-form-wrapper {
        margin: 1rem;
        padding: 1.25rem;
    }

    .sh-role-selector {
        grid-template-columns: repeat(2, 1fr);
    }

    .sh-form-row {
        flex-direction: column;
        gap: 0;
    }

    .sh-progress-label {
        display: none;
    }

    .sh-progress-circle {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .sh-scale-group {
        flex-wrap: wrap;
    }

    .sh-scale-item {
        flex: 0 0 calc(20% - 0px);
    }

    .sh-scale-item label {
        border-left: none;
        border-bottom: 1px solid var(--sh-gray-200);
    }

    .sh-form-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .sh-form-actions .sh-btn {
        width: 100%;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .sh-candidate-form-wrapper {
        margin: 0.5rem;
        padding: 1rem;
        border-radius: var(--sh-radius);
    }

    .sh-role-selector {
        grid-template-columns: 1fr;
    }

    .sh-form-title {
        font-size: 1.25rem;
    }

    .sh-radio-group,
    .sh-checkbox-group,
    .sh-pill-selector {
        flex-direction: column;
    }

    .sh-radio-item label,
    .sh-checkbox-item label,
    .sh-pill-item label {
        width: 100%;
        justify-content: flex-start;
    }
}
