@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-deepest: #000000;
    --bg-dark: #09090b;
    --bg-card: rgba(10, 10, 12, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #f8fafc;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent-saffron: #d946ef; /* fuchsia */
    --accent-green: #8b5cf6; /* violet */
    --accent-blue: #a855f7; /* purple */
    --accent-purple: #6d28d9; /* deep purple */
    --input-bg: rgba(20, 20, 24, 0.7);
    --glow-blue: rgba(168, 85, 247, 0.2);
    --glow-saffron: rgba(217, 70, 239, 0.15);

}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-deepest);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* Background */
.login-container {
    position: relative;
    width: 100%;
    max-width: 460px;
    padding: 20px;
    z-index: 10;
}

.login-background {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-deepest);
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    will-change: transform;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: var(--accent-saffron);
    top: -200px;
    left: -150px;
    opacity: 0.15;
    animation: orb-float 16s ease-in-out infinite;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--accent-green);
    bottom: -150px;
    right: -100px;
    opacity: 0.12;
    animation: orb-float 20s ease-in-out infinite reverse;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: var(--accent-blue);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.08;
    animation: orb-float 14s ease-in-out infinite;
    animation-delay: -4s;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.5;
}

@keyframes orb-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(40px, -60px) scale(1.05); }
    50% { transform: translate(-30px, 40px) scale(0.95); }
    75% { transform: translate(20px, 20px) scale(1.02); }
}

/* Card */
.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: 24px;
    padding: 40px 36px;
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 30px 60px -12px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.card-glow {
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-saffron), #fff, var(--accent-green), transparent);
    border-radius: 2px;
    opacity: 0.7;
}

/* Header */
.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 12px;
}

.logo-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.4);
}

.logo h1 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(to right, #fff 30%, #8892a4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 6px 14px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 100px;
    font-size: 12px;
    color: #34d399;
    font-weight: 500;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: live-pulse 2s infinite;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* Error */
.error-message {
    background: rgba(239, 68, 68, 0.08);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    border: 1px solid rgba(239, 68, 68, 0.15);
    animation: shake 0.4s ease;
}

.error-message .error-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #fca5a5;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
}

.error-message .error-close:hover { opacity: 1; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Form */
.login-form {
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.form-group label i {
    color: var(--accent-blue);
    font-size: 13px;
    opacity: 0.8;
}

.input-wrapper {
    position: relative;
    transition: all 0.3s ease;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    padding: 14px 18px;
    padding-right: 44px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-wrapper.focused input,
.input-wrapper.focused select,
.input-wrapper input:focus,
.input-wrapper select:focus {
    border-color: var(--accent-blue);
    background: rgba(20, 28, 50, 0.9);
    box-shadow: 0 0 0 3px var(--glow-blue), 0 4px 16px rgba(0,0,0,0.2);
}

.input-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.input-wrapper select {
    appearance: none;
    cursor: pointer;
}

.form-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    padding-left: 2px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Join Button */
.join-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.3);
    margin-top: 4px;
}

.btn-content, .btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.join-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255,255,255,0.12), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.join-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(168, 85, 247, 0.4);
}

.join-btn:hover::before { opacity: 1; }

.join-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.2);
}

.join-btn:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

/* Trust Badges */
.trust-badges {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.trust-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.trust-badge:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--glass-border);
    color: var(--text-primary);
}

.trust-badge i {
    color: var(--accent-blue);
    font-size: 13px;
    opacity: 0.7;
}

.trust-badge.accent i {
    color: var(--accent-saffron);
}

/* Privacy Note */
.privacy-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.015);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.privacy-note i {
    color: var(--accent-blue);
    font-size: 12px;
    margin-top: 2px;
    opacity: 0.5;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════ */

/* Allow scrolling when keyboard is open */
@media (max-width: 768px) {
    body {
        overflow: auto;
        overflow-x: hidden;
        min-height: 100vh;
        min-height: 100dvh;
        align-items: flex-start;
        padding-top: env(safe-area-inset-top, 16px);
        padding-bottom: env(safe-area-inset-bottom, 16px);
    }

    .login-container {
        padding: 16px;
        max-width: none;
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .login-card {
        padding: 32px 24px;
        border-radius: 20px;
    }
    
    .login-header {
        margin-bottom: 28px;
    }

    .logo h1 { font-size: 28px; }
    .logo-icon { width: 44px; height: 44px; font-size: 20px; }
    
    .tagline {
        font-size: 13px;
    }

    .live-indicator {
        margin-top: 10px;
        padding: 5px 12px;
        font-size: 11px;
    }
    
    .form-group {
        margin-bottom: 16px;
    }

    .form-group label {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .input-wrapper input,
    .input-wrapper select {
        padding: 13px 16px;
        padding-right: 40px;
        font-size: 16px; /* Prevents iOS zoom */
        border-radius: 12px;
    }

    .join-btn {
        padding: 14px;
        font-size: 15px;
        border-radius: 12px;
    }

    .trust-badges {
        gap: 8px;
        margin-bottom: 16px;
        padding-top: 16px;
    }

    .trust-badge {
        padding: 7px 10px;
        font-size: 11px;
        border-radius: 8px;
    }

    .privacy-note {
        font-size: 10px;
        padding: 10px 12px;
    }

    .error-message {
        font-size: 12px;
        padding: 10px 14px;
        margin-bottom: 16px;
    }

    /* Background orbs — smaller for performance */
    .orb-1 { width: 300px; height: 300px; }
    .orb-2 { width: 250px; height: 250px; }
    .orb-3 { width: 180px; height: 180px; }
}

@media (max-width: 480px) {
    .login-container {
        padding: 12px;
    }

    .login-card {
        padding: 24px 18px;
    }

    .logo h1 { font-size: 24px; }
    .logo-icon { width: 40px; height: 40px; font-size: 18px; }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .trust-badges {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .login-header {
        margin-bottom: 20px;
    }

    .form-group {
        margin-bottom: 14px;
    }

    .input-wrapper input,
    .input-wrapper select {
        padding: 12px 14px;
        padding-right: 36px;
    }
}

/* ── Short landscape phones ── */
@media (max-height: 600px) {
    .login-header {
        margin-bottom: 16px;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .logo h1 {
        font-size: 22px;
    }

    .tagline {
        font-size: 12px;
    }

    .live-indicator {
        display: none;
    }

    .login-card {
        padding: 20px 18px;
    }

    .form-group {
        margin-bottom: 10px;
    }

    .trust-badges {
        display: none;
    }

    .privacy-note {
        display: none;
    }
}