/* ========================================
   LOGIN PAGE - WORMHOLE THEME
   Cosmic-inspired login interface
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><circle cx="12" cy="12" r="11" fill="none" stroke="%23c4b5fd" stroke-width="0.5" opacity="0.3"/><circle cx="12" cy="12" r="8" fill="none" stroke="%23e0e7ff" stroke-width="1.5" opacity="0.5"/><circle cx="12" cy="12" r="6" fill="none" stroke="%23ffffff" stroke-width="1" opacity="0.9"/><circle cx="12" cy="12" r="5" fill="%23000000"/><circle cx="12" cy="12" r="3" fill="%23020010"/></svg>') 12 12, auto;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #0a0a1f;
    position: relative;
    overflow: hidden;
}

/* ----------------------------------------
   Wormhole Background Animation
   ---------------------------------------- */
body::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 200vmax;
    height: 200vmax;
    transform: translate(-50%, -50%);
    background: 
        radial-gradient(circle at 50% 50%, transparent 0%, transparent 20%, rgba(88, 28, 135, 0.15) 40%, transparent 60%),
        radial-gradient(circle at 50% 50%, rgba(147, 51, 234, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(79, 70, 229, 0.08) 0%, transparent 70%);
    animation: wormhole-spin 30s linear infinite;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at top, rgba(79, 70, 229, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at bottom, rgba(139, 92, 246, 0.1) 0%, transparent 60%);
    z-index: 1;
    pointer-events: none;
}

@keyframes wormhole-spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) rotate(180deg) scale(1.1);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg) scale(1);
    }
}

/* ----------------------------------------
   Space Objects
   ---------------------------------------- */
.space-objects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s infinite;
}

.star.small {
    width: 1px;
    height: 1px;
    box-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
}

.star.medium {
    width: 2px;
    height: 2px;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.9);
}

.star.large {
    width: 3px;
    height: 3px;
    box-shadow: 0 0 6px rgba(200, 220, 255, 1);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.planet {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(147, 197, 253, 0.4), rgba(59, 130, 246, 0.2));
    box-shadow: 
        0 0 20px rgba(59, 130, 246, 0.3),
        inset -10px -10px 30px rgba(0, 0, 0, 0.5);
    animation: planet-drift 60s linear infinite;
}

@keyframes planet-drift {
    from { transform: translateX(0) rotate(0deg); }
    to { transform: translateX(-50px) rotate(360deg); }
}

.asteroid {
    position: absolute;
    background: rgba(120, 113, 108, 0.3);
    border-radius: 40%;
    box-shadow: inset -2px -2px 4px rgba(0, 0, 0, 0.5);
    animation: asteroid-tumble 20s linear infinite;
}

@keyframes asteroid-tumble {
    from { transform: rotate(0deg) translateX(0); }
    to { transform: rotate(360deg) translateX(30px); }
}

/* Cosmic particles */
.cosmic-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(147, 197, 253, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(147, 197, 253, 0.8);
    animation: particle-float 20s infinite;
}

.particle:nth-child(2n) {
    background: rgba(196, 181, 253, 0.5);
    box-shadow: 0 0 4px rgba(196, 181, 253, 0.7);
    animation-duration: 25s;
}

.particle:nth-child(3n) {
    background: rgba(134, 239, 172, 0.4);
    box-shadow: 0 0 4px rgba(134, 239, 172, 0.6);
    animation-duration: 30s;
}

@keyframes particle-float {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(calc(var(--drift) * 50px));
        opacity: 0;
    }
}

/* ----------------------------------------
   Login Container
   ---------------------------------------- */
.login-container {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 20px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(79, 70, 229, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    width: 100%;
    max-width: 440px;
    padding: 48px 40px;
    position: relative;
    z-index: 10;
    animation: container-entrance 0.6s ease-out;
}

@keyframes container-entrance {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Glow border effect */
.login-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        rgba(79, 70, 229, 0.3),
        rgba(139, 92, 246, 0.3),
        rgba(79, 70, 229, 0.3)
    );
    border-radius: 20px;
    filter: blur(10px);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s;
}

.login-container:hover::before {
    opacity: 1;
}

/* ----------------------------------------
   Logo & Branding
   ---------------------------------------- */
.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo h1 {
    font-size: 42px;
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 50%, #818cf8 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 2px;
    animation: gradient-shift 3s ease infinite;
    text-shadow: 0 0 30px rgba(129, 140, 248, 0.3);
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.logo p {
    color: #94a3b8;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* ----------------------------------------
   Error Messages
   ---------------------------------------- */
.error-message {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 14px;
    display: none;
    animation: shake 0.3s;
}

.error-message.show {
    display: block;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* ----------------------------------------
   Form Elements
   ---------------------------------------- */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #cbd5e1;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(100, 116, 139, 0.3);
    border-radius: 10px;
    font-size: 15px;
    color: #f1f5f9;
    transition: all 0.3s;
    cursor: text;
}

.form-group input::placeholder {
    color: #64748b;
}

.form-group input:focus {
    outline: none;
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 
        0 0 0 3px rgba(139, 92, 246, 0.15),
        0 4px 12px rgba(139, 92, 246, 0.2);
}

/* ----------------------------------------
   Buttons
   ---------------------------------------- */
.btn-login {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28"><circle cx="14" cy="14" r="13" fill="none" stroke="%23e0e7ff" stroke-width="0.5" opacity="0.4"/><circle cx="14" cy="14" r="10" fill="none" stroke="%23ffffff" stroke-width="2" opacity="0.7"/><circle cx="14" cy="14" r="8" fill="none" stroke="%23c4b5fd" stroke-width="1" opacity="0.9"/><circle cx="14" cy="14" r="7" fill="%23000000"/><circle cx="14" cy="14" r="4" fill="%23020010"/></svg>') 14 14, pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.btn-login::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;
}

.btn-login:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    box-shadow: 0 6px 24px rgba(139, 92, 246, 0.6);
    transform: translateY(-2px);
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    background: linear-gradient(135deg, #475569 0%, #64748b 100%);
    cursor: not-allowed;
    box-shadow: none;
}

/* ----------------------------------------
   Loading Spinner
   ---------------------------------------- */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading .spinner {
    display: inline-block;
}

.loading .btn-text {
    display: none;
}

.btn-login:not(.loading) .spinner,
.btn-passkey:not(.loading) .spinner {
    display: none;
}

/* ----------------------------------------
   Divider
   ---------------------------------------- */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: #64748b;
    font-size: 13px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(100, 116, 139, 0.3);
}

.divider span {
    padding: 0 16px;
}

/* ----------------------------------------
   Passkey Button
   ---------------------------------------- */
.btn-passkey {
    width: 100%;
    padding: 16px;
    background: rgba(30, 41, 59, 0.6);
    color: #cbd5e1;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28"><circle cx="14" cy="14" r="13" fill="none" stroke="%23e0e7ff" stroke-width="0.5" opacity="0.4"/><circle cx="14" cy="14" r="10" fill="none" stroke="%23ffffff" stroke-width="2" opacity="0.7"/><circle cx="14" cy="14" r="8" fill="none" stroke="%23c4b5fd" stroke-width="1" opacity="0.9"/><circle cx="14" cy="14" r="7" fill="%23000000"/><circle cx="14" cy="14" r="4" fill="%23020010"/></svg>') 14 14, pointer;
    transition: all 0.3s;
    display: none;
}

.btn-passkey:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.btn-passkey:disabled {
    background: rgba(30, 41, 59, 0.3);
    color: #475569;
    cursor: not-allowed;
    border-color: rgba(100, 116, 139, 0.2);
}

.btn-passkey .passkey-icon {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 8px;
    stroke: currentColor;
}

/* ----------------------------------------
   Responsive Design
   ---------------------------------------- */
@media (max-width: 480px) {
    .login-container {
        padding: 36px 28px;
    }

    .logo h1 {
        font-size: 36px;
    }

    .form-group input,
    .btn-login,
    .btn-passkey {
        padding: 12px 16px;
        font-size: 15px;
    }
}

/* ----------------------------------------
   Accessibility
   ---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
