/**
 * ================================================
 * HEADER COMPLETO - DESIGN ELEGANTE E MODERNO
 * ================================================
 * Criado: 2025-10-21
 * Sistema de Design Profissional
 */

/* ================================================
   1. HEADER BASE - Limpo e Profissional
   ================================================ */

.header-navbar {
    background: #ffffff;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.header-navbar .navbar-container {
    padding: 0.75rem 1.5rem;
}

.header-navbar .navbar-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ================================================
   2. WALLET BADGE - Elegante e Moderno
   ================================================ */

.wallet-badge-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, #7367f0 0%, #9055ff 100%);
    border-radius: 12px;
    color: white;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(115, 103, 240, 0.25);
    min-height: 44px;
}

.wallet-badge-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(115, 103, 240, 0.35);
    color: white;
    text-decoration: none;
}

.wallet-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
}

.wallet-amount {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.wallet-label {
    font-size: 0.7rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.wallet-value {
    font-size: 0.95rem;
    font-weight: 700;
}

/* ================================================
   3. LANGUAGE SELECTOR - Clean e Intuitivo
   ================================================ */

.language-selector {
    position: relative;
}

.language-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.language-toggle:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.flag-icon {
    font-size: 1.2rem;
}

.lang-code {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
}

.language-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.language-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f3f5;
}

.language-menu-item:last-child {
    border-bottom: none;
}

.language-menu-item:hover {
    background: #f8f9fa;
    color: #7367f0;
    padding-left: 1.5rem;
}

/* ================================================
   4. USER PROFILE TRIGGER - Elegante e Compacto
   ================================================ */

.user-profile-wrapper {
    position: relative;
}

.user-profile-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #7367f0 0%, #9055ff 100%);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    min-height: 44px;
    box-shadow: 0 4px 12px rgba(115, 103, 240, 0.25);
}

.user-profile-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(115, 103, 240, 0.35);
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.3;
    padding-right: 0.25rem;
}

.user-profile-trigger .user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    margin: 0;
    line-height: 1.2;
}

.user-profile-trigger .user-role {
    font-size: 0.7rem;
    opacity: 0.95;
    background: rgba(255, 255, 255, 0.25);
    padding: 0.15rem 0.6rem;
    border-radius: 8px;
    margin-top: 0.25rem;
    color: white;
    font-weight: 500;
}

.user-avatar {
    position: relative;
    flex-shrink: 0;
}

.user-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid white;
    object-fit: cover;
}

.user-status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: #10b981;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

/* ================================================
   5. USER POPOVER - ELEGANTE E FUNCIONAL
   ================================================ */

.user-popover {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    min-width: 320px;
    max-width: 360px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-15px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99999 !important;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* CRÍTICO - Estado ativo do popover */
.user-popover.active {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
    display: block !important;
    pointer-events: auto !important;
}

/* Arrow elegante */
.user-popover::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 30px;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #7367f0 0%, #9055ff 100%);
    transform: rotate(45deg);
    border-radius: 3px;
    z-index: 1;
}

.popover-header {
    background: linear-gradient(135deg, #7367f0 0%, #9055ff 100%);
    padding: 2rem 1.75rem;
    color: white;
    text-align: center;
    position: relative;
}

.popover-header .user-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: white !important;
    word-break: break-word;
    line-height: 1.3;
}

.popover-header .user-email {
    font-size: 0.85rem;
    opacity: 0.95;
    color: white !important;
    word-break: break-word;
    line-height: 1.4;
}

.popover-body {
    padding: 1rem 0;
}

.popover-menu-item {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.1rem 1.75rem;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f3f5;
    position: relative;
    background: white;
}

.popover-menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(135deg, #7367f0 0%, #9055ff 100%);
    transition: width 0.3s ease;
}

.popover-menu-item:hover::before {
    width: 4px;
}

.popover-menu-item:hover {
    background: #f8f9fa;
    color: #7367f0;
    text-decoration: none;
}

.popover-menu-item:last-child {
    border-bottom: none;
}

.popover-menu-item .menu-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.popover-menu-item .menu-icon svg {
    width: 18px;
    height: 18px;
}

.popover-menu-item .menu-text {
    font-size: 0.95rem;
    font-weight: 500;
    flex: 1;
}

.popover-menu-item.logout {
    color: #dc3545;
}

.popover-menu-item.logout:hover {
    background: #fff5f5;
    color: #c92a2a;
}

.popover-menu-item.logout::before {
    background: linear-gradient(135deg, #dc3545 0%, #c92a2a 100%);
}

/* ================================================
   6. OVERLAY - Fechar ao clicar fora
   ================================================ */

.popover-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 9998;
    display: none;
    pointer-events: none;
}

.popover-overlay.active {
    display: block !important;
    pointer-events: auto !important;
}

/* ================================================
   7. RESPONSIVE - Mobile First
   ================================================ */

@media (max-width: 768px) {
    .user-info {
        display: none;
    }

    .user-profile-trigger {
        padding: 0.5rem;
        min-height: 40px;
    }

    .wallet-amount {
        display: none;
    }

    .wallet-badge-wrapper {
        padding: 0.6rem;
        min-height: 40px;
    }

    .lang-code {
        display: none;
    }

    .user-popover {
        right: -20px;
        min-width: 280px;
    }
}

/* ================================================
   8. ANIMAÇÕES SUAVES
   ================================================ */

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.user-popover.active {
    animation: slideInDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ================================================
   9. GARANTIAS DE FUNCIONAMENTO
   ================================================ */

.user-popover,
.language-menu {
    pointer-events: auto !important;
}

.user-popover.active,
.language-menu.active {
    pointer-events: auto !important;
}
