/* ========== AUTH OVERLAY - UNAUTHENTICATED STATE ========== */

/* Hide everything until auth state resolves (prevents flash) */
body:not([data-auth-ready]) {
    background: #003366;
}
body:not([data-auth-ready]) > * {
    display: none !important;
}

/* Scroll lock when not authenticated */
body:not([data-authenticated="true"]) {
    overflow: hidden;
}

/* Blur all body children except the overlay itself when not authenticated */
body[data-auth-ready]:not([data-authenticated="true"]) > *:not(#auth-overlay) {
    filter: blur(10px);
    pointer-events: none;
    user-select: none;
}

/* Auth overlay - full screen, centered */
#auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
}

/* Hide overlay when authenticated */
body[data-authenticated="true"] #auth-overlay {
    display: none;
}

/* Sign-in card */
#auth-card {
    background: #fff;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

#auth-card-header {
    background-color: #003366;
    padding: clamp(16px, 4vw, 28px) clamp(24px, 5vw, 40px);
}

#auth-logo {
    max-height: clamp(60px, 15vw, 100px);
    max-width: clamp(150px, 40vw, 300px);
    object-fit: contain;
    margin-bottom: 12px;
}

#auth-title {
    font-size: clamp(16px, 4vw, 22px);
    color: #fff;
    margin-bottom: 4px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: bold;
}

#auth-subtitle {
    font-size: clamp(10px, 2.5vw, 12px);
    color: rgba(255, 255, 255, 0.8);
}

#auth-card-body {
    padding: clamp(20px, 4vw, 32px) clamp(24px, 5vw, 40px);
}

/* Sign-in buttons */
#auth-google-btn,
#auth-microsoft-btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

#auth-google-btn:hover,
#auth-microsoft-btn:hover {
    background: #f5f5f5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#auth-google-btn {
    color: #333;
}

#auth-microsoft-btn {
    color: #333;
}

/* Error message */
#auth-error-msg {
    color: #D32F2F;
    font-size: 13px;
    margin-top: 8px;
    min-height: 0;
}

#auth-error-msg:empty {
    display: none;
}

/* ========== USER PROFILE BAR - AUTHENTICATED STATE ========== */

#auth-profile-bar {
    display: none;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 6px 16px;
    background: #003366;
    font-size: 13px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body[data-authenticated="true"] #auth-profile-bar {
    display: flex;
}

#auth-user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Hide avatar if no photo loaded */
#auth-user-avatar:not([src]) {
    display: none;
}

#auth-user-name {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
}

#auth-signout-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 11px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
}

#auth-signout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ========== CDN LOAD ERROR ========== */

#auth-cdn-error {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    background: #fff;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#auth-cdn-error p {
    font-size: 16px;
    color: #333;
    max-width: 400px;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 500px) {
    #auth-card {
        width: 95%;
    }

    #auth-profile-bar {
        padding: 6px 10px;
        font-size: 12px;
    }

    #auth-user-avatar {
        width: 24px;
        height: 24px;
    }
}
