*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f2f2f2;
    --card: #ffffff;
    --primary: #111111;
    --primary-h: #333333;
    --danger: #cc0000;
    --success: #1a6b3a;
    --warn: #7a5500;
    --border: #d0d0d0;
    --muted: #767676;
    --text: #111111;
    --radius: 8px;
    --step-inactive: #e0e0e0;
    --step-active: #111111;
}

html,
body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: direction .15s;
}

html[lang="ar"] body {
    font-family: 'Cairo', -apple-system, sans-serif;
}

/* ── Top Bar ── */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar .logo {
    height: 40px;
}

/* ── Language toggle ── */
.lang-toggle {
    z-index: 200;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 99px;
    display: flex;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.lang-toggle button {
    padding: .4rem .85rem;
    font-size: .8rem;
    font-weight: 600;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--muted);
    transition: background .15s, color .15s;
    line-height: 1.4;
}

.lang-toggle button.active {
    background: var(--primary);
    color: #ffffff;
}

/* ── Wizard Container ── */
.wizard-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ── Stepper ── */
.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0 1rem;
    margin-bottom: 2rem;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    opacity: 0.5;
    transition: opacity .2s;
}

.step.active,
.step.completed {
    opacity: 1;
}

.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--step-inactive);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    transition: all .2s;
}

.step.active .step-circle,
.step.completed .step-circle {
    background: var(--step-active);
    color: #fff;
}

.step.completed .step-circle {
    background: var(--success);
}

.step-label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.step.active .step-label {
    color: var(--text);
}

.step-line {
    flex: 1;
    max-width: 80px;
    height: 2px;
    background: var(--step-inactive);
    margin: 0 .5rem;
    transition: background .2s;
}

.step-line.completed {
    background: var(--success);
}

/* ── Wizard Steps ── */
.wizard-step {
    display: none;
    flex: 1;
}

.wizard-step.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn .3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-content {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08), 0 0 0 1px var(--border);
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ── Step 1: Welcome ── */
.welcome-step {
    text-align: center;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    gap: 1rem;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.welcome-step h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.welcome-subtitle {
    color: var(--muted);
    font-size: 1rem;
    max-width: 400px;
    line-height: 1.6;
}

/* ── Step 4: Success ── */
.success-step {
    text-align: center;
    justify-content: center;
    align-items: center;
    flex: 1;
    gap: 1.25rem;
}

#step-4 {
    flex: 1;
}

body.success-active .wizard-container {
    display: none;
}

.success-icon {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    animation: successPop .5s cubic-bezier(.175, .885, .32, 1.275);
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-step h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--success);
}

.success-subtitle {
    color: var(--text);
    font-size: 1rem;
    max-width: 440px;
    line-height: 1.6;
}

.success-note {
    color: var(--muted);
    font-size: .875rem;
    max-width: 400px;
    line-height: 1.5;
}

.auth-section {
    background: #f8f8f8;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
}

.auth-section .auth-status {
    color: var(--muted);
    font-size: .85rem;
}

.auth-section .auth-user {
    font-weight: 600;
    color: var(--text);
}

.auth-section button {
    padding: .6rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    cursor: pointer;
    font-size: .9rem;
    font-weight: 600;
    color: var(--primary);
    transition: all .15s;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.auth-section button:hover {
    background: #f0f0f0;
    border-color: var(--primary);
}

.auth-section .sign-out-link {
    color: var(--muted);
    font-size: .78rem;
    cursor: pointer;
    text-decoration: underline;
    background: none;
    border: none;
    padding: 0;
    font-weight: 400;
}

.sign-in-hint {
    color: var(--muted);
    font-size: .8rem;
    margin-top: .5rem;
}

/* ── Step 2: Requirements ── */
.requirements-step h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    margin-bottom: 1.5rem;
}

.requirements-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    flex: 1;
}

@media (max-width: 700px) {
    .requirements-layout {
        grid-template-columns: 1fr;
    }
}

.guidelines-compact {
    display: flex;
    /* flex-direction: column; */
    flex-wrap: wrap;
    gap: .5rem;
}

.guideline-item {
    display: flex;
    gap: .5rem;
    align-items: flex-start;
    font-size: .8rem;
    line-height: 1.5;
    flex: 1 1 45%;
}

.guideline-item .dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .7rem;
    margin-top: .1rem;
}

.dot.ok {
    background: #dcfce7;
    color: #166534;
}

.dot.bad {
    background: #fee2e2;
    color: #991b1b;
}

.examples-compact {
    display: flex;
    gap: .75rem;
}

.example-box {
    flex: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    text-align: center;
}

.example-box .label {
    padding: .35rem .5rem;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .03em;
}

.example-box.good .label {
    background: #dcfce7;
    color: #166534;
}

.example-box.bad .label {
    background: #fee2e2;
    color: #991b1b;
}

.example-img {
    background: #f5f5f5;
    aspect-ratio: 3/4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.example-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* AI Rejection Banner */
.ai-rejection-banner {
    display: none;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: var(--radius);
    padding: .85rem 1rem;
    margin-top: 1rem;
    color: var(--danger);
    font-size: .85rem;
    align-items: flex-start;
    gap: .6rem;
}

.ai-rejection-banner.visible {
    display: flex;
}

.ai-rejection-banner svg {
    flex-shrink: 0;
    margin-top: .1rem;
}

/* ── Step 3: Form ── */
.form-step h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 540px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .35rem;
}

label .req {
    color: var(--danger);
    margin-left: 2px;
}

html[dir="rtl"] label .req {
    margin-left: 0;
    margin-right: 2px;
}

input[type="text"],
input[type="email"] {
    width: 100%;
    padding: .55rem .8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .9rem;
    outline: none;
    transition: border-color .15s;
}

html[lang="ar"] input[type="text"],
html[lang="ar"] input[type="email"] {
    font-family: 'Cairo', sans-serif;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, .08);
}

input.error {
    border-color: var(--danger);
}

.field-error {
    color: var(--danger);
    font-size: .78rem;
    margin-top: .25rem;
    display: none;
}

.field-error.visible {
    display: block;
}

/* ── Upload zone ── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    position: relative;
}

.upload-zone:hover,
.upload-zone.drag {
    border-color: var(--primary);
    background: #f9f9f9;
}

.upload-zone.has-file {
    border-style: solid;
    border-color: var(--success);
    background: #f0fdf4;
}

.upload-zone input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-zone .upload-icon {
    margin-bottom: .4rem;
    color: var(--muted);
}

.upload-zone .upload-text {
    font-size: .85rem;
    color: var(--muted);
}

.upload-zone .upload-text strong {
    color: var(--primary);
}

.upload-zone .upload-hint {
    font-size: .75rem;
    color: var(--muted);
    margin-top: .25rem;
}

/* ── Preview ── */
#preview-wrap {
    display: none;
    margin-top: .75rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
    max-width: 180px;
    margin-left: auto;
    margin-right: auto;
}

#preview-wrap img {
    width: 180px;
    height: 180px;
    display: block;
    object-fit: cover;
}

#preview-wrap .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: .9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#file-validation-msg {
    margin-top: .4rem;
    font-size: .78rem;
    text-align: center;
}

#file-validation-msg.ok {
    color: var(--success);
}

#file-validation-msg.err {
    color: var(--danger);
}

/* ── Navigation Buttons ── */
.step-actions {
    display: flex;
    gap: .75rem;
    justify-content: center;
    padding-top: 1.5rem;
    flex-direction: column-reverse;
}

.form-actions {
    justify-content: space-between;
}

.nav-btn {
    padding: .7rem 1.8rem;
    border-radius: 6px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-width: 120px;
}

html[lang="ar"] .nav-btn {
    font-family: 'Cairo', sans-serif;
}

.nav-btn.primary {
    background: var(--primary);
    color: #fff;
    border: none;
}

.nav-btn.primary:hover:not(:disabled) {
    background: var(--primary-h);
}

.nav-btn.primary:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.nav-btn.secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

.nav-btn.secondary:hover {
    background: #f5f5f5;
}

.submit-btn {
    flex: 1;
}

/* ── Status banner ── */
#status-banner {
    display: none;
    position: fixed;
    top: 5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: .85rem 1.4rem;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 500;
    border: 1px solid transparent;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
    max-width: 90vw;
    width: max-content;
    text-align: center;
}

#status-banner.show {
    display: block;
}

#status-banner.success {
    background: #f0fdf4;
    color: var(--success);
    border-color: #bbf7d0;
}

#status-banner.error {
    background: #fff1f2;
    color: var(--danger);
    border-color: #fecdd3;
}

#status-banner a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

#status-banner.info {
    background: #f0f0f0;
    color: var(--primary);
    border-color: #d0d0d0;
}

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.75rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
}

html[lang="ar"] .modal {
    font-family: 'Cairo', sans-serif;
}

.modal h3 {
    font-size: 1.05rem;
    margin-bottom: .5rem;
    color: var(--warn);
}

.modal p {
    font-size: .875rem;
    color: var(--muted);
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: .6rem;
    justify-content: flex-end;
}

.btn-secondary {
    padding: .5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: .875rem;
}

.btn-primary {
    padding: .5rem 1rem;
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: .875rem;
    font-weight: 600;
}

/* ── Spinner ── */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .wizard-container {
        padding: 1rem;
    }

    .step-content {
        padding: 1.25rem;
    }

    .welcome-step h1,
    .success-step h1 {
        font-size: 1.4rem;
    }

    .stepper {
        padding: 0;
    }

    .step-label {
        font-size: .65rem;
    }

    .step-circle {
        width: 28px;
        height: 28px;
        font-size: .8rem;
    }

    .step-line {
        max-width: 40px;
    }

    .nav-btn {
        padding: .6rem 1.2rem;
        font-size: .9rem;
        min-width: 100px;
    }
}