/* Menu utilisateur - Style Google/Cursor */

/* Navigation à droite avec espace avant le menu utilisateur */
.header-nav {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 2rem !important;
}

.user-menu-container {
    position: relative;
    margin-left: 3rem;
    display: flex;
    align-items: center;
    /* Réserver l'espace exact pour éviter le clignotement lors du chargement */
    min-width: 40px;
    min-height: 40px;
}

/* Placeholder visible pendant le chargement (quand le container est vide) */
.user-menu-container:empty::before {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 200%;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* Animation de shimmer pour le placeholder */
@keyframes shimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

.user-avatar-btn {
    background: #e0e0e0; /* Placeholder pendant le chargement de l'image */
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    overflow: hidden;
    width: 40px;
    height: 40px;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0; /* Empêcher le rétrécissement */
}

.user-avatar-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.3);
}

.user-avatar-btn:active {
    transform: scale(0.95);
}

.user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    min-width: 320px;
    z-index: 1000;
    animation: dropdownFadeIn 0.2s ease-out;
}

.user-dropdown.hidden {
    display: none;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header du dropdown */
.user-dropdown-header {
    padding: 20px;
}

.user-dropdown-info {
    width: 100%;
}

.user-dropdown-name {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown-email {
    font-size: 14px;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Divider */
.user-dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0 8px;
}

/* Items du menu - Styles FORCÉS identiques pour <a> et <button> */
.user-dropdown-item,
.user-dropdown-logout,
a.user-dropdown-item,
button.user-dropdown-logout {
    /* Force tous les styles de base */
    display: block !important;
    width: calc(100% - 16px) !important;
    padding: 12px 20px !important;
    margin: 0 8px !important;
    border-radius: 8px !important;
    border: none !important;
    background: none !important;
    background-color: transparent !important;
    
    /* Typographie identique */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    letter-spacing: normal !important;
    
    /* Couleur et décoration */
    color: #6b7280 !important;
    text-align: left !important;
    text-decoration: none !important;
    text-transform: none !important;
    
    /* Comportement */
    cursor: pointer !important;
    box-sizing: border-box !important;
    transition: background-color 0.15s ease !important;
    -webkit-tap-highlight-color: transparent !important;
    
    /* Reset d'autres propriétés potentielles */
    outline: none !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
}

/* Tous les états de lien en gris */
.user-dropdown-item:link,
.user-dropdown-item:visited,
.user-dropdown-item:hover,
.user-dropdown-item:active,
a.user-dropdown-item:link,
a.user-dropdown-item:visited,
a.user-dropdown-item:hover,
a.user-dropdown-item:active {
    color: #6b7280 !important;
    text-decoration: none !important;
}

/* Hover IDENTIQUE pour les deux */
.user-dropdown-item:hover,
.user-dropdown-logout:hover,
a.user-dropdown-item:hover,
button.user-dropdown-logout:hover {
    background: #f3f4f6 !important;
    background-color: #f3f4f6 !important;
    color: #6b7280 !important;
}

/* Active identique pour les deux */
.user-dropdown-item:active,
.user-dropdown-logout:active,
a.user-dropdown-item:active,
button.user-dropdown-logout:active {
    background: #e5e7eb !important;
    background-color: #e5e7eb !important;
}

/* Espacement */
.user-dropdown-item:first-of-type {
    margin-top: 4px !important;
}

.user-dropdown-item:last-of-type,
.user-dropdown-logout {
    margin-bottom: 8px !important;
}

/* Modale de confirmation de déconnexion */
.logout-confirmation-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s;
}

.logout-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 24px;
    max-width: 400px;
    width: 90%;
    z-index: 1;
    animation: slideUp 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logout-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.logout-modal-message {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.logout-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.logout-modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-modal-btn-cancel {
    background: #f3f4f6;
    color: #1f2937;
}

/* ==========================================================================
   AUTH MODAL STYLES - REPLICA OF CONVERSATION VIEW DESIGN (kb_chat_messaging.css)
   ========================================================================== */

/* Overlay */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5); /* Identique à .modal-overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000; /* Match .modal z-index */
    animation: fadeIn 0.2s;
}

/* Dialog Container */
.auth-modal-dialog {
    position: relative;
    background-color: #ffffff; /* var(--color-background) */
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 400px; /* Slightly narrower for auth, but same style */
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.2s;
}

/* Header */
.auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 2rem; /* var(--spacing-lg) var(--spacing-xl) */
    border-bottom: none; /* Removed border as requested */
    position: relative;
}

.auth-modal-title {
    font-size: 1.75rem; /* Increased size */
    font-weight: 600;
    color: #202124; /* var(--color-text-primary) */
    margin: 0;
}

/* Close Button */
.auth-modal-close {
    background: none;
    border: none;
    padding: 0.5rem; /* var(--spacing-xs) approx */
    cursor: pointer;
    color: #5f6368; /* var(--color-text-secondary) */
    border-radius: 4px;
    transition: background-color 0.2s;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.auth-modal-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Body */
.auth-modal-body {
    padding: 2rem; /* var(--spacing-xl) */
}

/* Subtitle (specific to auth) */
.auth-subtitle {
    margin: -40px 0 24px 0; /* Moved up by 40px */
    color: #5f6368; /* var(--color-text-secondary) */
    font-size: 1.1rem; /* Increased font size */
    line-height: 1.5;
    text-align: center;
}

/* Error Box */
.auth-error {
    display: none;
    padding: 0.75rem;
    background: rgba(220, 53, 69, 0.1); /* var(--color-error) with opacity */
    border: 1px solid #dc3545; /* var(--color-error) */
    border-radius: 8px;
    color: #dc3545;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* Form Group */
.auth-form-group {
    margin-bottom: 1.5rem; /* var(--spacing-lg) */
    position: relative; /* Needed for tooltip positioning */
}

.auth-form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem; /* var(--spacing-sm) */
    color: #202124; /* var(--color-text-primary) */
    font-size: 0.875rem;
}

/* Inputs */
.auth-form-input {
    width: 100%;
    padding: 0.8rem 1rem; /* var(--spacing-md) tailored */
    border: 1px solid #dadce0; /* var(--color-border) */
    border-radius: 8px; /* var(--border-radius) */
    font-size: 1rem;
    font-family: inherit;
    color: #202124;
    background-color: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-form-input:focus {
    outline: none;
    border-color: #1a73e8; /* var(--color-primary) */
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.auth-form-input.invalid {
    border-color: #dc3545; /* Red border on error */
}

.auth-form-input::placeholder {
    color: #9aa0a6; /* Light gray */
}

/* Buttons */
.auth-btn-primary {
    width: 100%;
    padding: 0.75rem 1.5rem; /* var(--spacing-sm) var(--spacing-lg) tailored */
    background-color: #1a73e8; /* var(--color-primary) */
    color: #ffffff; /* var(--color-text-inverse) */
    border: 1px solid #1a73e8;
    border-radius: 8px; /* var(--border-radius) */
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    margin-bottom: 1rem;
}

.auth-btn-primary:hover {
    background-color: #1557b0; /* var(--color-primary-dark) */
    border-color: #1557b0;
}

/* Separator */
.auth-separator {
    text-align: center;
    margin: 1.5rem 0;
    color: #9ca3af;
    font-size: 0.875rem;
    position: relative;
}

.auth-separator-text {
    background: white;
    padding: 0 1rem;
    position: relative;
    z-index: 1;
    color: #5f6368;
}

.auth-separator-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
}

/* Google Button (Secondary style but specific) */
.auth-google-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background-color: #ffffff;
    color: #374151;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s, border-color 0.2s;
}

.auth-google-btn:hover {
    background-color: #f8f9fa; /* var(--color-secondary) */
    border-color: #d1d5db;
}

/* ==========================================================================
   CUSTOM VALIDATION TOOLTIP - UPDATED to match Conversation View (Below Input)
   ========================================================================== */

.auth-validation-tooltip {
    position: absolute;
    top: calc(100% + 4px); /* Positioned below the form group (below input) */
    left: 0;
    
    /* Visual Style - Matching kb_chat_messaging.css tooltips */
    background-color: #000000;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
    z-index: 1000; /* Ensure it is on top */
    
    /* Animation */
    animation: fadeIn 0.2s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

/* Arrow for tooltip (Pointing Up) */
.auth-validation-tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%; /* At the top of the tooltip */
    left: 20px; /* Align arrow */
    
    /* Triangle */
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #000000; /* Pointing Up */
}
