/* Modern Authentication Modal Styles */

/* Modal Backdrop & Container */
#authModal,
#logoutModal {
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    /* Ensure it's above everything */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#authModal.show,
#logoutModal.show {
    opacity: 1;
    pointer-events: auto;
}

#authModal .modal-content,
#logoutModal .modal-content {
    background: var(--surface-modal);
    /* Deep dark blue-gray surface for dark mode, Cream for light mode */
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    padding: 2.5rem;
    max-width: 420px;
    width: 90%;
    position: relative;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    box-sizing: border-box;
}

#authModal.show .modal-content,
#logoutModal.show .modal-content {
    transform: scale(1);
}

/* Subtle glow effect at the top */
#authModal .modal-content::before,
#logoutModal .modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
}

/* Typography */
#authModalTitle,
#logoutModal h2 {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 2rem;
    letter-spacing: -0.01em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Inputs */
.auth-input {
    width: 100%;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
    /* Fix sizing issues */
}

.auth-input:focus {
    outline: none;
    border-color: var(--accent-color1);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 3px var(--accent-glow-weak);
}

/* Anmeldung über Discord.
   Bewusst in Discords eigenem Blurple statt im Seitenakzent: Der Knopf ist
   ein Versprechen darüber, wo man gleich landet, und den erkennt man an der
   Farbe schneller als am Text. */
.auth-discord-btn {
    width: 100%;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    border: none;
    border-radius: 12px;
    background: #5865f2;
    color: #fff;
    font-family: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.auth-discord-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(88, 101, 242, 0.45);
    filter: brightness(1.08);
}

.auth-discord-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* Während der Weiterleitung: Der Knopf ist bereits gedrückt, ein zweiter
   Klick würde nur einen zweiten Anlauf starten. */
.auth-discord-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.auth-hinweis {
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
    text-align: center;
}

/* Submit Button */
.auth-submit-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-color1) 0%, color-mix(in srgb, var(--accent-color1), black 20%) 100%);
    color: var(--text-dark);
    /* Contrast text */
    font-weight: 700;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px var(--accent-glow);
    filter: brightness(1.1);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

/* Google Button */
.auth-google-btn {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: var(--surface-card);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.2s ease;
    margin-top: 0;
    /* Handled by container gap */
}

.auth-google-btn:hover {
    background: color-mix(in srgb, var(--surface-card), white 5%);
    border-color: var(--border);
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-divider span {
    padding: 0 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Footer Link */
.auth-switch {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-switch a {
    color: var(--accent-color1);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    margin-left: 0.25rem;
    transition: color 0.2s;
}

.auth-switch a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Error Message */
#authError {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #fca5a5;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Close Button Overrides */
#authModal .modal-close {
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-secondary);
}

#authModal .modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: rotate(90deg);
}

/* Lock Screen Overlay (Generic) */
.lock-screen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    /* Slightly more transparent than settings */
    backdrop-filter: blur(12px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    border-radius: inherit;
    /* Respect container radius */
}

.lock-screen-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.lock-screen-icon {
    width: 64px;
    height: 64px;
    color: var(--accent-color1);
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 15px var(--accent-glow));
}

.lock-screen-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
    background: linear-gradient(to bottom, #fff, #ccc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.lock-screen-text {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 300px;
    line-height: 1.5;
    font-size: 1.05rem;
}

/* Ensure Settings Modal handles the overlay correctly */
#settingsModal .modal-content {
    position: relative;
    overflow-y: auto;
    /* Allows content to scroll while maintaining overlay positioning */
}

#settingsModal .modal-close {
    z-index: 20;
    /* Keep close button clickable */
}

/* Mobile Adjustments */
@media (max-width: 480px) {

    #authModal .modal-content,
    #logoutModal .modal-content {
        padding: 1.5rem;
        width: 92%;
    }

    #authModalTitle,
    #logoutModal h2 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
}