/* ================================================================
   dashboard_pesquisa.css — Estilos do dashboard de pesquisa
   ================================================================ */

/* ===== AÇÕES DO TOPO ===== */
.dashboard-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.btn-action {
    background: var(--primary-blue, #023882);
    color: #fff;
    border: 2px solid transparent;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all .25s ease;
    min-height: 44px;
    font-family: inherit;
    font-size: .95rem;
}

.btn-action:hover {
    background: #1a5bb8;
    transform: translateY(-2px);
}

.btn-action-primary {
    background: #b02a37;
}
.btn-action-primary:hover {
    background: #dc3545;
}

.btn-action:focus-visible {
    outline: 3px solid #F2B84E;
    outline-offset: 2px;
}

.btn-action:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

/* ===== CAPA DO PDF ===== */
.report-cover {
    background: linear-gradient(135deg, #023882 0%, #1a5bb8 100%);
    color: #fff;
    padding: 60px 40px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 32px;
}

.report-cover .report-logo {
    height: 80px;
    margin: 0 auto 20px;
    filter: brightness(0) invert(1);
}

.report-cover h1 {
    font-size: 2rem;
    margin-bottom: 12px;
    color: #fff;
}

.report-cover h2 {
    font-size: 1.1rem;
    font-weight: 400;
    opacity: .95;
    margin-bottom: 32px;
    color: #fff;
}

.report-cover .report-date {
    font-size: 1rem;
    margin-bottom: 6px;
    opacity: .9;
}

.report-cover .report-author {
    font-size: .9rem;
    opacity: .8;
    font-style: italic;
}

/* ===== SEÇÕES ===== */
.report-section {
    background: #fff;
    padding: 28px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 2px 10px rgba(2, 56, 130, .08);
    border: 1px solid #cfd8e3;
}

.report-section-title {
    color: #023882;
    font-size: 1.3rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-section-desc {
    color: #4a5a70;
    margin-bottom: 20px;
}

/* ===== CARDS DE TOTAIS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.stat-card-dashboard {
    background: #f8fafe;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #cfd8e3;
    transition: all .25s ease;
}

.stat-card-dashboard:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(2, 56, 130, .12);
}

.stat-card-dashboard i {
    font-size: 1.6rem;
    color: #023882;
    margin-bottom: 8px;
    display: block;
}

.stat-card-alert i { color: #b02a37; }

.stat-card-dashboard .stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: #023882;
    line-height: 1.1;
}

.stat-card-alert .stat-number { color: #b02a37; }

.stat-card-dashboard .stat-label {
    font-size: .85rem;
    color: #4a5a70;
    margin-top: 6px;
}

/* ===== GRÁFICOS ===== */
.chart-card {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #e6eef9;
}

.chart-card h3 {
    color: #023882;
    font-size: 1.05rem;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 320px;
}

/* ===== TABELA ===== */
.table-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px;
    background: #f8fafe;
    border-radius: 8px;
}

.table-controls label {
    font-weight: 600;
    font-size: .9rem;
    color: #2d3d55;
}

.table-controls select {
    padding: 8px 12px;
    border: 2px solid #cfd8e3;
    border-radius: 6px;
    font-size: .95rem;
    font-family: inherit;
    background: #fff;
    min-height: 40px;
}

.table-controls select:focus {
    border-color: #023882;
    outline: none;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #cfd8e3;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: .9rem;
}

.data-table th {
    background: #e9ecef;
    color: #14212f;
    font-weight: 700;
    padding: 12px 14px;
    text-align: left;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .3px;
    border-bottom: 2px solid #cfd8e3;
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #e6eef9;
}

.data-table tr:hover td {
    background: #f8fafe;
}

.data-table .status {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 700;
    color: #fff;
    display: inline-block;
}

.status-aberto { background: #dc3545; }
.status-em_andamento { background: #ffc107; color: #14212f; }

.table-count {
    margin-top: 10px;
    font-size: .85rem;
    color: #4a5a70;
    text-align: right;
}

/* ===== ALERTAS ===== */
.alert {
    padding: 14px 20px;
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 12px;
}

.alert-success {
    background: #d1e7dd;
    color: #0a3622;
    border: 2px solid #1e7e34;
}

.alert-error {
    background: #f8d7da;
    color: #58151c;
    border: 2px solid #b02a37;
}

/* ===== RESPONSIVO ===== */
@media (max-width: 768px) {
    .dashboard-actions {
        flex-direction: column;
    }
    .btn-action {
        width: 100%;
        justify-content: center;
    }
    .report-cover {
        padding: 32px 20px;
    }
    .report-cover h1 { font-size: 1.4rem; }
    .report-cover h2 { font-size: .95rem; }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ================================================================
   IMPRESSÃO OTIMIZADA — Layout compacto (2 folhas)
   Sustentabilidade: reduzir consumo de papel
   ================================================================ */
@media print {

    /* ===== RESET GERAL ===== */
    *,
    *::before,
    *::after {
        background: transparent !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    html, body {
        background: #fff !important;
        font-size: 9.5pt !important;
        line-height: 1.3 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* ===== MARGENS DA PÁGINA ===== */
    @page {
        size: A4 portrait;
        margin: 0.8cm;
    }

    /* ===== ESCONDE ELEMENTOS ===== */
    .header,
    header,
    nav,
    .dashboard-actions,
    .table-controls,
    .footer,
    footer,
    .logout-btn,
    .btn-action,
    button,
    .skip-link,
    .no-print {
        display: none !important;
    }

    /* ===== COMPACTA CONTAINER ===== */
    .container,
    .dashboard-container {
        padding: 0 !important;
        max-width: 100% !important;
    }

    /* ===== CAPA COMPACTA ===== */
    .report-cover,
    #reportCover {
        padding: 12px !important;
        margin-bottom: 8px !important;
        page-break-after: avoid !important;
        background: #023882 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .report-cover h1,
    #reportCover h1 {
        font-size: 16pt !important;
        margin: 0 0 6px 0 !important;
    }

    .report-cover p,
    #reportCover p {
        font-size: 9pt !important;
        margin: 2px 0 !important;
    }

    /* ===== SEÇÕES ===== */
    .report-section {
        box-shadow: none !important;
        border: 1px solid #999 !important;
        page-break-inside: avoid !important;
        margin: 6px 0 !important;
        padding: 8px !important;
        background: #fff !important;
    }

    .report-section h2 {
        font-size: 11pt !important;
        margin: 0 0 6px 0 !important;
        page-break-after: avoid !important;
        color: #023882 !important;
    }

    .report-section h3 {
        font-size: 10pt !important;
        margin: 6px 0 4px 0 !important;
        page-break-after: avoid !important;
    }

    /* ===== CARDS DE ESTATÍSTICAS EM LINHA ===== */
    .stats,
    .stats-grid,
    .hero-stats {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
        page-break-inside: avoid !important;
        margin: 6px 0 !important;
    }

    .stat-card,
    .hero-stat {
        flex: 1 1 20% !important;
        padding: 6px !important;
        border: 1px solid #ccc !important;
        background: #f9f9f9 !important;
        text-align: center !important;
    }

    .stat-number,
    .hero-stat-number {
        font-size: 13pt !important;
        font-weight: 700 !important;
        color: #023882 !important;
    }

    .stat-label,
    .hero-stat-label {
        font-size: 7.5pt !important;
        color: #555 !important;
    }

    /* ===== GRÁFICOS COMPACTOS ===== */
    .chart-canvas-wrapper,
    .chart-box,
    .chart-container {
        height: 180px !important;
        max-height: 180px !important;
        padding: 2px !important;
        margin: 4px 0 !important;
        page-break-inside: avoid !important;
    }

    .chart-canvas-wrapper canvas,
    .chart-box canvas {
        max-height: 170px !important;
    }

    /* ===== TABELA COMPACTA ===== */
    table,
    .data-table {
        width: 100% !important;
        font-size: 7.5pt !important;
        border-collapse: collapse !important;
        page-break-inside: auto !important;
        margin: 4px 0 !important;
    }

    table thead {
        display: table-header-group !important;
    }

    table tr {
        page-break-inside: avoid !important;
    }

    th, td {
        padding: 2px 4px !important;
        border: 1px solid #999 !important;
        line-height: 1.15 !important;
        word-break: break-word !important;
    }

    th {
        background: #023882 !important;
        color: #fff !important;
        font-size: 7pt !important;
        font-weight: 700 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* ===== RODAPÉ SUSTENTÁVEL ===== */
    body::after {
        content: "🌱 Relatório gerado pelo sistema Rede Limpa — impresso em frente e verso para reduzir o impacto ambiental.";
        display: block !important;
        text-align: center !important;
        font-size: 7pt !important;
        color: #666 !important;
        margin-top: 10px !important;
        padding-top: 4px !important;
        border-top: 1px solid #ccc !important;
    }
}
/* ================================================================
   MELHORIA: legibilidade da tabela no PDF
   ================================================================ */
@media print {
    table.data-table,
    table {
        font-size: 6.5pt !important;
        border-collapse: collapse !important;
    }

    table th,
    table td {
        padding: 2px 3px !important;
        border: 0.5px solid #ccc !important;
        line-height: 1.2 !important;
    }

    table th {
        background: #023882 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        font-size: 6pt !important;
    }

    table tr:nth-child(even) td {
        background: #f8f9fa !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}
