/* Shared flat auth chrome — login + register normalization + dark mode */

/* ─── Body overrides ─── */

body.page-login {
    display: block !important;
    flex-direction: unset !important;
    align-items: unset !important;
    justify-content: unset !important;
    padding: 0 !important;
    min-height: 100vh;
    margin: 0;
    background: #f4f7fb;
    color: #0f172a;
}

.auth-shell {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* ─── Topbar ─── */

.auth-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem clamp(1rem, 4vw, 2rem);
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

/* ─── Brand ─── */

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 800;
    font-size: clamp(1rem, 2.2vw, 1.12rem);
    letter-spacing: -0.02em;
    text-decoration: none;
    color: var(--ink, #0f172a);
}

.auth-brand__mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.auth-brand__mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ─── Topbar actions ─── */

.auth-topbar__actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

/* ─── Language dropdown ─── */

.lang-dropdown {
    position: relative;
}

.lang-dropdown__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 0.75rem 0.42rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: rgba(255, 255, 255, 0.95);
    color: var(--ink-muted, #475569);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, background 0.2s ease;
    user-select: none;
}

.lang-dropdown__btn:hover {
    border-color: rgba(13, 148, 136, 0.35);
    color: #0f766e;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.lang-dropdown__btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.35), 0 0 0 1px rgba(13, 148, 136, 0.5);
}

.lang-dropdown__btn .flag {
    width: 18px;
    height: 13px;
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.lang-dropdown__btn .flag svg {
    display: block;
    width: 100%;
    height: 100%;
}

.lang-dropdown__btn .chevron {
    font-size: 0.6rem;
    opacity: 0.5;
    transition: transform 0.2s ease;
    margin-inline-start: 0.15rem;
}

.lang-dropdown.is-open .lang-dropdown__btn .chevron {
    transform: rotate(180deg);
}

/* Dropdown menu */
.lang-dropdown__menu {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-end: 0;
    min-width: 180px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.04);
    padding: 6px;
    z-index: 100;
    display: none;
}

.lang-dropdown.is-open .lang-dropdown__menu {
    display: block;
}

.lang-dropdown__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #334155;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    text-align: start;
    transition: background 0.15s ease, color 0.15s ease;
}

.lang-dropdown__item:hover {
    background: rgba(13, 148, 136, 0.08);
    color: #0f766e;
}

.lang-dropdown__item.is-active {
    background: rgba(13, 148, 136, 0.12);
    color: #0f766e;
    font-weight: 800;
}

.lang-dropdown__item .flag {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.lang-dropdown__item .flag svg {
    display: block;
    width: 100%;
    height: 100%;
}

.lang-dropdown__item .name {
    flex: 1;
    min-width: 0;
}

.lang-dropdown__item .code {
    font-size: 0.7rem;
    font-weight: 700;
    opacity: 0.45;
    text-transform: uppercase;
}

/* ─── Theme toggle (pill icon button) ─── */

.auth-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: rgba(255, 255, 255, 0.95);
    color: var(--ink-muted, #475569);
    font-family: inherit;
    font-size: 0.92rem;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.auth-theme-toggle:hover {
    border-color: rgba(13, 148, 136, 0.35);
    color: #0f766e;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.auth-theme-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.35), 0 0 0 1px rgba(13, 148, 136, 0.5);
}

/* ─── CTA link (gradient pill) ─── */

.auth-link-secondary,
.register-link-login {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.48rem 1rem;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    color: #f8fafc;
    background: linear-gradient(120deg, #0f766e 0%, #134e4a 100%);
    box-shadow: 0 4px 16px rgba(15, 118, 110, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: transform 0.18s ease, box-shadow 0.22s ease, filter 0.2s ease;
}

.auth-link-secondary:hover,
.register-link-login:hover {
    filter: brightness(1.06);
    box-shadow: 0 8px 26px rgba(15, 118, 110, 0.32);
    transform: translateY(-1px);
}

.auth-link-secondary:active,
.register-link-login:active {
    transform: translateY(0);
}

.auth-link-secondary:focus-visible,
.register-link-login:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.45), 0 4px 16px rgba(15, 118, 110, 0.28);
}

/* ─── Main area ─── */

.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1rem, 3vw, 1.75rem);
}

/* ─── Auth card ─── */

.auth-card {
    width: 100%;
    max-width: 520px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.07);
    border-radius: 20px;
    padding: clamp(1.5rem, 3vw, 2rem);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 18px 48px rgba(15, 23, 42, 0.08);
    overflow: clip;
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.auth-card__head h1 {
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--ink, #0f172a);
}

.auth-card__sub {
    margin: 0 0 1.25rem;
    color: var(--ink-muted, #475569);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ─── Form fields ─── */

.auth-field {
    margin-bottom: 1rem;
}

.auth-field label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--ink, #0f172a);
}

.auth-field input {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    font-size: 1rem;
    font-family: inherit;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    background: #fff;
    color: var(--ink, #0f172a);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-field input::placeholder {
    color: var(--ink-muted, #94a3b8);
}

.auth-field input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.25);
    border-color: var(--accent, #0d9488);
}

/* ─── Banner / errors ─── */

.auth-banner {
    padding: 11px 13px;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.auth-banner--error {
    display: none;
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.22);
    color: #991b1b;
}

.auth-banner--error.is-visible {
    display: block;
}

/* ─── Submit button ─── */

.auth-submit.btn {
    width: 100%;
    margin-top: 0.5rem;
}

/* ─── Register page overrides ─── */

body.page-register.auth-flat .register-showcase {
    background: #0f766e !important;
    color: #f8fafc !important;
}

body.page-register.auth-flat .register-card {
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08) !important;
}

body.page-register.auth-flat .register-topbar {
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

body.page-register.auth-flat .register-brand__mark {
    background: linear-gradient(135deg, #0d9488 0%, #115e59 50%, #0f172a 100%);
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
}

/* ─── Auth divider ("أو") ─── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 18px 0 14px;
    color: #94a3b8;
    font-size: 0.82rem;
    font-weight: 700;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(15, 23, 42, 0.1);
}

/* ─── Google OAuth button ─── */
.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 700;
    color: #1f2937;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.16);
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.google-btn:hover:not([disabled]) {
    background: #f8fafc;
    border-color: rgba(15, 23, 42, 0.28);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}
.google-btn:active:not([disabled]) {
    transform: translateY(1px);
}
.google-btn svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}
.google-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════
   DARK MODE — auth pages (unified)
   ═══════════════════════════════════════ */

html[data-theme="dark"] body.page-login,
html[data-theme="dark"] body.page-register {
    background: #0f172a;
}

html[data-theme="dark"] .auth-topbar,
html[data-theme="dark"] body.page-register.auth-flat .register-topbar {
    background: rgba(15, 23, 42, 0.82);
    border-bottom-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .auth-brand {
    color: #f1f5f9;
}

html[data-theme="dark"] .lang-dropdown__btn {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
}

html[data-theme="dark"] .lang-dropdown__btn:hover {
    border-color: rgba(13, 148, 136, 0.45);
    color: #5eead4;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

html[data-theme="dark"] .lang-dropdown__menu {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .lang-dropdown__item {
    color: #cbd5e1;
}

html[data-theme="dark"] .lang-dropdown__item:hover {
    background: rgba(13, 148, 136, 0.12);
    color: #5eead4;
}

html[data-theme="dark"] .lang-dropdown__item.is-active {
    background: rgba(13, 148, 136, 0.16);
    color: #5eead4;
}

html[data-theme="dark"] .auth-theme-toggle {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
}

html[data-theme="dark"] .auth-theme-toggle:hover {
    border-color: rgba(13, 148, 136, 0.45);
    color: #5eead4;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

html[data-theme="dark"] .auth-card {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 18px 48px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .auth-card__head h1 {
    color: #f1f5f9;
}

html[data-theme="dark"] .auth-card__sub {
    color: #94a3b8;
}

html[data-theme="dark"] .auth-field label {
    color: #e2e8f0;
}

html[data-theme="dark"] .auth-field input {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

html[data-theme="dark"] .auth-field input::placeholder {
    color: #64748b;
}

html[data-theme="dark"] .auth-field input:focus {
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.35);
}

html[data-theme="dark"] .auth-banner--error {
    background: rgba(220, 38, 38, 0.12);
    color: #fca5a5;
    border-color: rgba(220, 38, 38, 0.25);
}

html[data-theme="dark"] .auth-submit.btn {
    background: linear-gradient(125deg, #0f766e 0%, #0d9488 50%, #134e4a 100%);
}

/* Register dark mode (unified with login) */
html[data-theme="dark"] body.page-register.auth-flat .register-card {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] body.page-register.auth-flat .register-showcase {
    background: linear-gradient(155deg, #0f172a 0%, #134e4a 42%, #0f766e 100%) !important;
}

html[data-theme="dark"] body.page-register.auth-flat .register-card .rp-field__label,
html[data-theme="dark"] body.page-register.auth-flat .register-card h1,
html[data-theme="dark"] body.page-register.auth-flat .register-card h2 {
    color: #f1f5f9;
}

html[data-theme="dark"] body.page-register.auth-flat .register-card .rp-input-wrap {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] body.page-register.auth-flat .register-card .rp-input-wrap input {
    color: #f1f5f9;
}

html[data-theme="dark"] body.page-register.auth-flat .register-card .rp-input-wrap input::placeholder {
    color: #64748b;
}

html[data-theme="dark"] body.page-register.auth-flat .register-card .rp-submit {
    background: linear-gradient(125deg, #0f766e 0%, #0d9488 45%, #134e4a 100%);
}

html[data-theme="dark"] body.page-register.auth-flat .register-card .register-footer {
    color: #94a3b8;
    background: transparent;
}

html[data-theme="dark"] body.page-register.auth-flat .register-card .rp-field__hint {
    color: #64748b;
}

html[data-theme="dark"] body.page-register.auth-flat .register-card .rp-field__msg {
    color: #fb7185;
}

html[data-theme="dark"] body.page-register.auth-flat .register-card .rp-form-alert--error {
    background: rgba(220, 38, 38, 0.12);
    color: #fca5a5;
    border-color: rgba(220, 38, 38, 0.25);
}

html[data-theme="dark"] body.page-register.auth-flat .register-showcase__title,
html[data-theme="dark"] body.page-register.auth-flat .register-showcase__lead,
html[data-theme="dark"] body.page-register.auth-flat .register-showcase__list li {
    color: #f1f5f9;
}

html[data-theme="dark"] body.page-register.auth-flat .register-showcase__eyebrow {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

html[data-theme="dark"] body.page-register.auth-flat .register-showcase__footer {
    color: #64748b;
}

html[data-theme="dark"] .auth-divider {
    color: #64748b;
}
html[data-theme="dark"] .auth-divider::before,
html[data-theme="dark"] .auth-divider::after {
    background: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .google-btn {
    color: #e2e8f0;
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.12);
}
html[data-theme="dark"] .google-btn:hover:not([disabled]) {
    background: #334155;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
