:root {
    --bg-primary: #0b1120;
    --bg-card: rgba(15, 23, 42, 0.82);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --accent-1: #38bdf8;
    --accent-2: #818cf8;
    --accent-glow: rgba(56, 189, 248, 0.35);
    --btn-gradient: linear-gradient(135deg, #2563eb, #1d4ed8);
    --radius-lg: 18px;
    --radius-md: 10px;
    --radius-sm: 8px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

body {
    min-height: 100vh;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Ambient Background */
.animated-bg-wrapper {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.ambient-blob {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.5;
    animation: floatBlob 12s infinite alternate ease-in-out;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #38bdf8, transparent 70%);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #818cf8, transparent 70%);
    bottom: -150px;
    right: -150px;
    animation-delay: -4s;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #06b6d4, transparent 70%);
    top: 40%;
    left: 60%;
    animation-delay: -8s;
}

@keyframes floatBlob {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 40px) scale(1.1); }
}

.grid-mesh-overlay {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 32px 32px;
}

/* Auth Page Container */
.auth-page-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 1.5rem 1rem;
}

/* Topbar */
.auth-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 1.5rem;
}

.brand-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.brand-emblem {
    width: 42px;
    height: 42px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sub-badge {
    font-size: 0.65rem;
    font-weight: 800;
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #fff;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.server-status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #4ade80;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    padding: 6px 14px;
    border-radius: 20px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 10px #4ade80;
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* Auth Card */
.auth-card-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0 2.5rem;
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
    width: 100%;
    max-width: 480px;
    padding: 2.25rem 2rem;
    position: relative;
}

.card-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.header-icon-box {
    width: 58px;
    height: 58px;
    margin: 0 auto 12px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-title {
    font-size: 1.65rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.card-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* ========================================================
   SEGMENTED NAVIGATION TABS (Sign In <-> Register)
   Flexbox layout ensures both tabs sit side-by-side cleanly
   ======================================================== */
.auth-segmented-nav {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    position: relative !important;
    width: 100% !important;
    height: 50px !important;
    background: rgba(15, 23, 42, 0.85) !important;
    padding: 4px !important;
    border-radius: 10px !important;
    margin-bottom: 1.5rem !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

.nav-pill-indicator {
    position: absolute !important;
    top: 4px !important;
    bottom: 4px !important;
    left: 4px !important;
    width: calc(50% - 4px) !important;
    height: calc(100% - 8px) !important;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(37, 99, 235, 0.42)) !important;
    border: 1px solid rgba(56, 189, 248, 0.55) !important;
    border-radius: 7px !important;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3) !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    pointer-events: none !important;
    z-index: 1 !important;
}

body[data-active-tab="register"] .nav-pill-indicator {
    transform: translateX(100%) !important;
}

.nav-tab-btn {
    flex: 1 1 50% !important;
    width: 50% !important;
    height: 42px !important;
    position: relative !important;
    z-index: 2 !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: var(--text-muted) !important;
    font-size: 0.92rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 0 12px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    transition: color 0.2s ease !important;
}

.nav-tab-btn:hover {
    color: #ffffff !important;
}

.nav-tab-btn.active {
    color: #ffffff !important;
    font-weight: 700 !important;
}

/* Forms */
.form-view-container {
    position: relative;
}

.form-view {
    display: none;
}

.form-view.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

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

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 6px;
}

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

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
}

.form-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 12px 14px 12px 42px;
    color: #fff;
    font-size: 0.92rem;
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
    background: rgba(15, 23, 42, 0.95);
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
}

.password-toggle-btn:hover {
    color: #fff;
}

.form-options-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    margin-bottom: 1.4rem;
}

.custom-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    cursor: pointer;
}

.forgot-link {
    color: var(--accent-1);
    text-decoration: none;
    font-weight: 600;
}

.forgot-link:hover {
    text-decoration: underline;
}

.btn-submit {
    width: 100%;
    background: var(--btn-gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 13px 20px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    transition: var(--transition);
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.auth-alert {
    display: none;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    align-items: center;
    gap: 10px;
}

.auth-alert.error {
    display: flex;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.auth-alert.success {
    display: flex;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #86efac;
}

/* Password Strength Indicator */
.password-strength-meter {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    height: 4px;
}

.strength-bar {
    flex: 1;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    transition: var(--transition);
}

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