﻿/* ==========================================================================
   Variáveis e Reset
   ========================================================================== */
   :root {
    /* Cores Premium */
    --primary-color: #003366; /* Azul Marinho Governamental (Padrão) */
    --secondary-color: #f4f6f8; /* Fundo Cinza Claro (Padrão) */
    --bg-color: #f4f6f8; 
    --text-main: #333333; 
    --text-muted: #666666; 
    
    /* Cores de Status das Obras */
    --status-planejamento: #3b82f6; /* Azul */
    --status-andamento: #eab308; /* Amarelo */
    --status-concluida: #22c55e; /* Verde */
    --status-paralisada: #ef4444; /* Vermelho */

    /* Estrutura */
    --border-radius: 8px;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --glass-bg: rgba(255, 255, 255, 0.85);
    
    /* Fontes - Escala (Acessibilidade) */
    --base-font-size: 16px;
}

body.high-contrast {
    --primary-color: #ffff00;
    --secondary-color: #ffffff;
    --bg-color: #000000;
    --text-main: #ffffff;
    --text-muted: #cccccc;
    --glass-bg: #111111;
    --box-shadow: 0 0 0 2px #ffff00;
    
    /* Cores de Status no Alto Contraste */
    --status-planejamento: #00ffff;
    --status-andamento: #ffff00;
    --status-concluida: #00ff00;
    --status-paralisada: #ff0000;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    font-size: var(--base-font-size);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s, font-size 0.3s;
}

/* ==========================================================================
   Barra de Acessibilidade
   ========================================================================== */
.accessibility-bar {
    background-color: #000000;
    color: #ffffff;
    padding: 8px 0;
    font-size: 0.9em;
}

body.high-contrast .accessibility-bar {
    background-color: #000000;
    border-bottom: 2px solid #ffff00;
}

.container-acc {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.acc-shortcuts a {
    color: #ffffff;
    text-decoration: none;
    margin-right: 15px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.acc-shortcuts a:hover, .acc-shortcuts a:focus {
    opacity: 1;
    text-decoration: underline;
}

.acc-tools button {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: #ffffff;
    padding: 4px 10px;
    margin-left: 5px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.acc-tools button:hover, .acc-tools button:focus {
    background: rgba(255,255,255,0.2);
    outline: 2px solid #ffffff;
}

body.high-contrast .acc-tools button {
    border-color: #ffff00;
    color: #ffff00;
}

body.high-contrast .acc-tools button:hover {
    background: #ffff00;
    color: #000000;
}

/* ==========================================================================
   Cabeçalho Principal (Ajustado ao Padrão)
   ========================================================================== */
.main-header {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 0; /* O padding será no container */
    position: sticky;
    top: 0;
    z-index: 1000;
}

body.high-contrast .main-header {
    background-color: #000000;
    border-bottom: 2px solid #ffff00;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.logo-placeholder {
    width: 80px;
    height: 80px;
    background-color: white; /* Fundo branco para a logo caso seja SVG/PNG escuro */
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-titles h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.header-titles h2 {
    font-size: 1.1rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
}

body.high-contrast .header-titles h1, 
body.high-contrast .header-titles h2 {
    color: #ffff00;
}

/* ==========================================================================
   Conteúdo Principal e Filtros
   ========================================================================== */
.main-content {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.filters-section {
    background: var(--glass-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.filters-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary-color);
}

.filter-group input, 
.filter-group select {
    padding: 10px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: #ffffff;
    color: var(--text-main);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.filter-group input:focus, 
.filter-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

body.high-contrast .filter-group input, 
body.high-contrast .filter-group select {
    background: #000;
    color: #ff0;
    border: 1px solid #ff0;
}

body.high-contrast .filter-group label {
    color: #ff0;
}

/* ==========================================================================
   Mapa
   ========================================================================== */
.map-section {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    background: #ffffff;
    height: 500px;
}

#map {
    height: 100%;
    width: 100%;
    z-index: 1;
}

.map-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(5px);
    padding: 10px 15px;
    border-radius: 8px;
    z-index: 400; /* Acima do Leaflet (z-index 400 geralmente) */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 500;
}

.marker-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
    border: 1px solid rgba(0,0,0,0.1);
}

body.high-contrast .map-legend {
    background: #000;
    border: 1px solid #ff0;
}

/* ==========================================================================
   Tabela (DataTables Customization)
   ========================================================================== */
.table-section {
    background: white; /* Alterado do glass-bg para sólido */
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.table-container {
    width: 100%;
    overflow-x: auto; /* Evita que a tabela extrapole a section no mobile */
    -webkit-overflow-scrolling: touch;
}

table.dataTable {
    border-collapse: collapse !important;
    width: 100% !important;
}

table.dataTable thead th {
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 12px 15px;
    border-bottom: none;
}

body.high-contrast table.dataTable thead th {
    background-color: #000;
    color: #ff0;
    border: 1px solid #ff0;
}

table.dataTable tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

body.high-contrast table.dataTable tbody td {
    border-bottom: 1px solid #ff0;
    color: #fff;
    background: #111;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
}

.badge-emplanejamento { background-color: var(--status-planejamento); }
.badge-emandamento { background-color: var(--status-andamento); }
.badge-concluida { background-color: var(--status-concluida); }
.badge-paralisada { background-color: var(--status-paralisada); }

body.high-contrast .badge {
    color: #000;
}

.btn-action {
    background: #0066cc; /* Azul mais vivo para destaque */
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
    text-decoration: none;
}

.btn-action:hover {
    background: var(--primary-color);
}

body.high-contrast .btn-action {
    background: #ff0;
    color: #000;
}

/* ==========================================================================
   Modal
   ========================================================================== */
.modal {
    display: none; 
    position: fixed; 
    z-index: 2000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.6); 
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--bg-color);
    margin: 5% auto; 
    padding: 30px;
    border-radius: var(--border-radius);
    width: 80%;
    max-width: 800px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
}

body.high-contrast .modal-content {
    background-color: #000;
    border: 2px solid #ff0;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    color: var(--text-muted);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--text-main);
}

body.high-contrast .close-modal {
    color: #ff0;
}

/* Modal Info */
.obra-details h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

body.high-contrast .obra-details h2 {
    color: #ff0;
    border-color: #ff0;
}

.obra-photos {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    overflow-x: auto;
    padding-bottom: 10px;
}

.obra-photos img {
    width: 100%;
    border-radius: 8px;
    object-fit: cover;
    max-height: 200px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.obra-photos img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.obra-files {
    margin-top: 20px;
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.obra-files ul {
    list-style: none;
    margin-top: 10px;
}

.obra-files li {
    margin-bottom: 8px;
}

.obra-files a {
    color: var(--primary-color); /* Força a cor para evitar o branco no hover/base */
    text-decoration: none;
    font-weight: 500;
}

.obra-files a:hover {
    text-decoration: underline;
}

body.high-contrast .obra-files a {
    color: #ff0;
}

/* Responsividade Básica */
@media (max-width: 768px) {
    .header-container {
        padding: 1rem;
        gap: 1rem;
    }
    .logo-placeholder {
        width: 60px !important;
        height: 60px !important;
        margin-bottom: 0;
    }
    .header-titles h1 {
        font-size: 1.1rem;
    }
    .header-titles h2 {
        font-size: 0.9rem;
    }
    
    .map-section {
        height: 350px;
    }
    
    .table-section {
        padding: 10px; /* Reduz padding no mobile */
    }
}
/* Lightbox para amplia��o de fotos */
.lightbox-overlay { display: none; position: fixed; z-index: 9999; padding-top: 50px; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.9); }
.lightbox-img { margin: auto; display: block; max-width: 90%; max-height: 90%; border-radius: 8px; animation: zoomIn 0.3s ease; }
@keyframes zoomIn { from {transform:scale(0)} to {transform:scale(1)} }
.close-lightbox { position: absolute; top: 20px; right: 35px; color: #fff; font-size: 40px; font-weight: bold; cursor: pointer; transition: color 0.2s; }
.close-lightbox:hover { color: #cbd5e1; }


/* ==========================================================================
   Rodapé Institucional
   ========================================================================== */
.main-footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
    border-top: 4px solid var(--secondary-color);
}
.main-footer p {
    margin: 0;
    line-height: 1.5;
}

/* --- TIMELINE STYLES --- */
.timeline {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20px;
}
.timeline::after {
    content: '';
    position: absolute;
    width: 4px;
    background-color: var(--primary-color);
    top: 0;
    bottom: 0;
    left: 20px;
    margin-left: -2px;
}
.timeline-item {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 100%;
    margin-bottom: 20px;
    box-sizing: border-box;
}
.timeline-item::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    right: auto;
    background-color: white;
    border: 4px solid var(--primary-color);
    top: 15px;
    left: 10px;
    border-radius: 50%;
    z-index: 1;
}
.timeline-content {
    padding: 20px;
    background-color: #f8fafc;
    position: relative;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.timeline-date {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 0.95rem;
}
.timeline-thumb {
    width: 150px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ccc;
    flex-shrink: 0;
}
.timeline-body {
    flex: 1;
}
.timeline-body h4 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    color: var(--text-main);
}
.timeline-body p {
    margin: 0 0 10px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .timeline-content {
        flex-direction: column;
    }
    .timeline-thumb {
        width: 100%;
        height: 200px;
    }
}
