/* ARQUIVO: public/css/style.css */
/* VERSÃO: 16.0 (BASE 15.0 INTEGRAL + ADIÇÃO MOBILE) */

/* RESET BÁSICO */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

body.bg-login {
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* CARTÃO DE LOGIN */
.login-container {
    background-color: #fff;
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    text-align: center;
    border-top: 5px solid #d32f2f; /* Vermelho Centerhum */
}

/* LOGO E CABEÇALHO */
.logo {
    max-width: 275px;
    margin-bottom: 20px;
}

.login-header h2 {
    color: #333;
    font-size: 24px;
    margin-bottom: 5px;
}

.login-header p {
    color: #666;
    font-size: 14px;
    margin-bottom: 30px;
}

/* FORMULÁRIO */
.input-group {
    text-align: left;
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 5px;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: 0.3s;
}

.input-group input:focus {
    border-color: #d32f2f; /* Foco Vermelho */
    outline: none;
}

/* BOTÕES */
.btn-primary {
    width: 100%;
    padding: 14px;
    background-color: #d32f2f; /* Vermelho */
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.btn-primary:hover {
    background-color: #b71c1c; /* Vermelho mais escuro */
}

.btn-link {
    background: none;
    border: none;
    color: #666;
    margin-top: 15px;
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
}

.btn-link:hover {
    color: #d32f2f;
}

/* MENSAGENS DE ERRO/SUCESSO */
.msg-box {
    margin-top: 20px;
    padding: 10px;
    border-radius: 6px;
    font-size: 14px;
}

.hidden {
    display: none;
}

.msg-error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.msg-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

/* --- ESTILOS DO PAINEL --- */

/* Layout Principal */
.dashboard-body {
    display: flex;
    background-color: #f4f4f4;
    height: 100vh;
    overflow: hidden;
}

/* Menu Lateral (Sidebar) */
.sidebar {
    width: 260px;
    background-color: #1a1a1a; /* Preto Centerhum */
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #333;
}

.sidebar-logo {
    max-width: 180px; /* Logo ajustada */
}

.sidebar-nav {
    padding: 20px 0;
    flex: 1;
}

.nav-btn {
    width: 100%;
    padding: 15px 25px;
    background: none;
    border: none;
    color: #ccc;
    text-align: left;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: 0.3s;
}

.nav-btn:hover, .nav-btn.active {
    background-color: #d32f2f; /* Vermelho Centerhum */
    color: white;
}

.nav-btn.logout {
    margin-top: auto;
    border-top: 1px solid #333;
    color: #ff5252;
}

/* Área de Conteúdo */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    background-color: #d32f2f;
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

/* Cards de Resumo */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-left: 5px solid #d32f2f;
}

.card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.card .valor {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.card .valor.verde { color: #2e7d32; }
.card .valor.azul { color: #1565c0; }

/* ESTILO DO NOVO CARD DE GASOLINA */
.card-gasolina {
    border-left: 5px solid #ff9800; /* Laranja para diferenciar */
}

/* --- GRID DE FROTA (ESTILO NOVO) --- */
.grid-frota {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.card-veiculo {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.card-veiculo img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.card-veiculo-info {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.card-veiculo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.placa-badge {
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-family: monospace;
    letter-spacing: 1px;
}

.regiao-text {
    color: #666;
    font-size: 13px;
    font-weight: 500;
}

.divida-box {
    background: #ffebee;
    color: #c62828;
    padding: 8px;
    border-radius: 6px;
    text-align: center;
    margin-top: 5px;
}

.divida-valor {
    font-weight: bold;
    font-size: 16px;
}

.divida-label {
    font-size: 11px;
    text-transform: uppercase;
}

.multas-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #555;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #eee;
}

.status-licenciamento {
    text-align: center;
    padding: 8px;
    margin-top: auto;
    font-weight: bold;
    font-size: 13px;
    color: white;
}

.status-ok { background-color: #4caf50; }
.status-avencer { background-color: #ff9800; }
.status-vencido { background-color: #d32f2f; }

.btn-consultar {
    width: 100%;
    background: #2196f3;
    color: white;
    border: none;
    padding: 8px;
    margin-top: 10px;
    cursor: pointer;
    border-radius: 4px;
    font-weight: 500;
    transition: 0.2s;
}

.btn-consultar:hover { background: #1976d2; }

/* ------------------------------------- */

.item-regiao {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.item-regiao:last-child {
    border-bottom: none;
}

.item-regiao.total {
    margin-top: 10px;
    font-weight: bold;
    color: #d32f2f;
    border-top: 1px solid #ddd;
    padding-top: 10px;
}

.nome-regiao {
    color: #555;
    font-weight: 500;
}

.valor-regiao {
    color: #333;
    font-weight: bold;
}

/* Tabelas e Botões */
.tabela-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow-x: auto; /* Permite rolagem lateral em tabelas grandes */
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

/* Etiquetas de Relatório */
.tag-obra {
    background-color: #fff3e0;
    color: #e65100;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
}

.tag-geral {
    background-color: #f5f5f5;
    color: #616161;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.btn-action {
    background-color: #d32f2f;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

.btn-secondary {
    background-color: #333;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-left: 10px;
}

.btn-icon {
    background:none;
    border:none;
    cursor:pointer;
    font-size:18px;
    padding: 2px 5px;
}

/* Modal FIX - CORREÇÃO DE ROLAGEM */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden { display: none; }

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 10px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh; /* Altura máxima da tela */
    overflow-y: auto; /* Ativa a rolagem vertical */
    position: relative;
    text-align: left;
}

.modal-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 5px;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
    color: #d32f2f;
}

/* Alternância de Telas */
.tela { display: none; }
.tela.ativa { display: block; animation: fadeIn 0.3s; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* GRÁFICOS */
.graficos-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 40px;
}

.card-grafico {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    height: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-grafico h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
    font-weight: 500;
    align-self: flex-start;
}

.card-grafico canvas {
    max-height: 250px !important;
    max-width: 100% !important;
}

@media (max-width: 768px) {
    .graficos-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
    .card-grafico {
        height: auto;
        min-height: 300px;
    }
}

/* FORMULÁRIOS E FILTROS */
.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
    background: white;
}

.form-group input[type="file"] {
    border: none;
    padding: 0;
}

.btn-submit {
    background-color: #2e7d32;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
}

.btn-submit:hover { background-color: #1b5e20; }

.thumb-foto {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ddd;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.input-date, .input-select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    min-width: 150px;
}

.report-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #333;
}

.report-summary strong {
    color: #d32f2f;
    font-size: 16px;
}

/* === IMPRESSÃO DE HOLERITES (CORREÇÃO DE PÁGINA EM BRANCO) === */
@media print {
    body * {
        visibility: hidden;
    }
    #area-impressao, #area-impressao * {
        visibility: visible;
    }
    #area-impressao {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        display: block !important; /* FORÇA EXIBIÇÃO */
    }
    .holerite-container {
        page-break-inside: avoid; /* Não corta holerite no meio */
    }
    /* Esconde elementos do painel */
    .sidebar, .top-bar, .modal, .toolbar, .filter-bar {
        display: none !important;
    }
}

/* Layout do Holerite na Tela e Impressão */
.holerite-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 20px auto;
    border: 1px solid #000;
    padding: 20px;
    background: white;
    font-family: 'Courier New', Courier, monospace; /* Fonte tipo máquina */
    color: #000;
}

.holerite-header {
    text-align: center;
    border-bottom: 2px solid #000;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.holerite-dados {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
}

.holerite-tabela {
    width: 100%;
    margin-bottom: 20px;
    border-collapse: collapse;
}

.holerite-tabela th {
    border-bottom: 1px solid #000;
    text-align: left;
    font-size: 12px;
}

.holerite-tabela td {
    padding: 5px 0;
    font-size: 12px;
}

.holerite-footer {
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.assinatura-linha {
    border-top: 1px solid #000;
    width: 40%;
    text-align: center;
    padding-top: 5px;
    font-size: 11px;
}

/* ========================================================== */
/* === NOVAS REGRAS PARA CELULAR (SEM ALTERAR AS ACIMA) === */
/* ========================================================== */

/* Overlay do Menu Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

/* Botão Hambúrguer */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: #333;
    padding: 10px;
}

/* Estilos para a Busca Expansiva (conforme pedido) */
.busca-result { 
    margin-top: 10px; 
    background: white; 
    border: 1px solid #eee; 
    border-radius: 4px;
    max-height: 250px; 
    overflow-y: auto; 
    display: none; 
}
.busca-result.ativo { display: block; }
.busca-item { padding: 12px; border-bottom: 1px solid #eee; cursor: pointer; color: #0277bd; font-size: 14px; }
.busca-detalhe { background: #f9f9f9; padding: 15px; border-radius: 5px; }

/* Transição suave para a sidebar */
.sidebar {
    transition: left 0.3s ease;
}

@media (max-width: 900px) {
    .menu-toggle { 
        display: block; 
    }

    .sidebar {
        position: fixed;
        left: -260px; /* Escondido fora da tela */
        top: 0;
        height: 100%;
        z-index: 1001;
    }

    .sidebar.open {
        left: 0; /* Aparece ao clicar */
    }

    .sidebar-overlay.active {
        display: block;
    }

    .top-bar {
        padding: 15px 10px;
        justify-content: space-between;
        gap: 10px;
    }

    .main-content {
        padding: 15px;
    }

    .cards-container {
        grid-template-columns: 1fr !important; /* Força 1 coluna */
    }

    .user-info span#nome-usuario {
        display: none; /* Esconde nome longo para sobrar espaço */
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch !important;
    }

    .filter-group, .input-date, .input-select {
        width: 100% !important;
        margin-bottom: 5px;
    }

    .btn-secondary {
        margin-left: 0 !important;
        margin-top: 10px;
    }

    .toolbar {
        flex-wrap: wrap;
        gap: 10px;
    }

    .toolbar button {
        width: 100%;
        margin-left: 0 !important;
    }
}