/* ===== NAVBAR FREITESAAS - VERSÃO LIMPA E ORGANIZADA ===== */
/* 
 * Estrutura simplificada:
 * - Desktop: Navbar superior completa
 * - Mobile (não logado): Navbar superior + drawer
 * - Mobile (logado): Apenas navbar inferior
 */

/* ===== VARIÁVEIS CSS ===== */
:root {
    --navbar-height: 70px;
    --bottom-nav-height: 60px;
    --mobile-breakpoint: 768px;
}

/* ===== NAVBAR SUPERIOR (DESKTOP E MOBILE NÃO LOGADO) ===== */
.header {
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #e5e7eb;
    height: var(--navbar-height);
}

.navbar {
    height: 100%;
    background: var(--white);
}

.navbar .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

/* ===== LOGO/BRAND ===== */
.navbar-brand {
    flex-shrink: 0;
}

.navbar-brand .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.navbar-brand .logo:hover {
    color: var(--primary-dark);
    transform: translateY(-1px);
}

.navbar-brand .logo i {
    font-size: 1.75rem;
    color: var(--primary-color);
}

/* ===== MENU DE NAVEGAÇÃO ===== */
.navbar-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex: 1;
    justify-content: center;
}

.navbar-menu .nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    white-space: nowrap;
}

.navbar-menu .nav-link:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.navbar-menu .nav-link.active {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    font-weight: 600;
}

.navbar-menu .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
}

.navbar-menu .nav-link i {
    font-size: 1.1rem;
}

/* ===== AÇÕES DA NAVBAR ===== */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* Botão de Login */
.btn-login-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--primary-color);
    white-space: nowrap;
}

.btn-login-nav:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* ===== MENU DO USUÁRIO ===== */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.user-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #374151;
    font-weight: 500;
    padding: 0.5rem 0.875rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    min-width: fit-content;
    font-size: 0.875rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.3s ease;
}

.user-name:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.user-name i {
    color: var(--primary-color);
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* Botão do Dashboard */
.btn-dashboard {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--primary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--primary-color);
    font-size: 0.875rem;
    white-space: nowrap;
}

.btn-dashboard:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Botão de Logout */
.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: #ef4444;
    color: var(--white);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid #ef4444;
    font-size: 0.875rem;
    white-space: nowrap;
}

.btn-logout:hover {
    background: #dc2626;
    border-color: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ===== TOGGLE MOBILE ===== */
.navbar-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    z-index: 1001;
}

.navbar-toggle span {
    width: 25px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.navbar-toggle:hover span {
    background: var(--primary-dark);
}

.navbar-toggle span.active:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.navbar-toggle span.active:nth-child(2) {
    opacity: 0;
}

.navbar-toggle span.active:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ===== NAVBAR INFERIOR (MOBILE - APENAS USUÁRIOS LOGADOS) ===== */
.bottom-navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    height: var(--bottom-nav-height);
    display: none;
}

.bottom-nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    color: #6b7280;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    min-width: 60px;
    text-align: center;
}

.bottom-nav-item:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.bottom-nav-item.active {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.bottom-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.125rem;
}

.bottom-nav-item span {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

/* ===== DRAWER MOBILE ===== */
.mobile-drawer {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100vh;
    background: var(--white);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: right 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.mobile-drawer.active {
    right: 0;
}

.mobile-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-drawer-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    position: relative;
}

.mobile-drawer-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.mobile-drawer-header p {
    margin: 0.5rem 0 0 0;
    opacity: 0.9;
    font-size: 0.875rem;
}

.mobile-drawer-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.mobile-drawer-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mobile-drawer-content {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
        gap: 1rem;
    }
    
.mobile-drawer-section {
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 1rem;
}

.mobile-drawer-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.mobile-drawer-section h4 {
    margin: 0 0 1rem 0;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mobile-drawer-nav {
    display: flex;
    flex-direction: column;
        gap: 0.5rem;
    }
    
.mobile-drawer-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: #6b7280;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.mobile-drawer-nav .nav-link:hover {
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary-color);
}

.mobile-drawer-nav .nav-link.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    font-weight: 600;
}

.mobile-drawer-nav .nav-link i {
    font-size: 1.125rem;
    width: 20px;
    text-align: center;
}

.mobile-drawer-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
}

.mobile-drawer-actions .btn {
    display: flex;
    align-items: center;
        justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.mobile-drawer-actions .btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.mobile-drawer-actions .btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

.mobile-drawer-actions .btn-danger {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.mobile-drawer-actions .btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    transform: translateY(-1px);
}

.mobile-drawer-actions .btn-outline {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.mobile-drawer-actions .btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

/* ===== RESPONSIVIDADE - DESKTOP (>= 769px) ===== */
@media (min-width: 769px) {
    /* Sempre mostrar navbar superior em desktop */
    .header {
        display: block !important;
    }
    
    /* Sempre ocultar navbar inferior em desktop */
    .bottom-navbar {
        display: none !important;
    }
    
    /* Sempre mostrar menu e botões em desktop */
    .navbar-menu {
        display: flex !important;
    }
    
    .btn-dashboard {
        display: flex !important;
    }
    
    /* Ocultar drawer em desktop */
    .mobile-drawer,
    .mobile-drawer-overlay {
        display: none !important;
    }
}

/* ===== RESPONSIVIDADE - MOBILE (<= 768px) ===== */
@media (max-width: 768px) {
    /* ===== USUÁRIOS LOGADOS ===== */
    body.logged-in .header {
        display: none !important;
    }
    
    body.logged-in .bottom-navbar {
        display: block !important;
    }
    
    /* Adicionar padding-bottom ao conteúdo para não sobrepor navbar inferior */
    body.logged-in .main-content {
        padding-bottom: calc(var(--bottom-nav-height) + 1rem);
    }
    
    /* ===== USUÁRIOS NÃO LOGADOS ===== */
    body:not(.logged-in) .navbar .container {
        padding: 0 1rem;
        gap: 1rem;
    }
    
    body:not(.logged-in) .navbar-menu {
        display: none;
    }
    
    body:not(.logged-in) .navbar-toggle {
        display: flex;
    }
    
    body:not(.logged-in) .navbar-actions {
        gap: 0.5rem;
    }
    
    body:not(.logged-in) .btn-login-nav {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    /* Menu dropdown para usuários não logados */
    body:not(.logged-in) .navbar-menu {
        position: fixed;
        top: var(--navbar-height);
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: 2rem 1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        gap: 1rem;
        z-index: 999;
    }
    
    body:not(.logged-in) .navbar-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    /* Ajustar drawer para mobile */
    .mobile-drawer {
        width: 280px;
        right: -280px;
    }
}

/* ===== RESPONSIVIDADE - MOBILE PEQUENO (<= 640px) ===== */
@media (max-width: 640px) {
    /* Para usuários não logados */
    body:not(.logged-in) .navbar .container {
        padding: 0 0.75rem;
        gap: 0.75rem;
    }
    
    body:not(.logged-in) .navbar-brand .logo {
        font-size: 1.25rem;
        gap: 0.5rem;
    }
    
    body:not(.logged-in) .navbar-brand .logo i {
        font-size: 1.5rem;
    }
    
    /* Ajustar navbar inferior */
    .bottom-nav-container {
        padding: 0 1.5rem;
    }
    
    .bottom-nav-item {
        min-width: 55px;
        padding: 0.4rem;
    }
    
    .bottom-nav-item i {
        font-size: 1.1rem;
    }
    
    .bottom-nav-item span {
        font-size: 0.7rem;
    }
    
    /* Ajustar drawer */
    .mobile-drawer {
        width: 260px;
        right: -260px;
    }
}

/* ===== RESPONSIVIDADE - MOBILE MUITO PEQUENO (<= 480px) ===== */
@media (max-width: 480px) {
    /* Para usuários não logados */
    body:not(.logged-in) .navbar {
        padding: 0.75rem 0;
    }
    
    body:not(.logged-in) .navbar .container {
        padding: 0 0.5rem;
        gap: 0.5rem;
    }
    
    body:not(.logged-in) .navbar-brand .logo {
        font-size: 1.125rem;
        gap: 0.4rem;
    }
    
    body:not(.logged-in) .navbar-brand .logo i {
        font-size: 1.25rem;
    }
    
    body:not(.logged-in) .navbar-menu .nav-link {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
        justify-content: center;
    }
    
    body:not(.logged-in) .navbar-actions {
        min-width: 140px;
        gap: 0.5rem;
    }
    
    body:not(.logged-in) .btn-login-nav {
        padding: 0.625rem;
        font-size: 0.75rem;
        gap: 0.25rem;
    }
    
    /* Ajustar navbar inferior */
    .bottom-nav-item {
        min-width: 50px;
        padding: 0.375rem;
    }
    
    .bottom-nav-item i {
        font-size: 1.125rem;
    }
    
    .bottom-nav-item span {
        font-size: 0.6875rem;
    }
    
    /* Ajustar drawer */
    .mobile-drawer {
        width: 240px;
        right: -240px;
    }
    
    .mobile-drawer-header {
        padding: 1rem;
    }
    
    .mobile-drawer-content {
        padding: 1rem;
    }
}

/* ===== ANIMAÇÕES ===== */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.navbar-menu.active {
    animation: slideDown 0.3s ease-out;
}

.mobile-drawer.active {
    animation: slideInRight 0.3s ease-out;
}

/* ===== ESTADOS DE FOCUS (ACESSIBILIDADE) ===== */
.navbar-menu .nav-link:focus,
.btn-login-nav:focus,
.btn-logout:focus,
.btn-dashboard:focus,
.mobile-drawer-nav .nav-link:focus,
.mobile-drawer-actions .btn:focus,
.bottom-nav-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== DARK MODE (OPCIONAL) ===== */
@media (prefers-color-scheme: dark) {
    .header {
        background: #1f2937;
        border-bottom-color: #374151;
    }
    
    .navbar {
        background: #1f2937;
    }
    
    .navbar-menu .nav-link {
        color: #d1d5db;
    }
    
    .navbar-menu .nav-link:hover {
        background: rgba(37, 99, 235, 0.2);
    }
    
    .user-name {
        background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
        border-color: #4b5563;
        color: #d1d5db;
    }
    
    .user-name:hover {
        background: linear-gradient(135deg, #4b5563 0%, #6b7280 100%);
        border-color: #6b7280;
}

.bottom-navbar {
        background: #1f2937;
        border-top-color: #374151;
    }
    
    .mobile-drawer {
        background: #1f2937;
    }
}

/* ===== REDUÇÃO DE MOVIMENTO (ACESSIBILIDADE) ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}