/* ========================================
   LOGIN MODAL
   Authentication popup with social login
======================================== */

.login-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.login-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.login-modal {
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem 2rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    transform: scale(0.9) translateY(20px);
    max-height: 90vh;
    overflow-y: scroll;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.login-modal::-webkit-scrollbar {
    display: none;
}

.login-modal-overlay.active .login-modal {
    transform: scale(1) translateY(0);
}

.login-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    line-height: 1;
}

.login-modal-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.login-modal-back {
    position: absolute;
    top: 1rem;
    right: 3.5rem; /* Positioned to the left of the close button */
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.3rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    line-height: 1;
}

.login-modal-back:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-3px);
}

.login-modal-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-modal-title {
    font-size: 1.75rem;
    text-transform: uppercase;
    color: #ffffff;
    margin-bottom: 0.35rem;
}

.login-modal-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

/* Social Login Buttons */
.social-login-buttons {
    display: flex;
    flex-direction: row; /* Changed from column to row */
    gap: 0.625rem;
    margin-bottom: 1.25rem;
}

.social-login-btn {
    flex: 1; /* Make buttons scale equally */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem; /* Adjusted padding */
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-login-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.social-login-btn i {
    font-size: 1.15rem;
}

.social-login-btn.google {
    border-color: rgba(255, 255, 255, 0.15);
}

.social-login-btn.google:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.social-login-btn.discord {
    border-color: rgba(255, 255, 255, 0.15);
}

.social-login-btn.discord:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Divider */
.login-divider {
    display: flex;
    align-items: center;
    margin: 1rem 0;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.login-divider span {
    padding: 0 1rem;
}

/* Email Login Form */
.email-login-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-weight: 500;
}

.form-input {
    padding: 0.75rem 0.875rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #ffffff;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.08);
}

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

.form-submit {
    padding: 0.75rem 1.25rem;
    background: var(--accent-color);
    border: none;
    border-radius: 10px;
    color: #000000;
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0;
}

.form-submit:hover {
    background: #ffb930;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(241, 168, 23, 0.3);
}

.form-submit:active {
    transform: translateY(0);
}

/* Error Box Wrapper - Reserve fixed space to prevent layout shift */
.login-error-wrapper {
    min-height: 55px;
    display: flex;
    align-items: center;
    margin-top: 0.375rem;
}

/* Error Box */
.login-error-box {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 10px;
    color: #ff6b6b;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    animation: slideDown 0.3s ease;
    backdrop-filter: blur(10px);
}

.login-error-box i {
    font-size: 1.125rem;
    flex-shrink: 0;
}

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

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

.login-error-box.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

.form-footer {
    text-align: center;
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

.form-footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.form-footer a:hover {
    color: #ffb930;
}

/* Password Toggle Styles */
.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px; /* Increased padded area for easier clicking */
    height: 32px; /* Fixed height for vertical centering */
    width: 32px; /* Fixed width */
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
    transition: color 0.3s;
}

.password-toggle-btn:hover {
    color: rgba(255, 255, 255, 0.9);
}

.password-toggle-btn:focus {
    outline: none;
    color: var(--accent-color);
}

.form-input.has-toggle {
    padding-right: 45px; /* Ensure text doesn't overlap icon */
    width: 100%; /* Force full width */
}

/* Ensure all inputs take full width */
.form-input {
    width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .login-modal {
        padding: 1.75rem 1.5rem;
        max-width: 95%;
    }
    
    .login-modal-title {
        font-size: 1.5rem;
    }
    
    .login-modal-subtitle {
        font-size: 0.8rem;
    }
    
    .social-login-btn {
        padding: 0.65rem 1rem;
        font-size: 0.85rem;
    }
    
    .social-login-btn i {
        font-size: 1.05rem;
    }
    
    .form-input {
        padding: 0.65rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .form-input.has-toggle {
        padding-right: 35px;
    }

    .form-label {
        font-size: 0.8rem;
    }
    
    .form-submit {
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .login-modal {
        padding: 1.5rem 1.25rem;
        max-width: 92%;
    }
    
    .login-modal-close {
        top: 0.75rem;
        right: 0.75rem;
        width: 28px;
        height: 28px;
        font-size: 1.35rem;
    }

    .login-modal-back {
        top: 0.75rem;
        right: 3rem;
        width: 28px;
        height: 28px;
        font-size: 1.15rem;
    }
    
    .login-modal-title {
        font-size: 1.35rem;
    }
    
    .login-modal-header {
        margin-bottom: 1.25rem;
    }
    
    .social-login-buttons {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .login-divider {
        margin: 0.75rem 0;
    }
    
    .form-footer {
        margin-top: 0.875rem;
        font-size: 0.8rem;
    }
}
