/* ============================================================
   NextRide Auth Screen
   Full-screen gradient auth layout (Sign In + Register tabs)
   ============================================================ */

/* ── Background ─────────────────────────────────────────────── */
.auth-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 50%, #ec4899 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(1rem + env(safe-area-inset-top)) 1rem 1rem;
    position: relative;
    overflow: hidden;
}

.back-btn {
    position: absolute;
    top: calc(1.25rem + env(safe-area-inset-top));
    left: 1.25rem;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: rgba(255, 255, 255, 0.8);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s;
}

.back-btn:hover {
    color: white;
}

.back-icon-circle {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.20);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.back-btn:hover .back-icon-circle {
    background: rgba(255, 255, 255, 0.25);
}

.back-label {
    font-size: 0.875rem;
    display: none;
    opacity: 0;
    transition: opacity 0.15s;
}

@media (min-width: 640px) {
    .back-label {
        display: inline;
    }
}

.back-btn:hover .back-label {
    opacity: 1;
}

/* Animated blur circles */
.auth-bg-circles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.auth-bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    animation: auth-pulse 3s ease-in-out infinite;
}

.auth-bg-circle--1 {
    top: 5rem;
    left: 5rem;
    width: 18rem;
    height: 18rem;
    background: rgba(255, 255, 255, 0.1);
    animation-delay: 0s;
}

.auth-bg-circle--2 {
    bottom: 5rem;
    right: 5rem;
    width: 24rem;
    height: 24rem;
    background: rgba(216, 180, 254, 0.1);
    animation-delay: 1s;
}

.auth-bg-circle--3 {
    top: 50%;
    left: 33%;
    width: 16rem;
    height: 16rem;
    background: rgba(249, 168, 212, 0.1);
    animation-delay: 2s;
}

@keyframes auth-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.7; transform: scale(1.05); }
}

/* ── Container ──────────────────────────────────────────────── */
.auth-container {
    width: 100%;
    max-width: 28rem;
    position: relative;
    z-index: 10;
}

/* ── Logo Header ────────────────────────────────────────────── */
.auth-logo-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-top: env(safe-area-inset-top);
}

.auth-logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 1rem;
    color: white;
}

.auth-logo-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: white;
    margin: 0 0 0.25rem;
    line-height: 1.2;
}

.auth-logo-subtitle {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    font-size: 0.95rem;
}

.auth-logo-image {
    display: block;
    margin: 0 auto 1rem;
}

/* ── Auth Card ──────────────────────────────────────────────── */
.auth-card {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.auth-error-banner {
    margin: 1rem 1.5rem 0;
    padding: 0.75rem 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.75rem;
    color: #dc2626;
    font-size: 0.875rem;
}

/* ── Tab Switcher ───────────────────────────────────────────── */
.auth-tab-switcher {
    padding: 0.5rem;
    background: #f3f4f6;
}

.auth-tab-switcher__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.auth-tab-btn {
    padding: 0.6rem 1rem;
    border: none;
    background: transparent;
    border-radius: 0.625rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.25s ease;
    line-height: 1.5;
}

.auth-tab-btn:hover {
    color: #374151;
}

.auth-tab-btn.active {
    background: white;
    color: #111827;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* ── Form Section ───────────────────────────────────────────── */
.auth-form-section {
    padding: 1.25rem 1.5rem 1.5rem;
    animation: auth-fade-in 0.25s ease-out;
}

@keyframes auth-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-form-section form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Fields ─────────────────────────────────────────────────── */
.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.auth-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

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

.auth-input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.125rem;
    height: 1.125rem;
    color: #9ca3af;
    pointer-events: none;
    flex-shrink: 0;
}

.auth-input {
    width: 100%;
    height: 3rem;
    padding: 0 0.875rem 0 2.75rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    color: #111827;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.auth-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

.auth-input--signin:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.auth-input--with-toggle {
    padding-right: 2.75rem;
}

.auth-input--error {
    border-color: #f87171 !important;
}

.auth-input--error:focus {
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15) !important;
}

.auth-input--success {
    border-color: #34d399;
}

.auth-input-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    transition: color 0.2s;
}

.auth-input-toggle:hover {
    color: #6b7280;
}

/* ── Remember me row ─────────────────────────────────────────── */
.auth-remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    cursor: pointer;
    font-weight: 400;
    margin: 0;
}

.auth-checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: #4f46e5;
    cursor: pointer;
    flex-shrink: 0;
}

.auth-forgot-link {
    background: none;
    border: none;
    font-size: 0.875rem;
    color: #4f46e5;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    transition: color 0.2s;
}

.auth-forgot-link:hover {
    color: #4338ca;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.auth-btn {
    width: 100%;
    height: 3rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: filter 0.2s, transform 0.1s, box-shadow 0.2s;
    margin-top: 0.25rem;
    text-decoration: none;
}

.auth-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.auth-btn:active {
    transform: translateY(0);
}

.auth-btn--signin {
    background: linear-gradient(to right, #4f46e5, #9333ea);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

.auth-btn--register {
    background: linear-gradient(to right, #9333ea, #ec4899);
    box-shadow: 0 8px 20px rgba(147, 51, 234, 0.3);
}

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

/* ── Google Button override (fits gsi-btn into auth sizing) ──── */
.auth-google-btn {
    height: 3rem !important;
    border-radius: 0.75rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.9375rem !important;
    border-color: #e5e7eb !important;
    gap: 0.5rem !important;
}

.auth-google-btn .gsi-btn__icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20px !important;
    height: 20px !important;
    padding: 0 !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
    background: transparent !important;
}

.auth-google-btn .gsi-btn__icon svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
}

.auth-google-btn .gsi-btn__text {
    flex: 0 1 auto !important;
    padding: 0 !important;
}

.auth-google-btn:hover {
    background-color: #f9fafb !important;
    border-color: #d1d5db !important;
}

/* ── Divider ─────────────────────────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.5rem 0;
    color: #9ca3af;
    font-size: 0.8125rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* ── Password Strength ───────────────────────────────────────── */
.auth-strength {
    margin-top: 0.5rem;
}

.auth-strength-bar {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.4rem;
}

.auth-strength-seg {
    flex: 1;
    height: 0.25rem;
    border-radius: 9999px;
    background: #e5e7eb;
    transition: background-color 0.3s;
}

.auth-strength-seg.filled.strength-weak   { background: #ef4444; }
.auth-strength-seg.filled.strength-medium { background: #eab308; }
.auth-strength-seg.filled.strength-strong { background: #22c55e; }

.auth-strength-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.4rem;
}

.auth-strength-label .strength-weak   { color: #ef4444; font-weight: 600; }
.auth-strength-label .strength-medium { color: #eab308; font-weight: 600; }
.auth-strength-label .strength-strong { color: #22c55e; font-weight: 600; }

.auth-strength-checks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.2rem 0.5rem;
    margin-top: 0.25rem;
}

.auth-strength-check {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: #9ca3af;
    transition: color 0.2s;
}

.auth-strength-check.met {
    color: #22c55e;
}

.auth-strength-check svg {
    flex-shrink: 0;
}

/* ── Password match feedback ─────────────────────────────────── */
.auth-match-msg {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.auth-match-msg--ok  { color: #22c55e; }
.auth-match-msg--err { color: #ef4444; }

/* ── External email display ──────────────────────────────────── */
.auth-external-email {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border-radius: 0.5rem;
}

/* ── Card footer ─────────────────────────────────────────────── */
.auth-card-footer {
    padding: 0.875rem 1.5rem;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
    text-align: center;
}

.auth-card-footer p {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.auth-switch-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #4f46e5;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s;
}

.auth-switch-link:hover {
    color: #4338ca;
}

.auth-page-title {
    margin: 0 0 0.5rem;
    color: #111827;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
}

.auth-page-copy {
    margin: 0 0 1.25rem;
    color: #6b7280;
    font-size: 0.925rem;
    line-height: 1.5;
    text-align: center;
}

/* Switch link in register tab */
.auth-tab-btn.active ~ .auth-card-footer .auth-switch-link {
    color: #9333ea;
}

/* ── TOS Footer ──────────────────────────────────────────────── */
.auth-tos {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8125rem;
    margin: 1.25rem 0 0;
}

.auth-tos a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.auth-tos a:hover {
    color: white;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 480px) {
    .auth-bg {
        padding: 0.75rem;
        align-items: flex-start;
        padding-top: 2rem;
    }

    .auth-container {
        max-width: 100%;
    }

    .auth-strength-checks {
        grid-template-columns: 1fr;
    }
}
