/* Login Page - RetroPlay Gaming Theme */

/* Night Sky Background */
.night-sky {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        #060010 0%,
        #0a0121 30%,
        #0e0131 50%,
        #18023c 70%,
        #22034b 85%,
        #2e045a 100%
    );
}

.stars-container {
    position: absolute;
    width: 100%;
    height: 100%;
}

.star {
    position: absolute;
    border-radius: 50%;
    background: white;
}

.stars-glow {
    position: absolute;
    bottom: -50px;
    left: 10%;
    width: 80%;
    height: 80px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.15);
    box-shadow:
        0 0 60px 30px rgba(139, 92, 246, 0.2),
        0 0 100px 60px rgba(99, 43, 108, 0.15);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Moon */
.moon {
    position: absolute;
    top: 8%;
    right: 12%;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5f3ce 0%, #e8e4b8 50%, #d4cfaa 100%);
    box-shadow:
        0 0 20px 5px rgba(255, 250, 205, 0.3),
        0 0 40px 10px rgba(255, 250, 205, 0.2),
        0 0 80px 20px rgba(255, 250, 205, 0.1),
        inset -10px -5px 20px rgba(0, 0, 0, 0.15);
    animation: moon-float 8s ease-in-out infinite;
}

.moon-crater {
    position: absolute;
    border-radius: 50%;
    background: rgba(180, 175, 150, 0.4);
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.moon-crater-1 {
    width: 18px;
    height: 18px;
    top: 15px;
    left: 20px;
}

.moon-crater-2 {
    width: 12px;
    height: 12px;
    top: 40px;
    left: 45px;
}

.moon-crater-3 {
    width: 8px;
    height: 8px;
    top: 55px;
    left: 25px;
}

@keyframes moon-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(2deg); }
}

/* Horizon Dusk Glow */
.horizon-glow {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 35%;
    background: linear-gradient(
        to top,
        rgba(255, 100, 50, 0.15) 0%,
        rgba(255, 140, 80, 0.1) 15%,
        rgba(180, 100, 150, 0.08) 30%,
        rgba(100, 60, 120, 0.05) 50%,
        transparent 100%
    );
    pointer-events: none;
}

/* Shooting star animation (occasionally) */
.night-sky::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    top: 20%;
    left: -100px;
    opacity: 0;
    animation: shooting-star 8s ease-in-out infinite;
    animation-delay: 3s;
    border-radius: 50%;
    box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.5);
}

@keyframes shooting-star {
    0% {
        left: -100px;
        top: 15%;
        opacity: 0;
    }
    2% {
        opacity: 1;
    }
    15% {
        left: 110%;
        top: 35%;
        opacity: 0;
    }
    100% {
        left: 110%;
        top: 35%;
        opacity: 0;
    }
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: transparent;
    color: var(--text-primary, #f0f2f5);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}

.login-card {
    background: rgba(26, 29, 46, 0.95);
    border: 1px solid var(--border, rgba(139, 92, 246, 0.2));
    border-radius: 20px;
    padding: 32px;
    box-shadow: var(--shadow-xl, 0 25px 45px rgba(0,0,0,0.35));
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary, #8b5cf6), var(--accent-secondary, #fbbf24), var(--accent-primary, #8b5cf6));
    background-size: 200% 100%;
    animation: border-flow 3s linear infinite;
}

@keyframes border-flow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.login-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 6px;
    border-radius: 14px;
    background: rgba(34, 45, 78, 0.5);
    margin-bottom: 22px;
}

.login-tab {
    border: none;
    background: transparent;
    color: var(--text-muted, #9ca3af);
    font-weight: 600;
    padding: 10px 0;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.login-tab.active {
    background: var(--gradient-primary, linear-gradient(135deg, #8b5cf6, #6366f1));
    color: #ffffff;
    box-shadow: var(--shadow-glow, 0 0 20px rgba(139, 92, 246, 0.4));
    font-weight: 700;
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-card h1 {
    font-size: 1.9rem;
    margin: 0 0 8px;
}

.login-card p {
    margin: 0 0 24px;
    text-align: center;
    color: var(--text-secondary, #b8bcc8);
}

.auth-form {
    margin-bottom: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.form-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.form-input {
    background: rgba(13, 15, 24, 0.85);
    border: 1px solid var(--border, rgba(139, 92, 246, 0.2));
    border-radius: 12px;
    padding: 12px 14px;
    color: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-input:focus {
    border-color: var(--accent-primary, #8b5cf6);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2), var(--shadow-glow);
    outline: none;
}

.btn-primary {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: none;
    background: var(--gradient-primary, linear-gradient(135deg, #8b5cf6, #6366f1));
    color: #ffffff;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover:not([disabled])::before {
    left: 100%;
}

.btn-primary:hover:not([disabled]) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow), 0 10px 30px rgba(139, 92, 246, 0.3);
}

.btn-primary[disabled] {
    cursor: wait;
    opacity: 0.7;
}

.btn-steam {
    margin-top: 16px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid var(--border, rgba(139, 92, 246, 0.2));
    color: var(--text-primary, #f0f2f5);
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-steam:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--accent-primary, #8b5cf6);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.btn-steam img {
    width: 22px;
    height: 22px;
    border-radius: 6px;
}

.login-alert {
    margin-top: 16px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 0.95rem;
}

.login-success {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.forgot-password-link {
    text-align: right;
    margin-top: -10px;
    margin-bottom: 16px;
}

.forgot-password-link a {
    color: var(--text-muted, #9ca3af);
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.forgot-password-link a:hover {
    color: var(--accent-primary, #8b5cf6);
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    color: var(--text-secondary, #b8bcc8);
    font-size: 0.95rem;
}

.login-footer a {
    color: var(--accent-primary, #8b5cf6);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.login-footer a:hover {
    color: var(--accent-secondary, #fbbf24);
    text-shadow: var(--shadow-gold);
}

/* GDPR Checkbox Groups */
.form-checkbox-group {
    margin-bottom: 0.25rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin-top: 1px;
    accent-color: var(--accent-primary, #8b5cf6);
    cursor: pointer;
}

.checkbox-label a {
    color: var(--accent-primary, #8b5cf6);
    text-decoration: underline;
}

.checkbox-label a:hover {
    color: var(--accent-secondary, #fbbf24);
}

/* Referral Code Toggle */
.referral-toggle-group {
    margin-bottom: 0.75rem;
}

.referral-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px dashed var(--border, rgba(139, 92, 246, 0.3));
    border-radius: 10px;
    padding: 8px 14px;
    color: var(--text-muted, #9ca3af);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.referral-toggle-btn:hover {
    border-color: var(--accent-primary, #8b5cf6);
    color: var(--accent-primary, #8b5cf6);
}

.referral-chevron {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.referral-chevron.open {
    transform: rotate(180deg);
}

.referral-input-wrapper {
    margin-top: 0.5rem;
}

.referral-input-wrapper.hidden {
    display: none;
}

.login-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

.login-brand img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    box-shadow: var(--shadow-glow);
    border: 2px solid transparent;
    background: linear-gradient(var(--bg-card, #1a1d2e), var(--bg-card, #1a1d2e)) padding-box,
                var(--gradient-primary) border-box;
}

.login-brand span {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

@media (max-width: 520px) {
    .login-card {
        padding: 24px;
    }

    .login-card h1 {
        font-size: 1.6rem;
    }

    .moon {
        width: 50px;
        height: 50px;
        top: 5%;
        right: 8%;
    }

    .moon-crater-1 {
        width: 12px;
        height: 12px;
        top: 10px;
        left: 12px;
    }

    .moon-crater-2 {
        width: 8px;
        height: 8px;
        top: 25px;
        left: 28px;
    }

    .moon-crater-3 {
        width: 5px;
        height: 5px;
        top: 35px;
        left: 15px;
    }

    .horizon-glow {
        height: 25%;
    }
}

/* 2FA Code Input */
.twofa-login-step {
    text-align: center;
    padding: 0 0 1rem;
}

.twofa-login-step h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary, #f0f2f5);
}

.twofa-login-step p {
    color: var(--text-secondary, #b8bcc8);
    margin-bottom: 0;
    font-size: 0.95rem;
}

.twofa-login-icon {
    font-size: 2.5rem;
    color: var(--accent-primary, #8b5cf6);
    margin-bottom: 0.75rem;
}

.twofa-code-input {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 1.25rem;
}

.twofa-code-input input {
    width: 42px;
    height: 52px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    border: 2px solid var(--border, rgba(139, 92, 246, 0.2));
    border-radius: 10px;
    background: rgba(13, 15, 24, 0.85);
    color: var(--text-primary, #f0f2f5);
    transition: all 0.2s ease;
}

.twofa-code-input input:focus {
    border-color: var(--accent-primary, #8b5cf6);
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.twofa-code-input input::placeholder {
    color: var(--text-muted, #9ca3af);
    opacity: 0.4;
}

@media (max-width: 400px) {
    .twofa-code-input {
        gap: 5px;
    }

    .twofa-code-input input {
        width: 36px;
        height: 46px;
        font-size: 1.2rem;
    }
}

/* ── Light Theme Overrides ── */
[data-theme="light"] .night-sky {
    background: linear-gradient(
        to bottom,
        #e8e0f0 0%,
        #ddd5ee 30%,
        #d4cce8 50%,
        #c9bfdd 70%,
        #beb5d4 85%,
        #b4abcb 100%
    );
}

[data-theme="light"] .night-sky::after {
    display: none;
}

[data-theme="light"] .moon {
    background: linear-gradient(135deg, #fff9e0 0%, #fff3c4 50%, #ffe99a 100%);
    box-shadow:
        0 0 20px 5px rgba(255, 220, 100, 0.3),
        0 0 40px 10px rgba(255, 220, 100, 0.2),
        inset -10px -5px 20px rgba(200, 180, 80, 0.15);
}

[data-theme="light"] .horizon-glow {
    background: linear-gradient(
        to top,
        rgba(139, 92, 246, 0.1) 0%,
        rgba(139, 92, 246, 0.05) 30%,
        transparent 60%
    );
}

[data-theme="light"] .stars-glow {
    background: rgba(139, 92, 246, 0.08);
    box-shadow:
        0 0 60px 30px rgba(139, 92, 246, 0.1),
        0 0 100px 60px rgba(139, 92, 246, 0.05);
}

[data-theme="light"] .star {
    opacity: 0.2 !important;
}

[data-theme="light"] .login-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(139, 92, 246, 0.2);
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .login-tabs {
    background: rgba(139, 92, 246, 0.08);
}

[data-theme="light"] .login-tab {
    color: var(--text-muted);
}

[data-theme="light"] .form-input {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: var(--text-primary);
}

[data-theme="light"] .form-input::placeholder {
    color: #9ca3af;
}

[data-theme="light"] .form-label {
    color: var(--text-primary);
}

[data-theme="light"] .login-brand span {
    color: var(--text-primary);
}

[data-theme="light"] .login-card h1 {
    color: var(--text-primary);
}

[data-theme="light"] .btn-steam {
    background: rgba(139, 92, 246, 0.06);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: var(--text-primary);
}

[data-theme="light"] .btn-steam:hover {
    background: rgba(139, 92, 246, 0.12);
}

[data-theme="light"] .twofa-code-input input {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(139, 92, 246, 0.2);
    color: var(--text-primary);
}

[data-theme="light"] .login-alert {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

[data-theme="light"] .login-success {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

/* Social Login Separator */
.social-login-separator {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.social-login-separator::before,
.social-login-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color, rgba(255,255,255,0.1));
}

/* Social Login Buttons */
.social-login-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border-color, rgba(255,255,255,0.15));
  border-radius: 8px;
  background: var(--card-bg, rgba(255,255,255,0.05));
  color: var(--text-primary, #fff);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-social:hover {
  transform: translateY(-1px);
  border-color: var(--accent-color, #8b5cf6);
}
.btn-social:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-social i {
  font-size: 1.1rem;
}
.btn-google:hover { border-color: #4285f4; }
.btn-facebook:hover { border-color: #1877f2; }
.btn-twitter:hover { border-color: #1da1f2; }
.btn-tiktok:hover { border-color: #ff0050; }
.btn-google i { color: #4285f4; }
.btn-facebook i { color: #1877f2; }
.btn-twitter i { color: #1da1f2; }
.btn-tiktok i { color: #ff0050; }
