/**
 * Public Auth & Guest Pages — Premium Dark UI
 * /login, /register, /about
 */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
    --auth-bg: #0f172a;
    --auth-bg-glow: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(59, 130, 246, 0.18), transparent);
    --auth-card: #1e293b;
    --auth-card-border: rgba(148, 163, 184, 0.14);
    --auth-card-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    --auth-text: #f1f5f9;
    --auth-text-secondary: #94a3b8;
    --auth-text-muted: #64748b;
    --auth-heading: #f8fafc;
    --auth-input-bg: #111827;
    --auth-input-border: rgba(148, 163, 184, 0.22);
    --auth-input-focus: rgba(59, 130, 246, 0.55);
    --auth-blue: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    --auth-purple: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    --auth-green-bg: rgba(34, 197, 94, 0.14);
    --auth-green-border: rgba(34, 197, 94, 0.35);
    --auth-red-bg: rgba(239, 68, 68, 0.14);
    --auth-red-border: rgba(239, 68, 68, 0.35);
    --auth-amber-bg: rgba(245, 158, 11, 0.14);
    --auth-amber-border: rgba(245, 158, 11, 0.35);
    --auth-info-bg: rgba(59, 130, 246, 0.14);
    --auth-info-border: rgba(59, 130, 246, 0.35);
    --auth-radius-lg: 20px;
    --auth-radius-md: 12px;
    --auth-radius-pill: 999px;
    --auth-transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
    --auth-font: 'Inter', var(--font-arabic, Tahoma), var(--font-english, 'Segoe UI'), system-ui, sans-serif;
}

/* ── Auth shell ── */
.auth-page {
    font-family: var(--auth-font);
    min-height: min(100vh, 100dvh);
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 4vw, 2rem) clamp(0.75rem, 3vw, 1.5rem);
    background: var(--auth-bg);
    background-image: var(--auth-bg-glow);
    overflow-x: hidden;
    box-sizing: border-box;
}

.auth-page * { box-sizing: border-box; }

.auth-card {
    max-width: 440px;
    width: 100%;
    background: var(--auth-card);
    border: 1px solid var(--auth-card-border);
    border-radius: var(--auth-radius-lg);
    padding: clamp(1.35rem, 4vw, 2rem) clamp(1.15rem, 3.5vw, 1.75rem);
    box-shadow: var(--auth-card-shadow);
    animation: authFadeIn 0.35s ease;
}

@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-card__header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-card__logo {
    width: 56px;
    height: 56px;
    background: var(--auth-blue);
    color: #fff;
    font-weight: 800;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    margin: 0 auto 1rem;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
}

.auth-card__title {
    font-size: clamp(1.35rem, 4vw, 1.6rem);
    font-weight: 700;
    color: var(--auth-heading);
    margin: 0 0 0.35rem;
    line-height: 1.35;
}

.auth-card__subtitle {
    color: var(--auth-text-secondary);
    font-size: 0.92rem;
    margin: 0;
    line-height: 1.6;
}

.auth-country-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.65rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--auth-radius-pill);
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
    font-size: 0.82rem;
    font-weight: 600;
}

/* ── Form ── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.auth-form__field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.auth-form__label {
    font-weight: 600;
    color: var(--auth-text-secondary);
    font-size: 0.88rem;
}

.auth-form__input,
.auth-form__select {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--auth-input-border);
    border-radius: var(--auth-radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color var(--auth-transition), box-shadow var(--auth-transition), background var(--auth-transition);
    background: var(--auth-input-bg);
    color: var(--auth-text);
    min-height: 48px;
}

.auth-form__input::placeholder { color: var(--auth-text-muted); }

.auth-form__input:focus,
.auth-form__select:focus {
    outline: none;
    border-color: var(--auth-input-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
    background: #0f172a;
}

.auth-form__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-form__input-wrap .auth-form__input {
    padding-inline-start: 2.75rem;
}

.auth-form__toggle-password {
    position: absolute;
    inset-inline-start: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--auth-text-muted);
    cursor: pointer;
    border-radius: 10px;
    font-size: 1.1rem;
    transition: color var(--auth-transition), background var(--auth-transition);
}

.auth-form__toggle-password:hover {
    color: var(--auth-text);
    background: rgba(148, 163, 184, 0.1);
}

.auth-form__toggle-password.is-visible { color: #86efac; }

.phone-group {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.phone-prefix {
    padding: 0.85rem 0.75rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--auth-input-border);
    border-radius: var(--auth-radius-md);
    color: var(--auth-text);
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    min-height: 48px;
    flex-shrink: 0;
}

.phone-group .auth-form__input { flex: 1; min-width: 0; }

.auth-form__submit {
    width: 100%;
    padding: 0.9rem 1rem;
    background: var(--auth-blue);
    color: #fff;
    border: none;
    border-radius: var(--auth-radius-md);
    font-weight: 700;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    min-height: 48px;
    transition: transform var(--auth-transition), box-shadow var(--auth-transition), opacity var(--auth-transition);
    margin-top: 0.15rem;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
    position: relative;
    overflow: hidden;
}

.auth-form__submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(59, 130, 246, 0.45);
}

.auth-form__submit:active:not(:disabled) { transform: translateY(0); }

.auth-form__submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.auth-form__submit.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
    animation: authShimmer 1.2s infinite;
}

@keyframes authShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ── Alerts ── */
.auth-alert,
.auth-form__error {
    border-radius: var(--auth-radius-md);
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    line-height: 1.65;
    word-break: break-word;
}

.auth-form__error,
.auth-alert--error {
    background: var(--auth-red-bg);
    border: 1px solid var(--auth-red-border);
    color: #fecaca;
}

.auth-alert--success {
    background: var(--auth-green-bg);
    border: 1px solid var(--auth-green-border);
    color: #bbf7d0;
}

.auth-alert--warning {
    background: var(--auth-amber-bg);
    border: 1px solid var(--auth-amber-border);
    color: #fde68a;
}

.auth-alert--info {
    background: var(--auth-info-bg);
    border: 1px solid var(--auth-info-border);
    color: #bfdbfe;
}

.auth-form__error .auth-error-line { margin-bottom: 0.65rem; }
.auth-form__error .auth-error-line:last-child { margin-bottom: 0; }

.auth-form__error .auth-wa-row {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.auth-form__error .auth-wa-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem;
    background: #128c7e;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: var(--auth-radius-pill);
    font-weight: 700;
    font-size: 0.88rem;
    transition: transform var(--auth-transition);
}

.auth-form__error .auth-wa-btn:hover { transform: translateY(-1px); }
.auth-form__error .auth-wa-btn svg { flex-shrink: 0; width: 20px; height: 20px; }

.auth-form__link {
    text-align: center;
    margin-top: 1.35rem;
    color: var(--auth-text-secondary);
    font-size: 0.9rem;
}

.auth-form__link a {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 600;
    transition: color var(--auth-transition);
}

.auth-form__link a:hover { color: #bfdbfe; text-decoration: underline; }

.auth-divider {
    margin: 1.15rem 0;
    padding-top: 1.15rem;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
    text-align: center;
}

.auth-divider__text {
    color: var(--auth-text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.85rem;
}

.auth-google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    margin-top: 0.5rem;
    background: rgba(15, 23, 42, 0.6);
    color: var(--auth-text);
    border: 1px solid var(--auth-input-border);
    border-radius: var(--auth-radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
    min-height: 48px;
    transition: border-color var(--auth-transition), background var(--auth-transition), transform var(--auth-transition);
}

.auth-google-btn:hover {
    border-color: rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.85);
    transform: translateY(-1px);
}

.auth-google-btn--otp {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.1);
    color: #93c5fd;
}

.auth-google-btn svg { flex-shrink: 0; }

.country-select-form {
    margin-bottom: 0.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.auth-form__input[readonly] {
    background: rgba(15, 23, 42, 0.5);
    color: var(--auth-text-secondary);
    font-weight: 600;
}

.auth-form__input.agent-code-from-ref {
    background: var(--auth-green-bg);
    border-color: var(--auth-green-border);
    color: #86efac;
    cursor: not-allowed;
}

.auth-form__agent-code-note {
    color: #86efac;
    font-size: 0.82rem;
}

.auth-form__select option {
    background: #1e293b;
    color: var(--auth-text);
}

/* ── About page ── */
.public-about-page {
    font-family: var(--auth-font);
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: clamp(1rem, 4vw, 1.75rem) clamp(0.85rem, 3vw, 1.5rem) clamp(2rem, 5vw, 3rem);
    overflow-x: hidden;
    box-sizing: border-box;
    animation: authFadeIn 0.4s ease;
}

.public-about-page * { box-sizing: border-box; }

.public-about-hero {
    text-align: center;
    padding: clamp(1.25rem, 4vw, 2rem) clamp(0.75rem, 3vw, 1.25rem);
    margin-bottom: 1.5rem;
    border-radius: var(--auth-radius-lg);
    background: linear-gradient(165deg, rgba(59, 130, 246, 0.12) 0%, var(--auth-card) 55%);
    border: 1px solid var(--auth-card-border);
    box-shadow: var(--auth-card-shadow);
}

.public-about-hero__icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 0.85rem;
    border-radius: 14px;
    background: var(--auth-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
}

.public-about-hero__title {
    margin: 0 0 0.65rem;
    font-size: clamp(1.35rem, 4.5vw, 1.75rem);
    font-weight: 800;
    color: var(--auth-heading);
    line-height: 1.35;
}

.public-about-hero__text {
    margin: 0;
    color: var(--auth-text-secondary);
    font-size: clamp(0.92rem, 2.8vw, 1rem);
    line-height: 1.75;
    max-width: 640px;
    margin-inline: auto;
}

.public-about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 1rem;
}

.public-about-card {
    background: var(--auth-card);
    border: 1px solid var(--auth-card-border);
    border-radius: var(--auth-radius-lg);
    padding: 1.15rem 1.2rem;
    box-shadow: var(--auth-card-shadow);
    transition: border-color var(--auth-transition), transform var(--auth-transition), box-shadow var(--auth-transition);
}

.public-about-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}

.public-about-card__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.public-about-card__title {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--auth-heading);
}

.public-about-card__text {
    margin: 0;
    color: var(--auth-text-secondary);
    font-size: 0.92rem;
    line-height: 1.7;
}

.public-about-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.public-about-stat {
    text-align: center;
    padding: 0.85rem 0.5rem;
    border-radius: var(--auth-radius-md);
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.public-about-stat__value {
    display: block;
    font-size: 1.15rem;
    font-weight: 800;
    color: #93c5fd;
    margin-bottom: 0.2rem;
}

.public-about-stat__label {
    font-size: 0.78rem;
    color: var(--auth-text-muted);
    font-weight: 600;
}

/* ── Responsive ── */
.auth-change-country {
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
    text-align: center;
}
.auth-change-country a {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 600;
    transition: color var(--auth-transition);
}
.auth-change-country a:hover { color: #bfdbfe; }

@media (max-width: 480px) {
    .auth-card { border-radius: 16px; }
    .phone-group { flex-wrap: nowrap; }
    .phone-prefix { font-size: 0.88rem; padding-inline: 0.55rem; }
    .public-about-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card,
    .public-about-page,
    .public-about-card,
    .auth-form__submit { animation: none; transition: none; }
}
