/* ============================================
   LOGIN PAGE – ANTIGRAVITY EDITION
   ============================================ */

:root {
    --brand-red: #E31837;
    --brand-red-glow: rgba(227, 24, 55, 0.35);
    --brand-dark: #0a0a0f;
    --brand-surface: rgba(255, 255, 255, 0.04);
    --brand-border: rgba(255, 255, 255, 0.08);
    --brand-text: #e8e8ec;
    --brand-muted: rgba(255, 255, 255, 0.45);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Outfit', 'Inter', sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--brand-dark);
    color: var(--brand-text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* ─── Noise Overlay ─── */
.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ─── Particles Canvas ─── */
#particles-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ─── Glowing Orbs ─── */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
    z-index: 0;
    pointer-events: none;
    animation: orbFloat 12s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(227, 24, 55, 0.3), transparent 70%);
    top: -15%;
    right: -10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(120, 40, 200, 0.2), transparent 70%);
    bottom: -10%;
    left: -8%;
    animation-delay: -4s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(180, 0, 30, 0.15), transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -8s;
}

@keyframes orbFloat {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -20px) scale(1.05);
    }

    50% {
        transform: translate(-15px, 25px) scale(0.95);
    }

    75% {
        transform: translate(20px, 10px) scale(1.02);
    }
}

.orb-3 {
    animation-name: orbFloat3;
}

@keyframes orbFloat3 {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
    }

    25% {
        transform: translate(calc(-50% + 30px), calc(-50% - 20px)) scale(1.05);
    }

    50% {
        transform: translate(calc(-50% - 15px), calc(-50% + 25px)) scale(0.95);
    }

    75% {
        transform: translate(calc(-50% + 20px), calc(-50% + 10px)) scale(1.02);
    }
}

/* ─── Login Container ─── */
.login-container {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    padding: 20px;
    width: 100%;
    max-width: 420px;
    animation: containerFloat 6s ease-in-out infinite, fadeInUp 0.8s ease-out;
}

@keyframes containerFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Brand ─── */
.login-brand {
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--brand-red), #b81020);
    color: #fff;
    margin-bottom: 14px;
    box-shadow: 0 8px 32px var(--brand-red-glow), 0 0 60px rgba(227, 24, 55, 0.15);
    animation: iconPulse 3s ease-in-out infinite;
    position: relative;
}



@keyframes iconPulse {

    0%,
    100% {
        box-shadow: 0 8px 32px var(--brand-red-glow), 0 0 60px rgba(227, 24, 55, 0.15);
    }

    50% {
        box-shadow: 0 8px 48px var(--brand-red-glow), 0 0 80px rgba(227, 24, 55, 0.25);
    }
}

.brand-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 4px;
}

.brand-hut {
    color: #fff;
}

.brand-rewards {
    color: var(--brand-red);
    text-shadow: 0 0 30px var(--brand-red-glow);
}

.brand-hut {
    color: #fff;
}

.brand-rewards {
    color: var(--brand-red);
    text-shadow: 0 0 30px var(--brand-red-glow);
}

.brand-tagline {
    font-size: 0.78rem;
    color: var(--brand-muted);
    margin-top: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ─── Glass Card ─── */
.login-card {
    background: var(--brand-surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--brand-border);
    border-radius: 20px;
    padding: 32px 28px;
    width: 100%;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: cardAppear 1s ease-out 0.2s both;
    position: relative;
}



@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ─── Form Fields ─── */
.login-field {
    margin-bottom: 18px;
    animation: fieldFadeIn 0.6s ease-out both;
}

@keyframes fieldFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--brand-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.login-label svg {
    opacity: 0.6;
}

.login-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--brand-border);
    border-radius: 12px;
    padding: 13px 16px;
    font-size: 0.88rem;
    font-weight: 500;
    color: #fff;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.login-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.login-input:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(214, 35, 0, 0.15), 0 0 20px rgba(214, 35, 0, 0.1);
    background: rgba(255, 255, 255, 0.06);
}

/* Password input wrapper */
.input-wrapper {
    position: relative;
}

.input-wrapper .login-input {
    padding-right: 48px;
}

.pass-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    color: var(--brand-muted);
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background 0.2s ease;
}

.pass-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.pass-toggle:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: -2px;
}

/* ─── Error ─── */
.login-error {
    color: #ff6b6b;
    font-size: 0.75rem;
    text-align: center;
    margin-bottom: 8px;
    min-height: 18px;
    opacity: 0;
    transition: opacity 0.3s;
}

.login-error.visible {
    opacity: 1;
}

/* ─── Submit Button ─── */
.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--brand-red), #c41230);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 800;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

.login-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.login-btn:hover::before {
    transform: translateX(100%);
}

.login-btn:hover {
    box-shadow: 0 6px 30px var(--brand-red-glow);
    transform: translateY(-1px);
}

.login-btn:active {
    transform: scale(0.98) translateY(0);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loader {
    animation: spin 1s linear infinite;
}

.btn-loader.hidden {
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ─── Divider ─── */
.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 16px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--brand-border);
}

.login-divider span {
    font-size: 0.7rem;
    color: var(--brand-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ─── Footer Links ─── */
.login-footer-text {
    font-size: 0.76rem;
    color: var(--brand-muted);
    text-align: center;
    line-height: 1.5;
}

.login-link {
    color: #25d366;
    text-decoration: none;
    font-weight: 700;
    transition: color 0.2s;
}

.login-link:hover {
    color: #4ae27f;
    text-decoration: underline;
}

/* ─── Legal ─── */
.login-legal {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.2);
    text-align: center;
    animation: fadeInUp 1s ease-out 0.5s both;
}

/* ─── Shake animation ─── */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-6px);
    }

    80% {
        transform: translateX(6px);
    }
}

.login-card.shake {
    animation: shake 0.4s ease-in-out;
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
    .login-container {
        padding: 16px;
        gap: 22px;
    }

    .login-card {
        padding: 24px 20px;
        border-radius: 16px;
    }

    .brand-title {
        font-size: 1.4rem;
    }

    .brand-icon {
        width: 56px;
        height: 56px;
    }
}

@media (max-height: 680px) {
    .login-container {
        gap: 16px;
    }

    .brand-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 8px;
    }

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

/* ═══════════════════════════════════════════
   THEME TOGGLE BUTTON
   ═══════════════════════════════════════════ */
.theme-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.theme-toggle:hover {
    transform: rotate(20deg) scale(1.1);
    border-color: var(--brand-red);
    box-shadow: 0 4px 24px var(--brand-red-glow);
}

.toggle-icon {
    transition: transform 0.5s ease, opacity 0.3s ease;
}

/* ═══════════════════════════════════════════
   GLOBAL TRANSITIONS FOR SMOOTH THEME SWITCH
   ═══════════════════════════════════════════ */
body,
.bg-orb,
.login-container,
.login-card,
.login-input,
.login-btn,
.login-label,
.login-error,
.login-divider::before,
.login-divider::after,
.login-divider span,
.login-footer-text,
.login-legal,
.brand-icon,
.brand-title,
.brand-hut,
.brand-rewards,
.brand-tagline,
.theme-toggle {
    transition: background 0.6s ease,
        color 0.6s ease,
        border-color 0.6s ease,
        box-shadow 0.6s ease,
        opacity 0.6s ease;
}

/* ═══════════════════════════════════════════
   LIGHT THEME ☀️
   ═══════════════════════════════════════════ */
body.light-login {
    background: linear-gradient(160deg, #fdf6f0 0%, #fff5f5 30%, #f0e6f6 60%, #eef2ff 100%);
}

/* Orbs → soft pastel blobs */
body.light-login .orb-1 {
    background: radial-gradient(circle, rgba(227, 24, 55, 0.1), transparent 70%);
    opacity: 0.6;
}

body.light-login .orb-2 {
    background: radial-gradient(circle, rgba(140, 80, 200, 0.08), transparent 70%);
    opacity: 0.5;
}

body.light-login .orb-3 {
    background: radial-gradient(circle, rgba(227, 24, 55, 0.06), transparent 70%);
    opacity: 0.4;
}

/* Brand */
body.light-login .brand-icon {
    background: linear-gradient(135deg, var(--brand-red), #c41230);
    box-shadow: 0 8px 28px rgba(227, 24, 55, 0.25), 0 0 40px rgba(227, 24, 55, 0.1);
}

body.light-login .brand-hut {
    color: #1a1a2e;
}

body.light-login .brand-rewards {
    color: var(--brand-red);
    text-shadow: none;
}

body.light-login .brand-tagline {
    color: #888;
}

/* Glass Card → Soft white card */
body.light-login .login-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(227, 24, 55, 0.08);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.06),
        0 2px 8px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Fields */
body.light-login .login-label {
    color: #777;
}

body.light-login .login-label svg {
    opacity: 0.5;
    stroke: #999;
}

body.light-login .login-input {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a1a2e;
}

body.light-login .login-input::placeholder {
    color: #bbb;
}

body.light-login .login-input:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(227, 24, 55, 0.1), 0 0 12px rgba(227, 24, 55, 0.06);
    background: #fff;
}

/* Button */
body.light-login .login-btn {
    box-shadow: 0 4px 16px rgba(227, 24, 55, 0.3);
}

body.light-login .login-btn:hover {
    box-shadow: 0 6px 28px rgba(227, 24, 55, 0.4);
}

/* Divider */
body.light-login .login-divider::before,
body.light-login .login-divider::after {
    background: rgba(0, 0, 0, 0.08);
}

body.light-login .login-divider span {
    color: #aaa;
}

/* Footer */
body.light-login .login-footer-text {
    color: #888;
}

body.light-login .login-legal {
    color: rgba(0, 0, 0, 0.3);
}

/* Error */
body.light-login .login-error {
    color: #d32f2f;
}

/* Toggle button in light mode */
body.light-login .theme-toggle {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.7);
    color: #1a1a2e;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

body.light-login .theme-toggle:hover {
    box-shadow: 0 4px 24px rgba(227, 24, 55, 0.2);
}

/* Light mode: password toggle */
body.light-login .pass-toggle {
    color: #999;
}

body.light-login .pass-toggle:hover {
    color: #555;
    background: rgba(0, 0, 0, 0.04);
}

/* Light mode: card glow */
body.light-login .login-card::before {
    opacity: 0.2;
}

/* Light mode: brand icon ring */
body.light-login .brand-icon-ring {
    opacity: 0.4;
}

/* Light mode: noise overlay */
body.light-login .noise-overlay {
    opacity: 0.015;
}

/* Light mode: improved text contrast (4.5:1 ratio per skill) */
body.light-login .login-label {
    color: #555;
}

body.light-login .brand-tagline {
    color: #666;
}

/* ═══════════════════════════════════════════
   FOCUS-VISIBLE (Accessibility per skill)
   ═══════════════════════════════════════════ */
.login-input:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: 2px;
}

.login-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: 2px;
}

.login-link:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ═══════════════════════════════════════════
   PREFERS-REDUCED-MOTION (Critical per skill)
   ═══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .bg-orb {
        animation: none !important;
        opacity: 0.2;
    }

    #particles-canvas {
        display: none;
    }

    .login-container {
        animation: none !important;
    }

    .brand-icon-ring {
        animation: none !important;
    }

    .login-card::before {
        animation: none !important;
    }
}