/* Authentication Styles */

/* Auth container in header */
#auth-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-loading {
    color: var(--text-secondary, #888);
    font-size: 14px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-email {
    color: var(--text-secondary, #888);
    font-size: 14px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* User email display in top nav (minimal) */
.user-email-display {
    color: var(--text-muted, #666);
    font-size: 13px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-signin,
.btn-signout {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-signin {
    background: var(--accent-color, #3b82f6);
    color: white;
}

.btn-signin:hover {
    background: var(--accent-hover, #2563eb);
}

.btn-signout {
    background: transparent;
    color: var(--text-secondary, #888);
    border: 1px solid var(--border-color, #333);
}

.btn-signout:hover {
    background: var(--hover-bg, #1a1a1a);
    color: var(--text-primary, #fff);
}

/* Auth Modal */
.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.auth-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.auth-modal-content {
    position: relative;
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, #333);
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.auth-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.auth-modal-close:hover {
    background: var(--hover-bg, #252525);
    color: var(--text-primary, #fff);
}

.auth-modal-content h2 {
    margin: 0 0 24px 0;
    color: var(--text-primary, #fff);
    font-size: 24px;
    font-weight: 600;
}

.auth-modal-content p {
    color: var(--text-secondary, #888);
    margin-bottom: 20px;
}

/* Form styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--text-primary, #fff);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-primary, #0d0d0d);
    border: 1px solid var(--border-color, #333);
    border-radius: 8px;
    color: var(--text-primary, #fff);
    font-size: 15px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color, #3b82f6);
}

.form-group input::placeholder {
    color: var(--text-muted, #555);
}

.form-group small {
    display: block;
    color: var(--text-muted, #666);
    font-size: 12px;
    margin-top: 6px;
}

.auth-error {
    color: #ef4444;
    font-size: 14px;
    margin-bottom: 16px;
    min-height: 20px;
}

.btn-primary {
    width: 100%;
    padding: 12px 20px;
    background: var(--accent-color, #3b82f6);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-primary:hover {
    background: var(--accent-hover, #2563eb);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-links {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color, #333);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-links a {
    color: var(--accent-color, #3b82f6);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.auth-links a:hover {
    color: var(--accent-hover, #60a5fa);
    text-decoration: underline;
}

/* Protected content visibility */
.auth-protected {
    /* Will be hidden by JS when not authenticated */
}

.auth-public {
    /* Will be hidden by JS when authenticated */
}

/* ============================================
   LOGIN PAGE (index.html)
   Full-page centered login layout
   ============================================ */

/* Hide page until auth resolves (prevents flash) */
.login-body {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.login-body.ready {
    opacity: 1;
}

.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-primary, #0d0d0d);
    position: relative;
    overflow: hidden;
}

/* Subtle background gradient */
.login-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(31, 111, 235, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(163, 113, 247, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.login-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-default, #333);
    border-radius: 16px;
    padding: 40px 36px 36px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(31, 111, 235, 0.05);
    animation: loginFadeIn 0.5s ease-out;
}

@keyframes loginFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Brand header above the form */
.login-brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(31, 111, 235, 0.15) 0%, rgba(163, 113, 247, 0.15) 100%);
    border: 1px solid rgba(31, 111, 235, 0.3);
    color: var(--accent-blue, #1f6feb);
}

.login-brand h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin: 0 0 6px;
    letter-spacing: -0.5px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-muted, #666);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 500;
}

/* Form rendered inside login container */
#auth-form-container h2 {
    margin: 0 0 24px;
    color: var(--text-primary, #fff);
    font-size: 20px;
    font-weight: 600;
}

#auth-form-container p {
    color: var(--text-secondary, #888);
    margin-bottom: 20px;
    font-size: 14px;
}

/* Loading state */
.auth-loading-state {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

.auth-loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-default, #333);
    border-top-color: var(--accent-blue, #1f6feb);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Footer */
.login-footer {
    position: relative;
    margin-top: 24px;
    text-align: center;
    color: var(--text-faint, #555);
    font-size: 11px;
    max-width: 420px;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 480px) {
    .auth-modal-content {
        margin: 20px;
        padding: 24px;
    }

    .login-container {
        padding: 32px 24px 28px;
        border-radius: 12px;
    }

    .login-brand h1 {
        font-size: 22px;
    }

    .login-logo {
        width: 48px;
        height: 48px;
    }

    .login-logo svg {
        width: 32px;
        height: 32px;
    }
}
