/* ===== MAIN LOGIN STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f1419 0%, #1a2332 100%);
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* ===== ANIMATED BACKGROUND ===== */
.bg-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    animation: float 8s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* ===== BACK BUTTON ===== */
.back-arrow {
    position: fixed;
    top: 30px;
    left: 30px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(15, 20, 25, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    color: #d4af37;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.back-arrow:hover {
    transform: translateX(-5px);
    border-color: rgba(212, 175, 55, 0.6);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.2);
    color: #f4d76b;
}

.back-arrow::before {
    content: '←';
    font-size: 18px;
    transition: transform 0.3s ease;
}

.back-arrow:hover::before {
    transform: translateX(-3px);
}

/* ===== LOGIN CONTAINER ===== */
.login-container {
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 107, 53, 0.2);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 107, 53, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

/* ✅ FIX: Compact login mode - reduce spacing */
.login-container:not(.register-mode):not(.forgot-password-mode) {
    padding: 30px 40px; /* Reduce vertical padding */
}

.login-container:not(.register-mode) .logo-section {
    margin-bottom: 25px; /* Less space after logo */
}

.login-container:not(.register-mode) .welcome-text {
    margin-bottom: 20px; /* Less space after welcome text */
}

.login-container:not(.register-mode) .auth-form {
    gap: 15px; /* Tighter gap between form fields */
}

.login-container:not(.register-mode) .form-group {
    gap: 6px; /* Tighter label-to-input gap */
}

.login-container:not(.register-mode) .google-signin-section {
    margin-top: 20px; /* Less space before Google button */
}

.login-container:not(.register-mode) .auth-divider {
    margin: 20px 0; /* Reduce divider margins */
}

.login-container:not(.register-mode) .mode-toggle {
    margin-top: 15px; /* Less space at bottom */
}

/* Remove body scrollbar in login mode */
body:has(.login-container:not(.register-mode)) {
    overflow: hidden;
}

/* ===== LOGO SECTION ===== */
.logo-section {
    text-align: center;
    margin-bottom: 40px;
}

.logo-container {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.rune-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
}

.rune-symbol {
    font-size: 2.5rem;
    font-weight: bold;
    background: linear-gradient(45deg, #ff6b35, #d4af37);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(255, 107, 53, 0.4));
    animation: runeGlow 3s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

.rune-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 55px;
    height: 55px;
    border: 2px solid rgba(139, 69, 19, 0.4);
    border-radius: 50%;
    animation: orbitRotate 8s linear infinite;
}

.rune-orbit::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: linear-gradient(45deg, #d4af37, #b8860b);
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.8);
    animation: dotPulse 2s ease-in-out infinite;
}

.rune-orbit::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: linear-gradient(45deg, #deb887, #cd853f);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(222, 184, 135, 0.6);
    animation: dotPulse 2s ease-in-out infinite 1s;
}

.logo-text {
    font-weight: bold;
    font-size: 2.5rem;
    letter-spacing: -1px;
}

.queyn-text {
    background: linear-gradient(45deg, #ff6b35, #d4af37);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-text {
    font-size: 24px;
    background: linear-gradient(45deg, #d4af37, #f4d76b, #ff6b35);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 600;
    letter-spacing: 1px;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
    animation: welcomeGlow 3s ease-in-out infinite;
    transition: all 0.3s ease;
}

@keyframes welcomeGlow {
    0%, 100% { 
        text-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
        filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.3));
    }
    50% { 
        text-shadow: 0 0 30px rgba(212, 175, 55, 0.6);
        filter: drop-shadow(0 0 25px rgba(212, 175, 55, 0.5));
    }
}

/* ===== FORM STYLES ===== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.form-label {
    font-size: 14px;
    font-weight: 600;
    color: #d4af37;
    letter-spacing: 0.5px;
}

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

.form-input {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
    width: 100%;
}

.form-input.has-toggle {
    padding-right: 45px;
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-input:focus {
    border-color: rgba(212, 175, 55, 0.6);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.form-input.error {
    border-color: rgba(255, 68, 68, 0.6);
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.2);
}

.form-input.valid {
    border-color: rgba(76, 175, 80, 0.6);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.2);
}

/* Password toggle button */
.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: rgba(212, 175, 55, 0.7);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 24px;
    height: 24px;
}

.password-toggle:hover {
    color: #d4af37;
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.6));
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.3s ease;
}

/* Email validation feedback */
.email-feedback {
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.email-feedback.valid {
    color: #4caf50;
}

.email-feedback.invalid {
    color: #ff6b6b;
}

.email-feedback::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
}

.auth-button {
    padding: 14px;
    background: linear-gradient(45deg, #8b4513, #d4af37);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.auth-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.auth-button::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.6s ease;
}

.auth-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.4);
    background: linear-gradient(45deg, #a0522d, #f4d76b);
}

.auth-button:hover:not(:disabled)::before {
    left: 100%;
}

.auth-button:active:not(:disabled) {
    transform: translateY(0);
}

/* ===== GOOGLE OAUTH STYLES ===== */
.google-signin-section {
    margin-top: 25px;
}

/* Add the golden border wrapper effect with glow */
.google-signin-wrapper {
    position: relative;
    padding: 0;
    background: none;
    border-radius: 0;
    display: flex;
    justify-content: center;
    transition: all 0.3s ease;
}
.google-signin-wrapper:hover {
    box-shadow: none;
    transform: none;
}

/* Create an inner wrapper to hold the actual button */
.google-signin-wrapper > div {
    border-radius: 7px;
    overflow: hidden;
}

/* Optional: Add a subtle animation */
.google-signin-wrapper:hover::before {
    opacity: 0.7;
}

/* Custom Google button (fallback) */
.google-btn-custom {
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 4px;
    color: #3c4043;
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.google-btn-custom:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
}

.google-btn-custom:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: rgba(212, 175, 55, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.2);
}

.google-btn-custom:active {
    background: #e8eaed;
}

/* OR Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 25px 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.3), transparent);
}

.auth-divider span {
    padding: 0 10px;
    letter-spacing: 2px;
}

/* Mode toggle */
.mode-toggle {
    text-align: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 20px;
}

.mode-toggle button {
    background: none;
    border: none;
    color: #d4af37;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    font-size: inherit;
    transition: all 0.3s ease;
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
}

.mode-toggle button:hover {
    color: #f4d76b;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.6);
}

/* ===== MESSAGES ===== */
.message {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
    animation: messageSlide 0.3s ease;
}

.message.error {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    color: #ff6b6b;
}

.message.success {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #4caf50;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading animation */
.loading {
    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 1s ease-in-out infinite;
    margin-left: 8px;
}

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

/* ===== ANIMATIONS ===== */
@keyframes runeGlow {
    0%, 100% { 
        filter: drop-shadow(0 0 20px rgba(255, 107, 53, 0.4));
    }
    50% { 
        filter: drop-shadow(0 0 35px rgba(212, 175, 55, 0.6));
    }
}

@keyframes orbitRotate {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes dotPulse {
    0%, 100% { 
        opacity: 0.6;
        transform: translateX(-50%) scale(1);
    }
    50% { 
        opacity: 1;
        transform: translateX(-50%) scale(1.4);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .back-arrow {
        top: 20px;
        left: 20px;
        padding: 10px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 30px 25px;
        margin: 20px;
    }

    .rune-container {
        width: 50px;
        height: 50px;
    }

    .rune-symbol {
        font-size: 2rem;
    }

    .logo-text {
        font-size: 2rem;
    }

    .rune-orbit {
        width: 45px;
        height: 45px;
    }
    
    .google-btn-custom {
        padding: 12px;
        font-size: 14px;
    }
    
    .auth-divider {
        margin: 20px 0;
        font-size: 13px;
    }
}

/* Additional scrollbar styles only */
        body {
            overflow-x: hidden;
            overflow-y: auto;
            padding: 20px;
        }
        
        /* Only add scroll when in register mode */
        .login-container.register-mode {
            max-height: 90vh;
            overflow-y: auto;
            scrollbar-width: thin;
            scrollbar-color: #d4af37 rgba(255, 255, 255, 0.05);
        }
        
        /* Custom scrollbar styles for register mode */
        .login-container.register-mode::-webkit-scrollbar {
            width: 8px;
        }
        
        .login-container.register-mode::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.05);
            border-radius: 10px;
        }
        
        .login-container.register-mode::-webkit-scrollbar-thumb {
            background: linear-gradient(180deg, #d4af37, #ff6b35);
            border-radius: 10px;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        .login-container.register-mode::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(180deg, #f4d76b, #ff8c5a);
        }

        /* ===== TERMS CHECKBOX STYLES ===== */
        .terms-checkbox-container {
            margin-top: 20px;
            margin-bottom: 10px;
            display: none; /* Hidden in login mode */
        }

        .login-container.register-mode .terms-checkbox-container {
            display: block; /* Show only in register mode */
        }

        .terms-checkbox-wrapper {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            padding: 15px;
            background: rgba(212, 175, 55, 0.05);
            border: 1px solid rgba(212, 175, 55, 0.2);
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .terms-checkbox-wrapper:hover {
            background: rgba(212, 175, 55, 0.08);
            border-color: rgba(212, 175, 55, 0.4);
        }

        .terms-checkbox-wrapper.error {
            border-color: rgba(255, 68, 68, 0.6);
            background: rgba(255, 68, 68, 0.05);
        }

        .terms-checkbox {
            appearance: none;
            width: 20px;
            height: 20px;
            min-width: 20px;
            border: 2px solid rgba(212, 175, 55, 0.5);
            border-radius: 4px;
            cursor: pointer;
            position: relative;
            background: rgba(255, 255, 255, 0.05);
            transition: all 0.3s ease;
            margin-top: 2px;
        }

        .terms-checkbox:checked {
            background: linear-gradient(45deg, #d4af37, #f4d76b);
            border-color: #d4af37;
        }

        .terms-checkbox:checked::after {
            content: '✓';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: #0f1419;
            font-size: 14px;
            font-weight: bold;
        }

        .terms-checkbox:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .terms-label {
            font-size: 13px;
            color: #c0c0c0;
            line-height: 1.5;
            user-select: none;
        }

        .terms-label a {
            color: #d4af37;
            text-decoration: none;
            border-bottom: 1px solid transparent;
            transition: border-color 0.3s;
            font-weight: 600;
        }

        .terms-label a:hover {
            border-bottom-color: #d4af37;
            color: #f4d76b;
        }

        /* Disabled state for form button */
        .auth-button.disabled-by-terms {
            opacity: 0.4 !important;
            cursor: not-allowed !important;
            pointer-events: none;
        }

        /* Disabled state for Google button */
        .google-signin-wrapper.disabled-by-terms {
            opacity: 0.4;
            pointer-events: none;
            filter: grayscale(100%);
            cursor: not-allowed;
        }

        .google-signin-section.disabled-by-terms {
            position: relative;
        }

        .google-signin-section.disabled-by-terms::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: transparent;
            z-index: 10;
            cursor: not-allowed;
        }

        /* ===== FORGOT PASSWORD LINK ===== */
        .forgot-password-link {
            text-align: right;
            margin-top: -10px;
            margin-bottom: 15px;
            display: none; /* Hidden by default */
        }

        /* ✅ ONLY show in login mode (not register, not forgot-password) */
        .login-container:not(.register-mode):not(.forgot-password-mode) .forgot-password-link {
            display: block;
        }

        /* ✅ NEW: Explicitly hide in register mode */
        .login-container.register-mode .forgot-password-link {
            display: none !important;
        }

        .forgot-password-link a {
            color: rgba(212, 175, 55, 0.7);
            text-decoration: none;
            font-size: 13px;
            transition: all 0.3s ease;
            display: inline-block;
        }

        .forgot-password-link a:hover {
            color: #d4af37;
            text-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
        }

        /* Forgot password mode */
        .login-container.forgot-password-mode .welcome-text {
            background: linear-gradient(45deg, #ff6b35, #d4af37);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        /* Hide OR divider in forgot password mode */
        .login-container.forgot-password-mode .auth-divider {
            display: none;
        }