/**
 * Authentication & Header Auth Styles
 */

/* =========================================
   Utility
   ========================================= */

.hidden {
    display: none !important;
}

/* =========================================
   Header Auth Buttons (logged out state)
   ========================================= */

.nav-auth-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}

.btn-sign-in {
    background: none;
    border: 1px solid var(--gold-primary, #C4943A);
    color: var(--gold-primary, #C4943A);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sign-in:hover {
    background: var(--gold-primary, #C4943A);
    color: white;
}

.btn-join-free {
    background: var(--gold-primary, #C4943A);
    border: 1px solid var(--gold-primary, #C4943A);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-join-free:hover {
    background: #b8882f;
    border-color: #b8882f;
}

/* =========================================
   User Menu (logged in state)
   ========================================= */

.user-menu {
    position: relative;
    margin-left: 1rem;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: var(--cream, #E8DCC4);
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.user-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gold-primary, #C4943A);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-display-name {
    font-size: 0.9rem;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-arrow {
    font-size: 0.6rem;
    opacity: 0.7;
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 220px;
    background: var(--rich-brown, #2A1D14);
    border: 1px solid rgba(196, 148, 58, 0.3);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1100;
    overflow: hidden;
}

.user-dropdown.open {
    display: block;
}

.user-dropdown-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(196, 148, 58, 0.2);
}

.user-dropdown-name {
    color: var(--cream, #E8DCC4);
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0;
}

.user-dropdown-email {
    color: var(--cream, #E8DCC4);
    opacity: 0.7;
    font-size: 0.8rem;
    margin: 0.2rem 0 0;
}

.user-dropdown-item {
    display: block;
    width: 100%;
    padding: 0.65rem 1rem;
    background: none;
    border: none;
    color: var(--cream, #E8DCC4);
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.user-dropdown-item:hover {
    background: rgba(196, 148, 58, 0.15);
}

/* Hide auth buttons on mobile (handled by mobile menu) */
@media (max-width: 768px) {
    .nav-auth-buttons,
    .user-menu {
        display: none;
    }
}

/* =========================================
   Auth Modal
   ========================================= */

#authModal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    padding: 1rem;
}

#authModal.open {
    display: flex;
}

.auth-modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.auth-modal-header h2 {
    margin: 0;
    color: var(--deep-brown, #3D2B1F);
}

.auth-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--rich-brown, #2A1D14);
    padding: 0.5rem;
}

.auth-close:hover {
    color: var(--gold-primary, #C4943A);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-field.hidden {
    display: none;
}

.auth-field label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--deep-brown, #3D2B1F);
}

.auth-field input {
    padding: 0.75rem 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--gold-primary, #C4943A);
}

.auth-submit {
    padding: 0.875rem 1.5rem;
    background: var(--gold-primary, #C4943A);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

.auth-submit:hover {
    background: #b8882f;
}

.auth-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.auth-error {
    background: #fee;
    color: #c00;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    white-space: pre-line;
}

.auth-error.hidden {
    display: none;
}

.auth-hint {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.25rem;
}

.auth-field-error {
    font-size: 0.75rem;
    color: #c00;
    margin-top: 0.25rem;
}

.auth-field-error.hidden {
    display: none;
}

.auth-switch {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--rich-brown, #2A1D14);
}

.auth-switch a {
    color: var(--gold-primary, #C4943A);
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}
