:root {
    --auth-primary: #4852D9;
    --auth-primary-dark: #3941C7;
    --auth-secondary: #6671E5;
    --auth-surface: rgba(255, 255, 255, 0.97);
    --auth-muted: #64748b;
    --auth-border: #e2e8f0;
    --auth-radius: 1.25rem;
    --auth-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.18);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.auth-page {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: 'Tajawal', 'Poppins', system-ui, sans-serif;
    color: #0f172a;
    background: #3941C7;
}

.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 60% at 100% 0%, rgba(102, 113, 229, 0.45), transparent 55%),
        radial-gradient(ellipse 70% 50% at 0% 100%, rgba(57, 65, 199, 0.5), transparent 50%),
        linear-gradient(145deg, #6671E5 0%, #4852D9 45%, #3941C7 100%);
}

.auth-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.auth-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

@media (min-width: 1024px) {
    .auth-shell {
        flex-direction: row;
    }
}

.auth-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    pointer-events: none;
}

.auth-topbar > * {
    pointer-events: auto;
}

.auth-brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #fff;
}

.auth-brand-mark__icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.875rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.auth-brand-mark__title {
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.auth-panel-brand {
    display: none;
    flex: 1;
    min-width: 0;
    padding: 6rem 3rem 3rem;
    color: #fff;
    flex-direction: column;
    justify-content: center;
}

@media (min-width: 1024px) {
    .auth-panel-brand {
        display: flex;
        max-width: 50%;
    }
}

.auth-panel-brand h1 {
    margin: 0 0 1rem;
    font-size: clamp(1.75rem, 3vw, 2.75rem);
    font-weight: 900;
    line-height: 1.25;
}

.auth-panel-brand .lead {
    margin: 0 0 2rem;
    font-size: 1.05rem;
    opacity: 0.92;
    max-width: 28rem;
}

.auth-feature {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.15rem;
    margin-bottom: 0.75rem;
    border-radius: var(--auth-radius);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    transition: transform 0.2s ease, background 0.2s ease;
}

.auth-feature:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.14);
}

.auth-feature__icon {
    width: 2.75rem;
    height: 2.75rem;
    flex-shrink: 0;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.auth-feature h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    font-weight: 700;
}

.auth-feature p {
    margin: 0;
    font-size: 0.875rem;
    opacity: 0.88;
    line-height: 1.5;
}

.auth-panel-form {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5.5rem 1rem 2rem;
}

@media (min-width: 1024px) {
    .auth-panel-form {
        padding: 3rem 2.5rem;
        max-width: 50%;
    }
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--auth-surface);
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: var(--auth-shadow);
    padding: 2rem 1.75rem;
}

@media (min-width: 480px) {
    .auth-card {
        padding: 2.25rem 2rem;
    }
}

.auth-card--wide {
    max-width: 920px;
}

.auth-card__head {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-card__head h2 {
    margin: 0 0 0.5rem;
    font-size: 1.65rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.auth-card__head p {
    margin: 0;
    color: var(--auth-muted);
    font-size: 0.95rem;
}

.auth-field {
    margin-bottom: 1.15rem;
}

.auth-field label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: #334155;
}

.auth-input-wrap {
    position: relative;
}

.auth-input {
    width: 100%;
    padding: 0.85rem 2.75rem;
    font-size: 0.95rem;
    font-family: inherit;
    border-radius: var(--auth-radius);
    border: 1.5px solid var(--auth-border);
    background: #f8fafc;
    color: #0f172a;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.auth-input:focus {
    outline: none;
    border-color: var(--auth-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(72, 82, 217, 0.12);
}

.auth-input-wrap .auth-input-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

[dir="rtl"] .auth-input-wrap .auth-input-icon {
    right: 1rem;
}

[dir="ltr"] .auth-input-wrap .auth-input-icon {
    left: 1rem;
}

.auth-input-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.35rem;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 0.5rem;
}

.auth-input-toggle:hover {
    color: var(--auth-primary);
}

[dir="rtl"] .auth-input-toggle {
    left: 0.65rem;
}

[dir="ltr"] .auth-input-toggle {
    right: 0.65rem;
}

.auth-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: #475569;
}

.auth-check input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--auth-primary);
}

.auth-link {
    color: var(--auth-primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-link:hover {
    color: var(--auth-primary-dark);
    text-decoration: underline;
}

.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.9rem 1.25rem;
    border: none;
    border-radius: var(--auth-radius);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-dark));
    color: #fff;
    box-shadow: 0 8px 20px rgba(72, 82, 217, 0.28);
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(72, 82, 217, 0.35);
}

.auth-btn:active {
    transform: translateY(0);
}

.auth-footer-text {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--auth-muted);
}

.auth-alert-error {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 0.875rem;
}

.auth-lang {
    position: relative;
}

.auth-lang__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    color: #fff;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.auth-lang__menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    min-width: 11rem;
    padding: 0.35rem;
    border-radius: 0.875rem;
    background: #fff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    max-height: 70vh;
    overflow-y: auto;
}

[dir="rtl"] .auth-lang__menu {
    left: 0;
}

[dir="ltr"] .auth-lang__menu {
    right: 0;
}

.auth-lang.is-open .auth-lang__menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.auth-lang__option {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.85rem;
    border: none;
    background: transparent;
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    color: #334155;
    cursor: pointer;
    text-align: inherit;
}

.auth-lang__option:hover {
    background: #f1f5f9;
}

/* Register-specific (keeps existing step classes working) */
.register-main {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 5.5rem 1rem 2rem;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

@media (min-width: 768px) {
    .register-main {
        padding-top: 6rem;
        align-items: center;
    }
}

.register-promo {
    background: linear-gradient(135deg, #eef2ff, #f8fafc);
    border: 1px solid #e2e8f0;
    border-radius: 1.25rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 767px) {
    .register-promo .register-promo-grid {
        grid-template-columns: 1fr;
    }

    .step-container {
        gap: 0.35rem;
    }

    .step-title {
        font-size: 0.65rem;
        text-align: center;
    }
}

.help-block {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: #dc2626;
}

.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    min-height: 46px;
    border-radius: var(--auth-radius) !important;
    border: 1.5px solid var(--auth-border) !important;
    padding: 0.4rem 2.5rem 0.4rem 0.75rem;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 2rem;
    padding-right: 0;
}
