:root {
    --auth-primary: #2563eb;
    --auth-primary-soft: rgba(37, 99, 235, 0.10);
    --auth-secondary: #0f172a;
    --auth-muted: #64748b;
    --auth-surface: rgba(255, 255, 255, 0.88);
    --auth-border: rgba(148, 163, 184, 0.18);
    --auth-shadow: 0 20px 60px rgba(15, 23, 42, 0.10);
    --auth-shadow-soft: 0 10px 35px rgba(15, 23, 42, 0.08);
    --auth-radius: 1.5rem;
}

html, body {
    /* Using min-height over fixed height avoids breaking viewport containers when mobile keyboards or bars expand */
    min-height: 100%;
    height: auto;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--auth-secondary);
    background:
        radial-gradient(circle at 10% 10%, rgba(37, 99, 235, 0.15), transparent 40%),
        radial-gradient(circle at 90% 20%, rgba(14, 165, 233, 0.12), transparent 35%),
        radial-gradient(circle at 20% 80%, rgba(34, 197, 94, 0.08), transparent 30%),
        linear-gradient(135deg, #f8fbff 0%, #eef4ff 45%, #f9fafb 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.auth-page {
    /* Uses Dynamic Viewport Height (dvh) to perfectly fit mobile views with expanding navigation search bars */
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.auth-bg-orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(80px);
    opacity: 0.5;
    z-index: 0;
    pointer-events: none;
}

.auth-bg-orb.orb-1 {
    width: clamp(200px, 25vw, 380px);
    height: clamp(200px, 25vw, 380px);
    background: rgba(59, 130, 246, 0.18);
    top: -40px;
    left: -40px;
}

.auth-bg-orb.orb-2 {
    width: clamp(240px, 30vw, 440px);
    height: clamp(240px, 30vw, 440px);
    background: rgba(14, 165, 233, 0.14);
    right: -60px;
    top: 15%;
}

.auth-bg-orb.orb-3 {
    width: clamp(220px, 25vw, 360px);
    height: clamp(220px, 25vw, 360px);
    background: rgba(34, 197, 94, 0.08);
    bottom: -60px;
    left: 15%;
}

.auth-main {
    position: relative;
    z-index: 2;
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    padding: 2rem 0;
}

.auth-shell {
    width: 100%;
}

.auth-card {
    background: var(--auth-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow);
    overflow: hidden;
}

.auth-form-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 1.5rem;
    box-shadow: var(--auth-shadow-soft);
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .03em;
    color: var(--auth-primary);
    background: var(--auth-primary-soft);
    border: 1px solid rgba(37, 99, 235, 0.14);
    padding: .55rem 1rem;
    border-radius: 999px;
}

.auth-heading {
    font-size: clamp(1.75rem, 3.5vw, 2.75rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.03em;
    color: var(--auth-secondary);
}

.auth-subtext {
    color: var(--auth-muted);
    font-size: clamp(0.92rem, 1.2vw, 1.02rem);
    line-height: 1.65;
}

.auth-section-title {
    font-size: clamp(1.35rem, 2vw, 1.65rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--auth-secondary);
}

.auth-section-subtitle {
    color: var(--auth-muted);
    font-size: .95rem;
    line-height: 1.6;
}

.form-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: #334155;
    margin-bottom: .5rem;
}

.form-control,
.form-select {
    min-height: 52px;
    border-radius: 0.95rem;
    border: 1px solid #dbe4f0;
    padding: .8rem 1.1rem;
    /* Using 16px (1rem) on mobile fields stops iOS safari from doing an unprompted auto-zoom on focus */
    font-size: 1rem; 
    transition: all .2s ease-in-out;
    background-color: #fff;
}

/* Restores slightly smaller font metrics only on wider viewports if desired */
@media (min-width: 768px) {
    .form-control, .form-select {
        font-size: 0.96rem;
    }
}

textarea.form-control {
    min-height: auto;
}

.form-control:focus,
.form-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

/* Ensures touch targets for input-group button additions are clear and clickable */
.input-group .btn {
    border-radius: 0.95rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

/* Enforce Mobile-First Touch Standards (48px+ tap height) */
.btn {
    border-radius: 0.95rem;
    font-weight: 700;
    min-height: 52px;
    padding: .8rem 1.5rem;
    font-size: 0.98rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: none;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
    color: #ffffff;
}

.btn-primary:hover,
.btn-primary:focus {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(37, 99, 235, 0.26);
    color: #ffffff;
}
        
.btn-primary:active {
    transform: translateY(1px);
}

.btn-outline-secondary,
.btn-light {
    border-color: #dbe4f0;
}

/* Touch target adjustment for links on micro-screens */
.auth-link {
    color: var(--auth-primary);
    font-weight: 700;
    text-decoration: none;
    padding: .35rem 0;
    display: inline-block;
}

.auth-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #94a3b8;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 1.5rem 0;
}

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

.auth-feature-pill {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .7rem 1.1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(226, 232, 240, 0.85);
    color: #334155;
    font-size: .88rem;
    font-weight: 600;
}

.auth-stat-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 1.25rem;
    padding: 1.1rem;
    box-shadow: var(--auth-shadow-soft);
}

.auth-stat-number {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--auth-secondary);
}

.auth-stat-label {
    font-size: .82rem;
    color: var(--auth-muted);
}

.auth-error-list {
    border-radius: 1rem;
    border: 1px solid rgba(239, 68, 68, 0.15);
    background: rgba(254, 242, 242, 0.95);
    color: #991b1b;
}

.auth-page .invalid-feedback {
    font-size: .84rem;
    margin-top: 0.35rem;
}

.auth-footer {
    flex-shrink: 0;
    width: 100%;
    position: relative;
    z-index: 2;
}

.auth-footer-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.2s ease-in-out;
}

.auth-footer-social-link:hover {
    background-color: rgba(37, 99, 235, 0.08);
    color: var(--auth-primary) !important;
    transform: translateY(-1px);
}

/* Clean media query adjustments for complex grids & displays */
@media (max-width: 991.98px) {
    .auth-main {
        padding-top: 1.5rem;
        padding-bottom: 2rem;
        align-items: flex-start;
    }
}

@media (max-width: 575.98px) {
    .auth-main {
        padding: 1rem 0 2rem;
    }

    .auth-card,
    .auth-form-card {
        border-radius: 1.25rem;
    }

    .form-control,
    .form-select,
    .btn {
        min-height: 50px;
    }
}

/* Beautiful scaling for High-Resolution Desktop/Laptop environments */
@media (min-width: 1400px) {
    .auth-shell {
        max-width: 1320px;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .auth-fade-up {
        animation: authFadeUp .5s cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    .auth-fade-up-delay {
        animation: authFadeUp .7s cubic-bezier(0.16, 1, 0.3, 1) both;
    }

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