/* ===================================
   SIDEBAR FINAL - ESTILOS COMPLETOS E OTIMIZADOS
   =================================== */

:root {
    --sidebar-width: 280px;
    --sidebar-bg: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --sidebar-text: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active: rgba(255, 255, 255, 0.2);
    --sidebar-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
}

/* Sidebar Principal */
.sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: var(--sidebar-width) !important;
    height: 100vh !important;
    background: var(--sidebar-bg) !important;
    color: var(--sidebar-text) !important;
    z-index: 1000 !important;
    overflow-y: auto;
    box-shadow: var(--sidebar-shadow);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateX(0) !important;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    will-change: transform;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.05) 100%);
}

/* Header da Sidebar */
.sidebar-header {
    padding: 2rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.sidebar-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    position: relative;
    z-index: 2;
}

.logo-glow {
    position: relative;
}

.user-avatar {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.user-avatar:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.3);
}

.brand-info h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(45deg, #ffffff, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-info p {
    margin: 0.5rem 0 0 0;
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Navegação */
.sidebar-nav {
    padding: 1rem 0;
    flex: 1;
}

.sidebar-section {
    margin-bottom: 2rem;
    position: relative;
}

.sidebar-section-title {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-section-title i {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Itens de Navegação */
.nav-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border-radius: 0;
    margin: 0 0.5rem 0.25rem 0.5rem;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--sidebar-hover);
    transition: left 0.3s ease;
    z-index: 1;
}

.nav-item:hover::before {
    left: 0;
}

.nav-item:hover {
    color: var(--sidebar-text);
    transform: translateX(5px);
}

.nav-item.active {
    background: var(--sidebar-active);
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.nav-item.active::before {
    left: 0;
    background: var(--sidebar-active);
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    position: relative;
    z-index: 2;
    font-size: 1.1rem;
}

.nav-text {
    flex: 1;
    font-weight: 500;
    position: relative;
    z-index: 2;
}

.nav-badge {
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-weight: bold;
    position: relative;
    z-index: 2;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.nav-indicator {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: #fbbf24;
    border-radius: 3px 0 0 3px;
    transition: height 0.3s ease;
}

.nav-item.active .nav-indicator {
    height: 60%;
}

/* Language Selector */
.language-selector {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.language-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    font-weight: 500;
}

.language-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.language-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.75rem;
    font-weight: 500;
    min-height: 44px;
}

.language-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-1px);
}

.language-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: #667eea;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.language-btn .flag {
    font-size: 1.25rem;
    line-height: 1;
}

.language-btn .lang-name {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Footer */
.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.75rem;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

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

.logout-icon {
    font-size: 1rem;
}

/* Overlay e Menu Toggle */
.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;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

.menu-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--sidebar-bg);
    border: none;
    border-radius: 0.75rem;
    padding: 0.75rem;
    color: white;
    cursor: pointer;
    box-shadow: var(--sidebar-shadow);
    transition: all 0.3s ease;
    font-size: 1.2rem;
    display: none;
}

.menu-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Conteúdo Principal */
.main-content-with-sidebar {
    margin-left: 280px;
    min-height: 100vh;
    background: #f8fafc;
    transition: margin-left 0.3s ease;
}

.main-content-with-sidebar main {
    background: white;
    min-height: 100vh;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease;
        z-index: 999 !important;
        visibility: visible !important;
        opacity: 1 !important;
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        background: var(--sidebar-bg) !important;
    }
    
    .sidebar.open {
        transform: translateX(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
        display: block !important;
        z-index: 9999 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        background: var(--sidebar-bg) !important;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3) !important;
    }
    
    .main-content-with-sidebar {
        margin-left: 0 !important;
    }
    
    .menu-toggle {
        display: flex !important;
        z-index: 1001 !important;
    }
    
    .overlay {
        opacity: 0;
        visibility: hidden;
        z-index: 998 !important;
    }
    
    .overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 768px) {
    .sidebar {
        max-width: 280px;
        transform: translateX(-100%) !important;
        z-index: 999 !important;
        visibility: visible !important;
        opacity: 1 !important;
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        background: var(--sidebar-bg) !important;
    }
    
    .sidebar.open {
        transform: translateX(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
        display: block !important;
        z-index: 9999 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        background: var(--sidebar-bg) !important;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3) !important;
    }
    
    .main-content-with-sidebar {
        margin-left: 0 !important;
        padding: 1rem;
    }
    
    .menu-toggle {
        display: flex !important;
        z-index: 1001 !important;
    }
    
    .overlay {
        z-index: 998 !important;
    }
    
    .sidebar-header {
        padding: 1rem 0.75rem;
    }
    
    .sidebar-header h2 {
        font-size: 1.25rem;
    }
    
    .sidebar-header p {
        font-size: 0.8rem;
    }
    
    .nav-item {
        padding: 0.875rem 1rem;
    }
    
    .nav-text {
        font-size: 0.9rem;
    }
    
    .language-options {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }
    
    .language-btn {
        padding: 0.6rem;
        min-height: 40px;
        font-size: 0.7rem;
    }
    
    .language-btn .flag {
        font-size: 1.1rem;
    }
    
    .language-btn .lang-name {
        font-size: 0.65rem;
    }
}

@media (max-width: 640px) {
    .sidebar {
        max-width: 280px;
        transform: translateX(-100%) !important;
        z-index: 999 !important;
        visibility: visible !important;
        opacity: 1 !important;
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        background: var(--sidebar-bg) !important;
    }
    
    .sidebar.open {
        transform: translateX(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
        display: block !important;
        z-index: 9999 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        background: var(--sidebar-bg) !important;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3) !important;
    }
    
    .main-content-with-sidebar {
        margin-left: 0 !important;
        padding: 0.75rem;
    }
    
    .menu-toggle {
        display: flex !important;
        z-index: 1001 !important;
    }
    
    .overlay {
        z-index: 998 !important;
    }
    
    .sidebar-header {
        padding: 0.75rem 1rem;
    }
    
    .sidebar-header h2 {
        font-size: 1.125rem;
    }
    
    .sidebar-header p {
        font-size: 0.8rem;
    }
    
    .nav-item {
        padding: 0.75rem 0.75rem;
        margin: 0 0.25rem 0.125rem 0.25rem;
    }
    
    .nav-icon {
        margin-right: 0.75rem;
    }
    
    .nav-text {
        font-size: 0.875rem;
    }
    
    .language-btn {
        padding: 0.5rem;
        min-height: 36px;
        font-size: 0.7rem;
    }
    
    .language-btn .flag {
        font-size: 1rem;
    }
    
    .language-btn .lang-name {
        font-size: 0.65rem;
    }
}

/* Scrollbar personalizado */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Animações adicionais */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.sidebar {
    animation: slideInLeft 0.5s ease-out;
}
