/* ==========================================================================
   AUTH DESIGN SYSTEM
   Shared by: login.php, register.php, forgot-password.php,
              admin/login.php, vendor-login.php
   Follows DESIGN-SPEC.md  §1 tokens · §2 type · §3 spacing · §4 components
                           §5 responsive · §6 RTL
   These five screens are standalone documents (no site header/footer), so the
   tokens are re-declared here. Values are copied verbatim from DESIGN-SPEC §1.
   Direction handling uses CSS logical properties (§6) so RTL and LTR are both
   correct without duplicated rules.
   ========================================================================== */

:root {
    /* Brand — Orange */
    --primary: #f97316;
    --primary-dark: #ea580c;
    --primary-light: #fb923c;
    --primary-lighter: #fff7ed;
    --primary-100: #ffedd5;
    --primary-gradient: linear-gradient(135deg, #f97316 0%, #ea580c 100%);

    /* Neutrals — Black theme */
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --white: #ffffff;

    /* Status */
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #06b6d4;
    --info-light: #cffafe;

    /* Radius */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
    --shadow-md: 0 8px 16px -4px rgba(0, 0, 0, .10);
    --shadow-lg: 0 16px 32px -8px rgba(0, 0, 0, .12);
    --shadow-primary: 0 4px 12px rgba(249, 115, 22, .30);

    --transition: 200ms ease;

    /* Type scale */
    --fs-xs: 11px;
    --fs-sm: 12px;
    --fs-base: 14px;
    --fs-md: 15px;
    --fs-lg: 17px;
    --fs-xl: 20px;
    --fs-2xl: 24px;
    --fs-3xl: 30px;

    /* Spacing */
    --card-pad: 22px;
}

/* --- Reset + global overflow guards (DESIGN-SPEC §5) --------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    min-width: 0;
}

* {
    margin: 0;
    padding: 0;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

img,
svg,
video,
canvas,
iframe {
    max-width: 100%;
    height: auto;
}

/* --- Page shell ---------------------------------------------------------- */
body.auth-body {
    font-family: 'Cairo', sans-serif;
    font-size: var(--fs-md);
    line-height: 1.65;
    color: var(--gray-900);
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
}

.auth-shell {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
}

/* --- Brand panel (desktop only) ------------------------------------------ */
.auth-brand {
    display: none;
}

.auth-brand-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    margin-inline: auto;
}

.auth-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 13px;
    margin-bottom: 16px;
    border-radius: var(--radius-full);
    background: rgba(249, 115, 22, .16);
    border: 1px solid rgba(249, 115, 22, .38);
    color: var(--primary-light);
    font-size: var(--fs-sm);
    font-weight: 700;
}

.auth-brand h1 {
    font-size: var(--fs-3xl);
    font-weight: 800;
    line-height: 1.3;
    color: var(--white);
    margin-bottom: 10px;
    overflow-wrap: anywhere;
}

.auth-brand h1 span {
    color: var(--primary-light);
}

.auth-brand-lead {
    font-size: var(--fs-md);
    line-height: 1.7;
    color: rgba(255, 255, 255, .72);
    margin-bottom: 24px;
}

.auth-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.auth-feature-icon {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    border-radius: var(--radius);
    background: rgba(249, 115, 22, .15);
    border: 1px solid rgba(249, 115, 22, .28);
    color: var(--primary-light);
}

.auth-feature-body {
    min-width: 0;
}

.auth-feature-body strong {
    display: block;
    font-size: var(--fs-base);
    font-weight: 700;
    line-height: 1.45;
    color: var(--white);
    overflow-wrap: anywhere;
}

.auth-feature-body span {
    display: block;
    font-size: var(--fs-sm);
    line-height: 1.5;
    color: rgba(255, 255, 255, .58);
    overflow-wrap: anywhere;
}

/* --- Form panel ---------------------------------------------------------- */
.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 24px 16px;
}

.auth-card {
    width: 100%;
    max-width: 452px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--card-pad);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
    text-decoration: none;
    min-width: 0;
}

.auth-logo img {
    height: 44px;
    width: auto;
}

.auth-logo-icon {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    color: var(--white);
    border-radius: var(--radius);
    background: var(--primary-gradient);
    box-shadow: var(--shadow-primary);
}

.auth-logo-text {
    font-size: var(--fs-xl);
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.auth-card h1,
.auth-card h2 {
    font-size: var(--fs-2xl);
    font-weight: 700;
    line-height: 1.3;
    color: var(--gray-900);
    text-align: center;
}

.auth-sub {
    margin: 4px 0 18px;
    font-size: var(--fs-base);
    line-height: 1.55;
    color: var(--gray-500);
    text-align: center;
}

/* --- Alerts -------------------------------------------------------------- */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 13px;
    margin-bottom: 14px;
    border-radius: var(--radius);
    font-size: var(--fs-base);
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.auth-alert > i {
    flex: 0 0 auto;
    margin-top: 3px;
    font-size: 15px;
}

.auth-alert strong {
    display: block;
    font-weight: 700;
}

.auth-alert p {
    font-size: var(--fs-sm);
    line-height: 1.55;
}

.auth-alert-error {
    background: var(--danger-light);
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.auth-alert-success {
    background: var(--success-light);
    color: #047857;
    border: 1px solid #a7f3d0;
}

.auth-alert-info {
    background: var(--primary-lighter);
    color: #9a3412;
    border: 1px solid var(--primary-100);
}

/* standalone note that follows a form instead of preceding it */
.auth-alert.auth-note {
    margin-top: 16px;
    margin-bottom: 0;
}

.auth-testlink {
    display: block;
    margin-top: 10px;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .65);
    font-size: var(--fs-sm);
    overflow-wrap: anywhere;
}

.auth-testlink a {
    color: var(--primary-dark);
    font-weight: 600;
    overflow-wrap: anywhere;
}

/* --- Fields (DESIGN-SPEC §4) --------------------------------------------- */
.auth-field {
    margin-bottom: 14px;
}

.auth-label {
    display: block;
    margin-bottom: 6px;
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--gray-700);
}

.auth-input {
    position: relative;
    display: block;
}

.auth-icon {
    position: absolute;
    top: 50%;
    inset-inline-start: 13px;
    transform: translateY(-50%);
    font-size: 15px;
    color: var(--gray-400);
    pointer-events: none;
    transition: color var(--transition);
    z-index: 1;
}

.auth-input .form-control {
    width: 100%;
    min-height: 44px;
    padding: 11px 14px;
    padding-inline-start: 40px;
    font-family: inherit;
    font-size: var(--fs-base);
    line-height: 1.5;
    color: var(--gray-900);
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.auth-input .form-control::placeholder {
    color: var(--gray-400);
}

.auth-input .form-control:focus {
    outline: none;
    background: var(--white);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-lighter);
}

.auth-input:focus-within .auth-icon {
    color: var(--primary);
}

/* password reveal — never overlaps the text in either direction */
.auth-input.has-toggle .form-control {
    padding-inline-end: 46px;
}

.auth-eye {
    position: absolute;
    top: 50%;
    inset-inline-end: 4px;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--gray-400);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
}

.auth-eye:hover {
    color: var(--primary);
    background: var(--primary-lighter);
}

.auth-hint {
    display: block;
    margin-top: 5px;
    font-size: var(--fs-sm);
    color: var(--gray-500);
}

.auth-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}

/* --- Meta row / checkboxes ------------------------------------------------ */
.auth-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 16px;
    font-size: var(--fs-base);
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-600);
    cursor: pointer;
    min-width: 0;
}

.auth-check input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.auth-check-start {
    align-items: flex-start;
    margin-bottom: 16px;
    font-size: var(--fs-base);
    line-height: 1.55;
    color: var(--gray-500);
}

.auth-check-start input[type="checkbox"] {
    margin-top: 3px;
}

.auth-check-start a,
.auth-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-check-start a:hover,
.auth-link:hover {
    text-decoration: underline;
}

/* --- Buttons (DESIGN-SPEC §4) -------------------------------------------- */
.btn-auth,
.btn-auth-outline {
    width: 100%;
    min-height: 44px;
    padding: 11px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-family: inherit;
    font-size: var(--fs-md);
    font-weight: 700;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
}

.btn-auth {
    color: var(--white);
    background: var(--primary);
    border: 2px solid var(--primary);
}

.btn-auth:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}

.btn-auth-outline {
    color: var(--gray-700);
    background: var(--white);
    border: 2px solid var(--gray-200);
}

.btn-auth-outline:hover {
    color: var(--gray-900);
    background: var(--primary-lighter);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.btn-auth-outline .fa-google {
    color: #ea4335;
}

/* --- Divider -------------------------------------------------------------- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    font-size: var(--fs-sm);
    color: var(--gray-400);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1 1 0;
    height: 1px;
    background: var(--gray-200);
}

/* --- Card footer ---------------------------------------------------------- */
.auth-foot {
    margin-top: 16px;
    text-align: center;
    font-size: var(--fs-base);
    color: var(--gray-500);
}

.auth-foot a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.auth-foot a:hover {
    text-decoration: underline;
}

.auth-foot-quiet a {
    color: var(--gray-500);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.auth-foot-quiet a:hover {
    color: var(--primary);
}

/* --- Back-to-store link ---------------------------------------------------
   Mobile: light chip on the light page. Desktop: translucent chip sitting on
   top of the dark brand panel (see the >=992px block). ---------------------- */
.auth-back {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 32px);
    margin: 14px 16px 0;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    background: var(--white);
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
    font-size: var(--fs-base);
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.auth-back:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
}

/* --- Steps progress (forgot-password) ------------------------------------- */
.auth-steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    margin-bottom: 18px;
}

.auth-step {
    flex: 0 1 100px;
    min-width: 0;
    text-align: center;
}

.auth-step-num {
    width: 30px;
    height: 30px;
    margin: 0 auto 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-sm);
    font-weight: 700;
    border-radius: var(--radius-full);
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    color: var(--gray-500);
    transition: all var(--transition);
}

.auth-step-label {
    display: block;
    font-size: var(--fs-xs);
    line-height: 1.35;
    color: var(--gray-500);
    overflow-wrap: anywhere;
}

.auth-step.active .auth-step-num {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
    box-shadow: var(--shadow-primary);
}

.auth-step.active .auth-step-label {
    color: var(--gray-900);
    font-weight: 700;
}

.auth-step.completed .auth-step-num {
    background: var(--gray-900);
    border-color: var(--gray-900);
    color: var(--primary);
}

.auth-step-line {
    flex: 0 1 34px;
    min-width: 10px;
    height: 2px;
    margin-top: 14px;
    border-radius: 2px;
    background: var(--gray-200);
}

.auth-step-line.completed {
    background: var(--primary);
}

/* --- Success state -------------------------------------------------------- */
.auth-success {
    text-align: center;
}

.auth-success-icon {
    width: 64px;
    height: 64px;
    margin: 4px auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    border-radius: var(--radius-full);
    background: var(--success-light);
    color: var(--success);
}

.auth-success p {
    margin: 6px 0 18px;
    font-size: var(--fs-base);
    line-height: 1.6;
    color: var(--gray-500);
}

/* ==========================================================================
   Responsive — DESIGN-SPEC §5
   ========================================================================== */

/* Split layout from 992px up; single centred card below it. */
@media (min-width: 992px) {
    .auth-shell {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    }

    .auth-brand {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        overflow: hidden;              /* decorations can never escape */
        padding: clamp(28px, 3.6vw, 56px);
        color: var(--white);
        background: linear-gradient(150deg, var(--gray-900) 0%, var(--gray-800) 100%);
    }

    .auth-brand::before,
    .auth-brand::after {
        content: '';
        position: absolute;
        border-radius: 50%;
        pointer-events: none;
    }

    .auth-brand::before {
        width: 520px;
        height: 520px;
        top: -150px;
        inset-inline-start: -170px;
        background: radial-gradient(circle, rgba(249, 115, 22, .32) 0%, rgba(249, 115, 22, 0) 70%);
    }

    .auth-brand::after {
        width: 440px;
        height: 440px;
        bottom: -170px;
        inset-inline-end: -140px;
        background: radial-gradient(circle, rgba(249, 115, 22, .18) 0%, rgba(249, 115, 22, 0) 70%);
    }

    .auth-back {
        position: absolute;
        top: 20px;
        inset-inline-start: 24px;
        z-index: 5;
        margin: 0;
        max-width: calc(100% - 48px);
        background: rgba(255, 255, 255, .10);
        border-color: rgba(255, 255, 255, .20);
        color: rgba(255, 255, 255, .92);
        box-shadow: none;
    }

    .auth-back:hover {
        background: rgba(249, 115, 22, .24);
        border-color: rgba(249, 115, 22, .60);
        color: var(--white);
    }

    .auth-panel {
        padding: 32px 24px;
    }
}

@media (max-width: 768px) {
    :root {
        --card-pad: 16px;
    }

    .auth-panel {
        padding: 18px 14px;
    }

    .auth-card h1,
    .auth-card h2 {
        font-size: var(--fs-xl);
    }

    .auth-logo-icon {
        width: 38px;
        height: 38px;
        font-size: 17px;
    }

    .auth-logo img {
        height: 38px;
    }

    .auth-logo-text {
        font-size: var(--fs-lg);
    }

    /* Tap targets >= 40px (§5.4) */
    .auth-check,
    .auth-meta .auth-link {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }

    .auth-check-start {
        align-items: flex-start;
        min-height: 0;
    }
}

@media (max-width: 560px) {
    .auth-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 480px) {
    .auth-panel {
        padding: 14px 12px;
    }

    .auth-back {
        margin: 12px 12px 0;
        padding: 7px 12px;
        font-size: var(--fs-sm);
        max-width: calc(100% - 24px);
    }

    .auth-step {
        flex: 0 1 84px;
    }

    .auth-step-line {
        flex: 0 1 20px;
    }
}
