@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* --- Paleta Agillcomex --- */
    --agill-blue: #0047AB;
    --agill-blue-light: #E6F0FF;
    --agill-red: #D32F2F;
    --agill-green: #2E7D32;
    --agill-gray-bg: #F4F6F8;
    --agill-text: #333333;
    /* --- Dimensões --- */
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 70px;
    --header-height: 70px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--agill-gray-bg);
    color: var(--agill-text);
    margin: 0;
    overflow-x: hidden; /* Evita rolagem horizontal */
}

/* =========================================
   1. ESTRUTURA DO LAYOUT (O que conserta o erro)
   ========================================= */

.layout-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar (Menu Lateral) */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed; /* Fixa na esquerda */
    top: 0;
    left: 0;
    background-color: white;
    border-right: 1px solid #E0E0E0;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); /* Animação suave */
    display: flex;
    flex-direction: column;
}

    /* Sidebar: Estado Retraído (Desktop) */
    .sidebar.collapsed {
        width: var(--sidebar-width-collapsed);
    }

/* Sidebar: Mobile (Começa escondido) */
@media (max-width: 768px) {
    .sidebar {
        left: -100%; /* Fora da tela */
        width: 80%; /* Ocupa 80% quando abre no celular */
    }

        .sidebar.mobile-open {
            left: 0; /* Desliza para dentro */
            box-shadow: 10px 0 30px rgba(0,0,0,0.1);
        }
}

/* Conteúdo Principal */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    background-color: var(--agill-gray-bg);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
}

    /* Conteúdo: Ajuste quando menu retrai */
    .main-content.collapsed {
        margin-left: var(--sidebar-width-collapsed);
        width: calc(100% - var(--sidebar-width-collapsed));
    }

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        width: 100%;
    }
}

/* Overlay Escuro (Só Mobile) */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

    .mobile-overlay.show {
        display: block;
        opacity: 1;
    }

/* =========================================
   2. ESTILO DO MENU (O visual bonito)
   ========================================= */

/* Cabeçalho do Logo */
.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

/* Scroll na área de links se a tela for pequena */
.nav-scrollable {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Links */
.nav-link {
    color: #555;
    border-radius: 8px;
    padding: 10px 14px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap; /* Impede que texto quebre linha */
    display: flex;
    align-items: center;
}

    .nav-link:hover {
        background-color: #f8f9fa;
        color: var(--agill-blue);
    }

    .nav-link.active {
        background-color: var(--agill-blue-light);
        color: var(--agill-blue);
        font-weight: 600;
    }

    /* Ícones */
    .nav-link i {
        font-size: 1.15rem;
        min-width: 24px;
        display: inline-flex;
        justify-content: center;
    }

/* Texto do Link */
.nav-link-text {
    margin-left: 12px;
    opacity: 1;
    transition: opacity 0.2s;
}

/* Categorias */
.nav-category {
    font-size: 0.7rem;
    font-weight: 700;
    color: #aaa;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-top: 1rem;
    white-space: nowrap;
}

/* Sub-links (Dropdown) */
.sub-link {
    font-size: 0.9rem;
    padding: 8px 10px 8px 46px; /* Recuo maior para alinhar */
    color: #666;
}

    .sub-link:hover {
        transform: translateX(4px);
        background: transparent;
    }

/* Comportamento quando Retraído (Collapsed) */
.sidebar.collapsed .nav-link-text,
.sidebar.collapsed .nav-category,
.sidebar.collapsed .bi-chevron-down {
    display: none !important;
    opacity: 0;
}

.sidebar.collapsed .nav-link {
    justify-content: center; /* Centraliza ícone */
    padding: 12px 0;
    margin: 4px 10px; /* Margem lateral menor */
}

    .sidebar.collapsed .nav-link i {
        font-size: 1.3rem;
    }

/* Esconder submenus se retraído para não bugar */
.sidebar.collapsed .nav-subgroup {
    display: none;
}

/* =========================================
   3. COMPONENTES GERAIS (Topo, Botões)
   ========================================= */

.topbar {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid #E0E0E0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.btn-agill-primary {
    background-color: var(--agill-blue);
    color: white;
    border: none;
}

    .btn-agill-primary:hover {
        background-color: #003580;
        color: white;
    }

.credits-widget {
    background: #F0FDF4;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #DCFCE7;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.avatar-circle {
    width: 38px;
    height: 38px;
    background-color: var(--agill-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}
