/* ==========================================================================
   MARKOPEDIA — SIMPLE LUXURY AUTHENTICATION STYLES (LTR & RTL)
   ========================================================================== */

:root {
    --auth-primary: #6254e7;
    --auth-primary-hover: #5041db;
    --auth-primary-light: rgba(98, 84, 231, 0.08);
    --auth-primary-glow: rgba(98, 84, 231, 0.15);
    --auth-heading: #1e1b4b;
    --auth-text: #334155;
    --auth-muted: #64748b;
    --auth-subtle: #94a3b8;
    --auth-border: #e2e8f0;
    --auth-border-focus: #6254e7;
    --auth-bg-page: #f8fafc;
    --auth-bg-card: #ffffff;
    --auth-danger: #ef4444;
    --auth-danger-bg: #fef2f2;
    --auth-danger-border: rgba(239, 68, 68, 0.25);
    --auth-success: #10b981;
    --auth-success-bg: #ecfdf5;
    --auth-success-border: rgba(16, 185, 129, 0.25);
    --auth-radius-card: 20px;
    --auth-radius-input: 12px;
    --auth-radius-btn: 12px;
    --auth-font: 'Inter', 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body.auth-page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: var(--auth-font);
    background-color: var(--auth-bg-page);
    background-image:
        radial-gradient(at 0% 0%, rgba(98, 84, 231, 0.04) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(98, 84, 231, 0.03) 0px, transparent 50%);
    color: var(--auth-text);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Top Utility Bar (Language switch & Back to Shop) */
.auth-topbar {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 24px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-topbar-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-muted);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid var(--auth-border);
    transition: all 0.2s ease;
}

.auth-topbar-link:hover {
    color: var(--auth-primary);
    border-color: var(--auth-primary);
    background: #ffffff;
}

.auth-topbar-link svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* Main Auth Container */
.auth-main {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 20px 40px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--auth-bg-card);
    border-radius: var(--auth-radius-card);
    border: 1px solid var(--auth-border);
    box-shadow: 0 20px 45px -15px rgba(15, 23, 42, 0.07), 0 0 1px 1px rgba(15, 23, 42, 0.02);
    padding: 36px 36px 32px;
    position: relative;
    overflow: hidden;
}

.auth-card--wide {
    max-width: 480px;
}

/* Header & Logo */
.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo-link {
    display: inline-block;
    margin-bottom: 20px;
    text-decoration: none;
    line-height: 1;
}

.auth-logo-img {
    height: 48px;
    width: auto;
    max-width: 170px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.auth-title {
    margin: 0 0 8px;
    font-size: 23px;
    font-weight: 700;
    color: var(--auth-heading);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.auth-subtitle {
    margin: 0;
    font-size: 14px;
    color: var(--auth-muted);
    line-height: 1.5;
}

/* Alerts */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 16px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.45;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.auth-alert--danger {
    background: var(--auth-danger-bg);
    border-color: var(--auth-danger-border);
    color: #991b1b;
}

.auth-alert--success {
    background: var(--auth-success-bg);
    border-color: var(--auth-success-border);
    color: #065f46;
}

.auth-alert svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Form Groups & Inputs */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    text-align: start;
}

.auth-label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-label-link {
    font-size: 12px;
    font-weight: 500;
    color: var(--auth-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-label-link:hover {
    color: var(--auth-primary-hover);
    text-decoration: underline;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.auth-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-family: inherit;
    font-size: 14.5px;
    color: var(--auth-heading);
    background: #ffffff;
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-radius-input);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    outline: none;
    -webkit-appearance: none;
    box-sizing: border-box;
}

.auth-input:focus {
    border-color: var(--auth-border-focus);
    box-shadow: 0 0 0 3px var(--auth-primary-glow);
    background: #ffffff;
}

.auth-input::placeholder {
    color: var(--auth-subtle);
    font-size: 14px;
}

.auth-input.is-invalid {
    border-color: var(--auth-danger);
    background: #fffafa;
}

.auth-input.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.auth-field-error {
    font-size: 12px;
    color: var(--auth-danger);
    margin-top: 4px;
    display: block;
}

/* Phone input with country prefix badge */
.auth-phone-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-phone-prefix {
    position: absolute;
    inset-inline-start: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 700;
    color: #475569;
    padding-inline-end: 10px;
    border-inline-end: 1px solid #cbd5e1;
    pointer-events: none;
    z-index: 2;
    direction: ltr !important;
}

.auth-phone-prefix svg {
    width: 18px;
    height: 13px;
    border-radius: 2px;
    display: block;
}

.auth-input--phone {
    padding-inline-start: 78px !important;
    letter-spacing: 0.03em;
    direction: ltr !important;
    text-align: start !important;
}

/* Password Toggle Icon */
.auth-password-toggle {
    position: absolute;
    inset-inline-end: 12px;
    background: transparent;
    border: none;
    padding: 6px;
    margin: 0;
    color: var(--auth-muted);
    cursor: pointer;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
    z-index: 2;
}

.auth-password-toggle:hover {
    color: var(--auth-heading);
}

.auth-password-toggle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-input--password {
    padding-inline-end: 44px !important;
}

/* Primary Button */
.auth-btn {
    width: 100%;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    background: var(--auth-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--auth-radius-btn);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(98, 84, 231, 0.25);
    margin-top: 6px;
    outline: none;
}

.auth-btn:hover {
    background: var(--auth-primary-hover);
    box-shadow: 0 6px 18px rgba(98, 84, 231, 0.35);
}

.auth-btn:active {
    transform: scale(0.99);
}

.auth-btn:disabled,
.auth-btn[aria-busy="true"] {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

/* Spinner inside button */
.auth-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
    display: none;
}

.auth-btn[aria-busy="true"] .auth-spinner {
    display: inline-block;
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

/* Footer & Switch Form */
.auth-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
    text-align: center;
    font-size: 13.5px;
    color: var(--auth-muted);
}

.auth-footer a {
    color: var(--auth-primary);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-footer a:hover {
    color: var(--auth-primary-hover);
    text-decoration: underline;
}

/* OTP Specific UI */
.auth-otp-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #ecfdf5;
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #065f46;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
}

.auth-otp-badge svg {
    width: 16px;
    height: 16px;
    fill: #25D366;
}

.auth-otp-grid {
    display: flex;
    justify-content: center;
    gap: 10px;
    direction: ltr !important;
    margin: 12px 0 6px;
}

.auth-otp-box {
    width: 48px;
    height: 56px;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    border: 1.5px solid var(--auth-border);
    border-radius: 12px;
    background: #ffffff;
    color: var(--auth-heading);
    outline: none;
    transition: all 0.2s ease;
    -moz-appearance: textfield;
}

.auth-otp-box::-webkit-outer-spin-button,
.auth-otp-box::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.auth-otp-box:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px var(--auth-primary-glow);
    background: #fdfdff;
}

.auth-otp-box.is-filled {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.auth-resend-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    color: var(--auth-muted);
    margin-top: 10px;
}

.auth-resend-btn {
    background: none;
    border: none;
    color: var(--auth-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.15s ease;
}

.auth-resend-btn:hover:not(:disabled) {
    color: var(--auth-primary-hover);
}

.auth-resend-btn:disabled {
    color: var(--auth-subtle);
    cursor: not-allowed;
    text-decoration: none;
}

/* Page bottom copyright / trust */
.auth-bottom {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: #94a3b8;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .auth-card {
        padding: 28px 22px 24px;
        border-radius: 16px;
        box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.05);
    }

    .auth-topbar {
        padding: 16px 16px 8px;
    }

    .auth-otp-grid {
        gap: 6px;
    }

    .auth-otp-box {
        width: 42px;
        height: 50px;
        font-size: 19px;
    }

    .auth-title {
        font-size: 21px;
    }
}

