/* App-style login / register (matches Kawenter mobile auth screens) */

:root {
    --auth-blue: #4361ee;
    --auth-blue-deep: #1c4494;
    --auth-ink: #1f2937;
    --auth-muted: #6b7280;
    --auth-border: #e5e7eb;
    --auth-card-radius: 28px;
    --auth-btn-radius: 14px;
    --auth-field-radius: 14px;
}

/* Full-bleed app auth (register / legacy) */
body.auth-page:not(.auth-page--site) {
    min-height: 100vh;
    margin: 0;
    padding: 0 !important;
    background: var(--auth-blue);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--auth-ink);
}

body.auth-page.page-loading-active {
    overflow: auto;
}

/* Site-integrated login (header + footer + shared page chrome) */
body.auth-page--site {
    background: var(--bg-light, #f1f4f8);
    color: var(--text-dark, #000);
    font-family: 'GM', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* While restoring Firebase session on login/register, avoid interacting with the form */
body.auth-checking-session .auth-card-site,
body.auth-checking-session .auth-main {
    pointer-events: none;
    opacity: 0.55;
}

body.auth-page--site .auth-main {
    min-height: calc(100vh - 200px);
}

body.auth-page--site .auth-hero {
    background: linear-gradient(135deg, #296ff9 0%, #662acc 100%);
    color: #fff;
    padding: calc(var(--navbar-clearance, 56px) + var(--smart-app-banner-height, 0px) + 3.5rem) 0 3rem;
    text-align: center;
}

body.auth-page--site .auth-hero-content {
    max-width: 640px;
    margin: 0 auto;
}

body.auth-page--site .auth-hero .eyebrow {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
    margin-bottom: 0.75rem;
}

body.auth-page--site .auth-hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.35rem);
    font-weight: 700;
    margin: 0 0 0.35rem;
    line-height: 1.2;
    color: #fff;
}

body.auth-page--site .auth-hero .hero-subtitle {
    font-size: 1.05rem;
    opacity: 0.95;
    line-height: 1.45;
    max-width: 520px;
    margin: 0 auto;
}

body.auth-page--site .auth-content {
    padding: 0 0 4rem;
    margin-top: -2rem;
}

body.auth-page--site .auth-card-site {
    background: #fff;
    border-radius: 16px;
    padding: 2.25rem 1.75rem;
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

body.auth-page--site .auth-card-site--register {
    max-width: 520px;
}

body.auth-page--site .auth-nationality-field {
    cursor: pointer;
}

body.auth-page--site .auth-nationality-field .auth-nationality-btn {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 0.2rem 0;
    padding-inline-end: 1.5rem;
    font-size: 1.05rem;
    color: var(--text-dark, #000);
    font-family: inherit;
    text-align: start;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: auto;
}

body.auth-page--site .auth-nationality-field .auth-nationality-btn.is-placeholder {
    color: #9ca3af;
}

body.auth-page--site .auth-nationality-field .auth-flag {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    flex: 0 0 auto;
}

body.auth-page--site .auth-nationality-field .auth-chevron {
    position: static;
    margin-inline-start: auto;
    color: #9ca3af;
    font-size: 0.75rem;
    pointer-events: none;
    flex-shrink: 0;
}

body.auth-page--site .auth-card-title {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    color: var(--text-dark, #000);
}

body.auth-page--site .auth-card-subtitle {
    margin: 0 0 1.75rem;
    text-align: center;
    color: var(--text-light, #757575);
    font-size: 0.98rem;
    line-height: 1.55;
}

body.auth-page--site .auth-actions {
    margin-bottom: 0.5rem;
}

body.auth-page--site .auth-btn--google,
body.auth-page--site .auth-btn--email {
    border-width: 3px;
    border-color: #e5e7eb;
    border-radius: 14px;
    min-height: 56px;
    font-weight: 600;
}

body.auth-page--site .auth-btn--google:hover,
body.auth-page--site .auth-btn--email:hover {
    border-color: var(--primary-color, #4361ee);
}

body.auth-page--site .auth-form {
    gap: 1rem;
}

body.auth-page--site .auth-form .form-field {
    margin-bottom: 0;
}

body.auth-page--site .auth-password-field {
    position: relative;
}

body.auth-page--site .auth-password-field .form-input {
    padding-inline-end: 2.5rem;
}

body.auth-page--site .auth-form-actions .btn-primary {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.5rem;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, #4361ee 0%, #3652d4 100%);
    color: #fff;
    font-family: 'GM', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

body.auth-page--site .auth-form-actions .btn-primary:hover {
    background: linear-gradient(135deg, #3652d4 0%, #2f46c0 100%);
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.28);
}

body.auth-page--site .auth-form-actions .btn-primary.is-loading {
    opacity: 0.85;
    cursor: wait;
    gap: 0.55rem;
}

body.auth-page--site .auth-form-actions .btn-primary .auth-btn-spinner {
    font-size: 0.95rem;
    line-height: 1;
}

body.auth-page--site .auth-form-actions .btn-primary .auth-btn-spinner[hidden] {
    display: none !important;
}

body.auth-page--site .auth-legal {
    padding-top: 1.75rem;
}

body.auth-page--site .auth-legal a {
    color: var(--primary-color, #4361ee);
}

@media (min-width: 768px) {
    body.auth-page--site .auth-card-site {
        padding: 2.5rem;
    }
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.14) 0%, transparent 42%),
        radial-gradient(circle at 86% 8%, rgba(0, 0, 0, 0.12) 0%, transparent 36%),
        var(--auth-blue);
}

.auth-top {
    position: relative;
    flex: 0 0 auto;
    padding: 18px 20px 28px;
    color: #fff;
    text-align: center;
}

.auth-close {
    position: absolute;
    top: 16px;
    inset-inline-start: 16px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 1.35rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-close:hover,
.auth-close:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    text-decoration: none;
    color: #fff;
}

.auth-brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.auth-brand-mark img {
    width: 26px;
    height: 28px;
    display: block;
}

.auth-brand-name {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.auth-card {
    flex: 1 1 auto;
    background: #fff;
    border-radius: var(--auth-card-radius) var(--auth-card-radius) 0 0;
    padding: 28px 22px 28px;
    display: flex;
    flex-direction: column;
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.08);
}

.auth-card--register {
    max-width: 520px;
    padding-top: 32px;
}

.auth-title {
    margin: 0 0 10px;
    font-size: 1.55rem;
    font-weight: 800;
    text-align: center;
    color: var(--auth-ink);
    line-height: 1.35;
}

.auth-subtitle {
    margin: 0 0 28px;
    text-align: center;
    color: var(--auth-muted);
    font-size: 0.98rem;
    line-height: 1.55;
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-btn {
    appearance: none;
    border: 1.5px solid transparent;
    border-radius: var(--auth-btn-radius);
    min-height: 54px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
}

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

.auth-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.auth-btn__icon {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.auth-btn--apple {
    background: #111;
    color: #fff;
}

.auth-btn--apple:hover {
    background: #000;
}

.auth-btn--google,
.auth-btn--email,
.auth-btn--outline {
    background: #fff;
    color: #374151;
    border-color: var(--auth-border);
}

.auth-btn--google:hover,
.auth-btn--email:hover,
.auth-btn--outline:hover {
    border-color: #d1d5db;
    background: #fafafa;
}

.auth-btn--primary {
    background: var(--auth-blue);
    color: #fff;
    border-color: var(--auth-blue);
    width: 100%;
}

.auth-btn--primary:hover {
    background: var(--auth-blue-deep);
    border-color: var(--auth-blue-deep);
}

.auth-guest {
    margin: 18px 0 0;
    text-align: center;
}

.auth-guest a,
.auth-text-link {
    color: var(--auth-muted);
    text-decoration: none;
    font-size: 0.98rem;
    font-weight: 500;
    background: none;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}

.auth-guest a:hover,
.auth-text-link:hover {
    color: var(--auth-ink);
}

.auth-lang {
    margin: 22px auto 0;
    display: flex;
    justify-content: center;
}

.auth-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    color: var(--auth-muted);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    padding: 6px 10px;
    border-radius: 8px;
}

.auth-lang-btn:hover {
    background: #f3f4f6;
    color: var(--auth-ink);
}

.auth-legal {
    margin-top: auto;
    padding-top: 28px;
    text-align: center;
    color: var(--auth-muted);
    font-size: 0.82rem;
    line-height: 1.55;
}

.auth-legal a {
    color: var(--auth-blue);
    text-decoration: none;
    font-weight: 600;
}

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

/* Override global RTL text-align:right so auth centered copy stays centered */
html[dir="rtl"] body.auth-page .auth-title,
html[dir="rtl"] body.auth-page .auth-subtitle,
html[dir="rtl"] body.auth-page .auth-card-title,
html[dir="rtl"] body.auth-page .auth-card-subtitle,
html[dir="rtl"] body.auth-page .auth-hero .eyebrow,
html[dir="rtl"] body.auth-page .auth-hero h1,
html[dir="rtl"] body.auth-page .auth-hero .hero-subtitle,
html[dir="rtl"] body.auth-page .auth-legal,
html[dir="rtl"] body.auth-page .auth-legal span:not(.fas):not(.far):not(.fab):not([class*="fa-"]),
html[dir="rtl"] body.auth-page .auth-legal a:not([class*="fa-"]),
html[dir="rtl"] body.auth-page .auth-switch,
html[dir="rtl"] body.auth-page .auth-switch span:not(.fas):not(.far):not(.fab):not([class*="fa-"]),
html[dir="rtl"] body.auth-page .auth-switch a:not([class*="fa-"]),
html[dir="rtl"] body.auth-page .auth-back,
html[dir="rtl"] body.auth-page .auth-social-note {
    text-align: center !important;
    direction: rtl;
}

html[dir="rtl"] body.auth-page .auth-btn {
    direction: rtl;
}

html[dir="rtl"] body.auth-page--site .form-field {
    flex-direction: row;
}

html[dir="rtl"] body.auth-page--site .form-input {
    text-align: right;
}

/* Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-field {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 54px;
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-field-radius);
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-field:focus-within {
    border-color: var(--auth-blue);
    box-shadow: 0 0 0 3px rgba(21, 112, 239, 0.12);
}

.auth-field__icon {
    position: absolute;
    inset-inline-start: 14px;
    color: #9ca3af;
    font-size: 1.05rem;
    pointer-events: none;
    z-index: 1;
}

.auth-field__toggle {
    position: absolute;
    inset-inline-end: 8px;
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    z-index: 2;
}

.auth-field__toggle:hover {
    color: var(--auth-ink);
    background: #f3f4f6;
}

.auth-field input,
.auth-field select,
.auth-field .auth-field__control {
    width: 100%;
    border: 0;
    background: transparent;
    padding-block: 14px;
    padding-inline: 46px 16px;
    font-size: 0.98rem;
    color: var(--auth-ink);
    font-family: inherit;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.auth-field--password input {
    padding-inline: 46px 48px;
}

.auth-field input::placeholder,
.auth-field select:invalid {
    color: #9ca3af;
}

.auth-field--nationality {
    cursor: pointer;
}

.auth-nationality-btn {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: start;
    padding-block: 14px;
    padding-inline: 46px 40px;
    font-size: 0.98rem;
    color: var(--auth-ink);
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
}

.auth-nationality-btn.is-placeholder {
    color: #9ca3af;
}

.auth-nationality-btn .auth-flag {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    flex: 0 0 auto;
}

.auth-chevron {
    position: absolute;
    inset-inline-end: 16px;
    color: #9ca3af;
    font-size: 0.75rem;
    pointer-events: none;
}

.auth-form-actions {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-back,
.auth-switch {
    text-align: center;
    margin: 0;
    font-size: 0.95rem;
    color: var(--auth-muted);
}

.auth-back a,
.auth-switch a {
    color: var(--auth-blue);
    font-weight: 700;
    text-decoration: none;
}

.auth-back a:hover,
.auth-switch a:hover {
    text-decoration: underline;
}

.auth-error,
.auth-success {
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.9rem;
    line-height: 1.45;
    display: none;
    margin: 0;
}

.auth-error.is-visible,
.auth-success.is-visible {
    display: block;
    margin-bottom: 1rem;
}

.auth-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.auth-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.auth-panel[hidden] {
    display: none !important;
}

.auth-social-note {
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid var(--auth-border);
    color: var(--auth-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: center;
}

.auth-social-note a {
    color: var(--auth-blue);
    font-weight: 600;
    text-decoration: none;
}

.auth-social-note[hidden] {
    display: none !important;
}

/* Nationality picker modal */
.auth-picker {
    position: fixed;
    inset: 0;
    z-index: 30000;
    display: none;
    align-items: flex-end;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    padding: 0;
}

.auth-picker.is-open {
    display: flex;
}

.auth-picker__sheet {
    width: min(520px, 100%);
    max-height: min(78vh, 640px);
    background: #fff;
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: authSheetIn 0.22s ease;
}

@keyframes authSheetIn {
    from { transform: translateY(24px); opacity: 0.6; }
    to { transform: translateY(0); opacity: 1; }
}

.auth-picker__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 10px;
    border-bottom: 1px solid #f3f4f6;
}

.auth-picker__head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.auth-picker__close {
    border: 0;
    background: #f3f4f6;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--auth-ink);
}

.auth-picker__search {
    padding: 10px 16px 12px;
}

.auth-picker__search input {
    width: 100%;
    border: 1.5px solid var(--auth-border);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
}

.auth-picker__search input:focus {
    border-color: var(--auth-blue);
}

.auth-picker__list {
    overflow: auto;
    padding: 0 8px 16px;
    -webkit-overflow-scrolling: touch;
}

.auth-picker__item {
    width: 100%;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px;
    border-radius: 12px;
    cursor: pointer;
    text-align: start;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--auth-ink);
}

.auth-picker__item:hover,
.auth-picker__item:focus-visible {
    background: #f3f4f6;
    outline: none;
}

.auth-picker__item img {
    width: 24px;
    height: 18px;
    object-fit: cover;
    border-radius: 2px;
}

/* Desktop: centered card feel */
@media (min-width: 768px) {
    .auth-shell {
        align-items: center;
        justify-content: center;
        padding: 40px 20px;
    }

    .auth-top {
        width: min(480px, 100%);
        padding-bottom: 20px;
    }

    .auth-card {
        border-radius: var(--auth-card-radius);
        min-height: auto;
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
        padding: 36px 32px 32px;
    }

    .auth-picker {
        align-items: center;
        padding: 24px;
    }

    .auth-picker__sheet {
        border-radius: 20px;
        max-height: min(70vh, 560px);
    }
}

/* Nav login link (main site header) — keep in sync with styles.css */
.auth-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.75rem;
    min-width: 7.5rem;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border: 0;
    background: var(--primary-color, #4361ee);
    box-shadow: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.auth-nav-link:hover {
    color: #fff;
    background: var(--primary-dark, #1c4494);
    border-color: transparent;
}

body.is-authenticated #navLoginDesktop,
body.is-authenticated #navLoginMobile,
body.is-authenticated .auth-nav-link[href*="/login"] {
    display: none !important;
}

.auth-nav-link--mobile {
    display: none;
}

.nav-menu-login {
    display: none;
}

@media (max-width: 968px) {
    .auth-nav-link--desktop,
    .nav-user--desktop {
        display: none !important;
    }

    .auth-nav-link--mobile:not([hidden]) {
        display: inline-flex;
        margin-left: auto;
        margin-right: 0.75rem;
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
        order: 1;
    }

    .nav-user--mobile:not([hidden]) {
        display: block;
        margin-left: auto;
        margin-right: 0.75rem;
        order: 1;
    }

    .hamburger {
        order: 2;
    }

    .nav-menu-login {
        display: none;
    }
}

html[dir="rtl"] .auth-nav-link--mobile:not([hidden]),
html[dir="rtl"] .nav-user--mobile:not([hidden]) {
    margin-left: 0.75rem;
    margin-right: auto;
}
