/* --- Reset e Variáveis (Estilo Vestro) --- */
:root {
    --bg-body: #f3f4f6;       /* Fundo cinza claro */
    --bg-white: #ffffff;
    --text-primary: #333333;
    --text-secondary: #8898aa; /* Cinza levemente azulado */
    --vestro-blue: #005c81;   /* Azul Petróleo Oficial */
    --vestro-blue-dark: #004a66;
    --alert-bg: #ffecec;      /* Fundo rosa do alerta */
    --alert-text: #d32f2f;    /* Texto vermelho do alerta */
    --border-color: #e5e7eb;
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Roboto', Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-body);
    height: 100vh;
    overflow: hidden;
}

.layout-wrapper {
    display: flex;
    height: 100%;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 240px;
    background-color: var(--bg-white);
    border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column;
}

.logo-area {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
    text-align: center;
}
.logo { max-width: 120px; }

.menu { display: flex; flex-direction: column; }

.menu-item {
    padding: 12px 20px;
    text-decoration: none;
    color: var(--text-secondary);
    display: flex; align-items: center; gap: 15px;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 4px solid transparent;
    cursor: pointer;
}

.menu-item i { font-size: 1.2rem; }

.menu-item:hover { background-color: #f9fafb; color: var(--vestro-blue); }

/* Item Ativo */
.menu-item.active {
    color: var(--vestro-blue);
    background-color: #f0f9ff;
    border-left-color: var(--vestro-blue);
    font-weight: 500;
}

/* --- CONTEÚDO PRINCIPAL (Main Area) --- */
.content-area {
    flex: 1;
    display: flex; flex-direction: column;
    background-color: var(--bg-body);
    overflow: hidden; /* O scroll fica dentro do main-content agora */
}

/* Top Bar */
.top-bar {
    background-color: var(--bg-white);
    padding: 15px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0; /* Impede que a topbar encolha */
}

.user-welcome { font-size: 1.1rem; color: var(--text-primary); }
.user-name { font-weight: 700; color: var(--vestro-blue); }

.top-actions { 
    display: flex; 
    gap: 15px; 
    align-items: center; 
    color: var(--text-secondary);
    flex-shrink: 0;
}
.logout-icon { font-size: 1.4rem; cursor: pointer; transition: 0.2s; }
.logout-icon:hover { color: #ef4444; }

.btn-refresh {
    background: #fff; border: 1px solid var(--border-color);
    padding: 8px 15px; border-radius: 6px; cursor: pointer; color: var(--vestro-blue);
    transition: 0.3s; display: flex; align-items: center; justify-content: center;
    font-weight: 500;
}
.btn-refresh:hover { background-color: #e0f2fe; }

/* --- ÁREA DE CONTEÚDO DINÂMICO --- */
.main-content {
    width: 100%;
    height: 100%;
    overflow-y: auto; /* Scroll vertical aqui */
    position: relative;
}

/* 1. ESTILO GRID (Para os Tanques) */
.main-content.cards-container {
    padding: 25px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    gap: 20px;
    align-content: start;
}

/* 2. ESTILO TABELA (Para Abastecimentos) */
.table-container {
    background-color: var(--bg-white);
    margin: 30px;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #eef0f2;
    overflow-x: auto;
}

.page-title {
    color: var(--vestro-blue);
    font-size: 1.25rem;
    margin-bottom: 20px;
    font-weight: 700;
    border-left: 5px solid var(--vestro-blue);
    padding-left: 15px;
}

/* Tabela Vestro */
.vestro-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    color: #444;
}

.vestro-table thead tr {
    background-color: #f8f9fa;
    border-bottom: 2px solid #eef0f2;
}

.vestro-table th {
    padding: 15px;
    text-align: left;
    color: #8898aa;
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.vestro-table td {
    padding: 15px;
    border-bottom: 1px solid #eef0f2;
    vertical-align: middle;
    white-space: nowrap;
}

.vestro-table tbody tr:hover {
    background-color: #f0f9ff; /* Azul bem clarinho no hover */
}

.vestro-table tbody tr:last-child td {
    border-bottom: none;
}

/* Mensagens de Carregamento/Erro */
.loading-msg, .error-msg {
    padding: 50px;
    text-align: center;
    width: 100%;
    font-size: 1.1rem;
    color: #666;
}
.error-msg { color: #e53e3e; }


/* --- CARD DESIGN (Mantido igual) --- */
.vestro-card {
    background-color: var(--bg-white);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    position: relative;
    border: 1px solid rgba(238, 240, 242, 0.8);
    height: 240px; 
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.vestro-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 6px; height: 100%;
    background: var(--vestro-blue);
    opacity: 0.8;
}

.vestro-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.1);
}

.card-options {
    position: absolute; top: 15px; right: 15px;
    color: #cbd5e0; cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s;
}
.card-options:hover { color: var(--vestro-blue); }

/* Lado Esquerdo: Informações */
.card-info {
    display: flex; flex-direction: column;
    justify-content: space-between;
    width: 58%;
    z-index: 2;
}

.tank-header { margin-bottom: 5px; }

.tank-id-title {
    color: var(--text-primary);
    font-size: 1.15rem; 
    margin-bottom: 2px;
    line-height: 1.2;
    font-weight: 800;
}

.tank-base {
    color: var(--text-secondary);
    font-weight: 500; 
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.product-name {
    color: var(--vestro-blue);
    font-weight: 700; 
    font-size: 1rem;
    margin-bottom: 6px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
}

.capacity-info {
    font-size: 0.8rem; 
    color: #718096;
    line-height: 1.6;
}

/* Seção de Status e Porcentagem */
.status-section { margin-top: auto; }

.status-label {
    color: #a0aec0;
    font-weight: 600; font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.percentage-text {
    font-size: 2.2rem; font-weight: 900;
    margin: 2px 0 8px 0;
    line-height: 1;
    letter-spacing: -1px;
}

.alert-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex; align-items: center; gap: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Lado Direito: Visual SVG */
.card-visual {
    width: 38%;
    display: flex; align-items: flex-end; justify-content: center;
    position: relative;
}

.tank-svg-container {
    width: 100%;
    height: auto;
    max-height: 180px;
    filter: drop-shadow(0px 8px 15px rgba(0,0,0,0.1));
}
/* --- SUBMENU E RELATÓRIOS --- */

/* Submenu */
.submenu .menu-item { 
    padding: 10px 20px 10px 45px; /* Indentação maior */
    font-size: 0.9rem;
    background-color: #f8f9fa;
    border-left: 3px solid #e5e7eb;
}

.submenu .menu-item:hover { 
    border-left-color: var(--vestro-blue); 
    background: #f1f5f9; 
}

/* Grupo de Menu (Pai) */
.menu-group {
    display: flex;
    flex-direction: column;
}

/* --- LAYOUT DO RELATÓRIO PERIÓDICO --- */
.report-header {
    background: #fff;
    padding: 15px 25px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* Grid Principal (2 colunas: Gráficos | Tabela) */
.report-grid {
    display: grid;
    grid-template-columns: 2fr 1fr; /* Esquerda ocupa o dobro da direita */
    gap: 20px;
    min-height: calc(100vh - 160px); 
    height: auto;
}

/* Coluna da Esquerda (Gráficos) */
.charts-section {
    display: flex; 
    flex-direction: column; 
    gap: 20px;
    height: 100%;
}

.chart-card {
    background: #fff; 
    padding: 15px; 
    border-radius: 8px;
    border: 1px solid #eef0f2; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    flex: 1; /* Divide altura igualmente (50% cada gráfico) */
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Coluna da Direita (Tabela) */
.table-section {
    background: #fff; 
    border-radius: 8px;
    border: 1px solid #eef0f2; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex; 
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Responsividade para telas menores */
@media (max-width: 1100px) {
    .report-grid { 
        grid-template-columns: 1fr; /* Vira uma coluna só */
        height: auto; 
        overflow-y: visible;
    }
    
    .charts-section {
        height: 600px; /* Altura fixa para os gráficos em mobile */
    }
    
    .table-section {
        height: 400px; /* Altura fixa para tabela em mobile */
    }
}

/* --- ESTILOS DO DASHBOARD (RESUMO DIÁRIO) --- */

.dash-grid-top {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
    min-height: 300px;
}

.dash-grid-bottom {
    display: grid;
    grid-template-columns: 4fr 6fr; 
    gap: 20px;
    min-height: 350px;
}

/* Nota: Na sua imagem a tabela parece maior, então inverti para 
   grid-template-columns: 1fr 2fr; se quiser gráfico maior use 2fr 1fr 
*/
/* Ajuste conforme sua preferência visual da imagem, parece meio a meio ou 40/60 */
.dash-grid-bottom {
    grid-template-columns: 4fr 6fr; 
}


.dash-card {
    background: #fff;
    border-radius: 4px; /* Vestro usa bordas menos arredondadas na img */
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 15px;
    display: flex;
    flex-direction: column;
    border-top: 3px solid transparent; /* Preparo para detalhe colorido se quiser */
}

.dash-title {
    color: #005c81;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 15px;
}

.chart-box {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 0; /* Importante para o chart.js não estourar o flex */
}

/* Botão de Exportar Widget */
.btn-export {
    background: #f8f9fa;
    border: 1px solid #eef0f2;
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.btn-export:hover {
    background: var(--vestro-blue);
    color: white;
    border-color: var(--vestro-blue);
}

.btn-export.pdf:hover {
    background: #e11d48; /* Tom de vermelho PDF */
    border-color: #e11d48;
}

.btn-export.csv:hover {
    background: #059669; /* Tom de verde Excel/CSV */
    border-color: #059669;
}

/* Responsivo */
@media (max-width: 1100px) {
    .dash-grid-top { grid-template-columns: 1fr; height: auto; }
    .dash-grid-bottom { grid-template-columns: 1fr; height: auto; }
    .dash-card { height: 300px; margin-bottom: 20px; }
}
/* --- ADIÇÕES: MENU RETRÁTIL E FILTROS --- */

/* 1. Transição Suave na Sidebar */
.sidebar {
    transition: width 0.3s ease;
    position: relative; /* Para posicionar o botão da seta */
}

/* 2. Botão de Recolher (Seta) */
.sidebar-toggle {
    position: absolute;
    right: -12px; /* Fica bem na linha da borda */
    top: 30px;
    background: var(--vestro-blue);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid #fff;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.sidebar-toggle:hover {
    background-color: var(--vestro-blue-dark);
}

/* 3. Estado Recolhido (.collapsed) */
.sidebar.collapsed {
    width: 80px; /* Largura reduzida */
}

/* Esconde textos e setas quando recolhido */
.sidebar.collapsed .link-text,
.sidebar.collapsed .arrow-icon,
.sidebar.collapsed .user-welcome {
    display: none;
    opacity: 0;
}

/* Ajusta a Logo quando recolhido */
.sidebar.collapsed .logo {
    max-width: 40px; /* Logo fica pequena */
    margin-left: 5px;
}

.sidebar.collapsed .logo-area {
    padding: 20px 10px;
}

/* Centraliza os ícones do menu */
.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 15px;
}

.sidebar.collapsed .menu-item i {
    font-size: 1.6rem; /* Ícones um pouco maiores */
    margin: 0;
}

/* Gira a setinha quando recolhido */
.sidebar.collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

/* Se o menu estiver fechado, não mostramos submenu aberto */
.sidebar.collapsed .submenu {
    display: none !important;
}

/* 4. Estilos dos Novos Filtros (Selects) */
.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.filter-select:hover {
    border-color: var(--vestro-blue);
    background-color: #fcfcfc;
}

.filter-select:focus {
    border-color: var(--vestro-blue);
    box-shadow: 0 0 0 2px rgba(0, 92, 129, 0.1);
}

/* Adicione no final do style.css */
.mobile-nav-toggle {
    display: none;
}