:root {
    --wizard-accent: #667eea;
    --wizard-accent-strong: #764ba2;
    --wizard-success: #10b981;
    --wizard-warning: #f97316;
    --wizard-neutral: #f3f4f6;
    --wizard-border: #e5e7eb;
    --wizard-text-muted: #6b7280;
}

.steps-wizard-container {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem 2.25rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
}

.steps-wrapper {
    position: relative;
}

.steps-progress-bar {
    position: absolute;
    top: 34px;
    inset-inline: 0;
    height: 3px;
    border-radius: 2px;
    background: #edf2f7;
    overflow: hidden;
}

.steps-progress-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    border-radius: 2px;
    width: 0%;
    background-image: linear-gradient(90deg, var(--wizard-accent) 0%, var(--wizard-accent-strong) 100%);
    transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* RTL: inset-inline-start is already the logical start (right side in RTL), no override needed */

.steps-list {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
    position: relative;
    z-index: 2;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 0;
    flex: 1;
    cursor: pointer;
    user-select: none;
}

.step-item[aria-disabled="true"] {
    cursor: not-allowed;
}

.step-item:focus-visible {
    outline: 2px solid var(--wizard-accent);
    outline-offset: 6px;
}

.step-marker {
    position: relative;
    width: 70px;
    height: 70px;
    display: grid;
    place-items: center;
    margin-bottom: 0.75rem;
}

.step-number,
.step-icon,
.step-check {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    transition: all 0.35s ease;
}

.step-number {
    font-weight: 700;
    color: #9ca3af;
}

.step-icon,
.step-check {
    opacity: 0;
    transform: scale(0.65);
    color: #fff;
}

.step-info {
    max-width: 120px;
}

.step-title {
    font-weight: 600;
    color: #111827;
    font-size: 0.95rem;
}

.step-description {
    visibility: hidden;
    color: var(--wizard-text-muted);
    font-size: 0.75rem;
}

.step-item.pending .step-marker {
    border-radius: 999px;
    border: 3px solid #e5e7eb;
    background: #f9fafb;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.05);
}

.step-item.pending .step-number {
    opacity: 1;
}

.step-item.active .step-marker {
    border-radius: 999px;
    border: 3px solid transparent;
    background-image: linear-gradient(135deg, var(--wizard-accent) 0%, var(--wizard-accent-strong) 100%);
    box-shadow: 0 10px 35px rgba(102, 126, 234, 0.35), 0 0 0 6px rgba(102, 126, 234, 0.12);
    animation: wizardPulse 2s infinite;
}

.step-item.active .step-number {
    opacity: 0;
    transform: scale(0.7);
}

.step-item.active .step-icon {
    opacity: 1;
    transform: scale(1);
}

.step-item.completed .step-marker {
    border-radius: 999px;
    border: 3px solid transparent;
    background-image: linear-gradient(135deg, var(--wizard-success) 0%, #059669 100%);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.25);
}

.step-item.completed .step-number,
.step-item.completed .step-icon {
    opacity: 0;
    transform: scale(0.65);
}

.step-item.completed .step-check {
    opacity: 1;
    transform: scale(1);
}

@keyframes wizardPulse {
    0% {
        box-shadow: 0 10px 35px rgba(102, 126, 234, 0.35), 0 0 0 6px rgba(102, 126, 234, 0.12);
    }
    50% {
        box-shadow: 0 10px 35px rgba(102, 126, 234, 0.45), 0 0 0 10px rgba(102, 126, 234, 0.08);
    }
    100% {
        box-shadow: 0 10px 35px rgba(102, 126, 234, 0.35), 0 0 0 6px rgba(102, 126, 234, 0.12);
    }
}

.wizard-progress-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--wizard-text-muted);
    font-weight: 600;
}

.wizard-step-note {
    font-size: 0.85rem;
    color: var(--wizard-text-muted);
}

.wizard-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    backdrop-filter: blur(4px);
}

.wizard-overlay.active {
    display: flex;
}

.wizard-overlay .wizard-dialog {
    background: #fff;
    padding: 2.5rem 3rem;
    border-radius: 1.25rem;
    text-align: center;
    min-width: 300px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}

.wizard-password-group {
    position: relative;
}

.wizard-password-group .form-control {
    padding-inline-end: 3rem;
}

.wizard-password-group .password-toggle-btn {
    position: absolute;
    top: 50%;
    inset-inline-end: 0.75rem;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #6b7280;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border-radius: 999px;
}

.wizard-password-group .password-toggle-btn:focus-visible {
    outline: 2px solid var(--wizard-accent);
    outline-offset: 2px;
}

.upload-area {
    border: 2px dashed var(--wizard-border);
    border-radius: 1rem;
    padding: 1.5rem;
    background: #fcfdff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    cursor: pointer;
    min-height: 220px;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--wizard-accent);
    background: rgba(102, 126, 234, 0.04);
    transform: translateY(-2px);
}

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

.upload-details {
    width: 100%;
    text-align: center;
    color: var(--wizard-text-muted);
    font-size: 0.85rem;
}

.upload-chip {
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.12);
    color: #065f46;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.upload-chip button {
    border: none;
    background: transparent;
    color: inherit;
    padding: 0;
}

.wizard-checklist {
    border: 1px solid var(--wizard-border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    background: #fff;
    box-shadow: 0 5px 15px rgba(15, 23, 42, 0.04);
}

.wizard-checklist .form-check {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.wizard-checklist .form-check:last-child {
    margin-bottom: 0;
}

[dir="rtl"] .wizard-checklist .form-check {
    flex-direction: row-reverse;
    text-align: right;
    justify-content: flex-end;
}

.wizard-checklist .form-check-input {
    float: none;
    margin: 0;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 0.3rem;
}

.wizard-checklist.rtl-checklist {
    direction: rtl;
}

.wizard-checklist.rtl-checklist .form-check {
    flex-direction: row-reverse;
    justify-content: flex-end;
    text-align: right;
}

.wizard-checklist.rtl-checklist .form-check-input {
    margin-left: 0.4rem;
    margin-right: 0;
}

.wizard-checklist .form-check-label {
    font-size: 0.95rem;
    color: #111827;
    line-height: 1.4;
}

.wizard-review-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

.wizard-review-card {
    background: #fff;
    border-radius: 0.85rem;
    border: 1px solid var(--wizard-border);
    padding: 1.1rem;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
    height: 100%;
    display: flex;
    flex-direction: column;
}

@media (min-width: 1200px) {
    .wizard-review-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }
}

.wizard-review-card .card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.wizard-review-card .card-meta {
    color: var(--wizard-text-muted);
    font-size: 0.85rem;
}

.wizard-review-card .status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.15rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pill.success {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}

.status-pill.warning {
    background: rgba(249, 115, 22, 0.15);
    color: #c2410c;
}

.wizard-review-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.wizard-review-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    padding: 0.35rem 0;
    border-bottom: 1px dashed rgba(15, 23, 42, 0.08);
}

.wizard-review-list li:last-child {
    border-bottom: 0;
}

.wizard-review-value {
    font-weight: 600;
    color: #111827;
}

.wizard-inline-feedback {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--wizard-text-muted);
}

.wizard-section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.wizard-icon-pill {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.wizard-section-subtitle {
    color: var(--wizard-text-muted);
    font-size: 0.95rem;
}

.step-content {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.step-transition-overlay {
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    z-index: 9999;
}

.step-transition-overlay .spinner-ring {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spinner 1s linear infinite;
}

.loading-spinner .spinner-ring {
    width: 48px;
    height: 48px;
    border: 6px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spinner 1s linear infinite;
}

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

.success-checkmark {
    animation: checkmark 0.6s ease-in-out;
}

@keyframes checkmark {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .steps-wizard-container {
        padding: 1.25rem 1rem;
    }

    .steps-list {
        flex-direction: column;
        align-items: stretch;
    }

    .step-item {
        flex-direction: row;
        justify-content: flex-end;
        gap: 1rem;
    }

    .step-marker {
        width: 60px;
        height: 60px;
        margin-bottom: 0;
    }

    .steps-progress-bar {
        display: none;
    }
}

/* ==================== Enhanced Summary / Review Styles ==================== */

.wizard-review-card {
    background: #ffffff;
    border: 1px solid var(--wizard-border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.wizard-review-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.wizard-review-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.wizard-review-card .card-meta {
    font-size: 0.85rem;
    color: var(--wizard-text-muted);
}

.wizard-review-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wizard-review-list li {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
    gap: 1rem;
    direction: rtl;
}

.wizard-review-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.wizard-review-list li:first-child {
    padding-top: 0;
}

.wizard-review-list .review-label {
    font-weight: 500;
    color: #6b7280;
    font-size: 0.9rem;
    flex-shrink: 0;
    min-width: 120px;
}

.wizard-review-value {
    font-weight: 500;
    color: #111827;
    text-align: start;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill.success {
    background: rgba(16, 185, 129, 0.12);
    color: #065f46;
}

.status-pill.warning {
    background: rgba(249, 115, 22, 0.12);
    color: #9a3412;
}

.status-pill i {
    font-size: 0.9rem;
}

/* File Preview in Summary */
.documents-review {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.document-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.75rem;
}

.document-item .review-label {
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: white;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.file-preview-item.clickable:hover {
    background: #f9fafb;
    border-color: var(--wizard-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.file-preview-item i {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.file-name {
    font-weight: 500;
    color: #111827;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.8rem;
    color: var(--wizard-text-muted);
}

/* RTL Support for Review Section */
[dir="rtl"] .wizard-review-list li {
    flex-direction: row-reverse;
}

[dir="rtl"] .wizard-review-value {
    text-align: right;
}

[dir="rtl"] .file-preview-item {
    flex-direction: row-reverse;
}

/* ==================== Clean Summary Table (Step 5) ==================== */
.review-summary {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    font-size: 0.9rem;
}

.review-section {
    border-bottom: 1px solid #d1d5db;
}

.review-section:last-child {
    border-bottom: none;
}

.review-section-title {
    background: #f9fafb;
    padding: 8px 16px;
    font-weight: 600;
    color: #374151;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid #d1d5db;
}

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

.review-table tr:not(:last-child) td {
    border-bottom: 1px solid #f3f4f6;
}

.review-table td {
    padding: 10px 16px;
    vertical-align: middle;
}

.review-lbl {
    width: 38%;
    color: #6b7280;
    font-weight: 400;
    font-size: 0.875rem;
}

.review-val {
    color: #111827;
    font-weight: 500;
}

.review-file-link {
    color: #2563eb;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.review-file-link:hover {
    text-decoration: underline;
}

.review-file-size {
    color: #9ca3af;
    font-size: 0.8rem;
    font-weight: 400;
    margin-right: 6px;
}
