/* ==========================================
   DESIGN PERFEITO - VOUZELA OCORRÊNCIAS V4.0
   ========================================== */
body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #e9ecef;
    margin: 0;
    padding: 0;
    color: #333;
}

header {
    padding: 40px 20px 20px;
    text-align: center;
}

header h1 {
    display: block;
    background: #fff;
    color: #2c3e50;
    padding: 20px;
    margin: 0 auto;
    font-size: 3.2em;
    width: 100%;
    max-width: 900px;
    box-sizing: border-box;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 300;
    text-align: center;
    border: 2px solid #337ab7;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
        padding: 15px 10px;
    }
}

header h1 span {
    font-weight: 900; /* Estilo extra-bold para Ocorrências */
    color: #337ab7; /* Azul institucional */
    display: inline-block;
    position: relative;
}

header h1 span::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 4px;
    background: #337ab7;
    border-radius: 2px;
    opacity: 0.3;
}

nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px auto 30px;
    max-width: 900px;
}

nav a {
    text-decoration: none;
    padding: 14px 20px;
    border-radius: 8px;
    font-weight: bold;
    color: #fff;
    flex: 1;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    text-transform: uppercase;
    font-size: 0.9em;
}

nav a[href="ativas.php"] { background-color: #FF9800; }
nav a[href="resolvidas.php"] { background-color: #4CAF50; }
nav a[href="nao_resolvidas.php"] { background-color: #3d3030; border-bottom: 3px solid #721c24; }

nav a:hover { transform: translateY(-2px); filter: brightness(1.1); }
nav a.active { outline: 3px solid #fff; outline-offset: -5px; box-shadow: inset 0 0 10px rgba(0,0,0,0.3); }

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px 100px;
}

/* --- FILTROS --- */
.filters-panel {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 25px;
    padding: 18px;
}

.filters-top {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.search-field {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85em;
    font-weight: 800;
    text-transform: uppercase;
    color: #555;
}

.search-field input {
    border: 1px solid #cfd4da;
    border-radius: 6px;
    font-size: 1em;
    padding: 11px 12px;
}

.filters-clear {
    background: #333;
    border: 0;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-weight: 800;
    padding: 12px 16px;
    text-transform: uppercase;
    white-space: nowrap;
}

.filters-groups {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.filter-group {
    border: 1px solid #e2e5e9;
    border-radius: 8px;
    margin: 0;
    padding: 12px;
}

.filter-group legend {
    color: #333;
    font-size: 0.85em;
    font-weight: 900;
    padding: 0 6px;
    text-transform: uppercase;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-check {
    align-items: center;
    background: #f5f5f5;
    border: 1px solid #e2e5e9;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    gap: 7px;
    padding: 7px 10px;
}

.filter-check input { margin: 0; }

.filter-check span {
    font-size: 0.9em;
    font-weight: 700;
}

.filters-summary {
    color: #555;
    font-size: 0.9em;
    font-weight: 700;
    margin-top: 14px;
}

.empty-filter-state {
    background: #fff;
    border: 1px dashed #cfd4da;
    border-radius: 8px;
    color: #555;
    display: none;
    font-weight: 700;
    margin: 0 0 25px;
    padding: 24px;
    text-align: center;
}

/* --- CARDS --- */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 25px;
    display: flex;
    flex-direction: row;
    align-items: center;
    overflow: hidden;
    border: 1px solid #dee2e6;
    position: relative;
}

.card-devolvida {
    border-left: 8px solid #FF9800 !important;
    background-color: #fffdf5;
}

.card-ativa {
    border: 2px solid #FF9800 !important;
}

.card-resolvida {
    border: 2px solid #4CAF50 !important;
}

.card-nao-resolvida {
    border: 2px solid #3d3030 !important;
}

.card-img {
    width: 250px;
    min-width: 250px;
    height: 250px;
    object-fit: cover;
    margin: 15px;
    border-radius: 10px;
}

.card-img[src*="no_foto.png"] {
    width: 250px;
    height: 250px;
    padding: 55px;
    box-sizing: border-box;
    object-fit: contain;
    background-color: #f9f9f9;
    margin: 15px;
    border-radius: 10px;
}

.card-content {
    padding: 25px;
    padding-right: 65px;
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: space-between;
}

.card-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.card-header img { width: 24px; height: 24px; }
.card-header h3 { margin: 0; font-size: 1.15em; color: #d9534f; font-weight: 800; text-transform: uppercase; }

.freguesia-name { font-weight: 900 !important; color: #000; }
.info-item .author-name {
    color: #222 !important;
    font-style: italic !important;
    font-weight: 900 !important;
}

.ocorrencia-id-row span {
    color: #000 !important;
    font-weight: 900 !important;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7em;
    font-weight: bold;
    text-transform: uppercase;
    white-space: nowrap;
}
.status-0 { background: #fef1d8; color: #856404; }
.status-1 { background: #d1ecf1; color: #0c5460; }
.status-2 { background: #d4edda; color: #155724; }
.status-3 { background: #f8d7da; color: #721c24; }

.badge-alerta-gestor {
    background-color: #FF9800;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: bold;
    margin-left: 5px;
    display: inline-block;
}

.info-item { margin-bottom: 6px; font-size: 0.95em; display: flex; align-items: flex-start; }
.info-item b {
    color: #555;
    min-width: 180px;
    display: inline-block;
    white-space: nowrap;
}

/* --- CONTADOR DE COMENTÁRIOS --- */
.comment-container {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-top: 15px; /* Espaço ligeiríssimo solicitado */
}

.comment-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    color: #666;
    font-weight: bold;
    background: #f0f0f0;
    width: fit-content;
    margin-top: 5px; /* Espaço ligeiríssimo solicitado */
}
.comment-count-badge img { width: 18px !important; height: 18px !important; margin: 0 !important; padding: 0 !important; }

.comment-has-data {
    color: #007bff !important;
    background-color: #e7f3ff !important;
}

.description-box {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    border-left: 5px solid #d9534f;
    margin-top: 15px;
    font-style: italic;
    color: #444;
}

.btn-mapa {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 58px;
    height: 58px;
    cursor: pointer;
    background: #fff;
    padding: 10px;
    box-sizing: border-box;
    object-fit: contain;
    border-radius: 30%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s, background-color 0.2s;
    z-index: 10;
    border: 2px solid #eee;
}

.btn-mapa:hover {
    transform: scale(1.2);
}

.modal-mapa {
    display: none;
    position: fixed;
    z-index: 20000;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.8);
    align-items: center;
    justify-content: center;
}

.modal-mapa-content {
    background-color: #fff;
    width: 95%;
    max-width: 1100px;
    height: 85vh;
    border-radius: 28px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 15px 50px rgba(0,0,0,0.5);
    display: flex;
}

#mapCanvas { flex: 1; width: 100%; height: 100%; border: none; }

.btn-streetview {
    position: absolute;
    bottom: 25px;
    left: 25px;
    background-color: #fff;
    color: #333;
    padding: 10px 20px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9em;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 20002;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-mapa {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 35px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    z-index: 20001;
    background: rgba(255,255,255,0.9);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

footer {
    background: #fff;
    border-top: 1px solid #ccc;
    font-size: 1.0em !important;
    width: 100%;
    height: 60px;
    line-height: 60px;
    padding: 0 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 100;
}

footer .pull-left, footer .pull-right { font-size: 1.0em !important; }

.quick-actions {
    position: fixed;
    right: 25px;
    bottom: 100px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end;
}

.quick-action-btn {
    width: 55px;
    height: 55px;
    border: 1px solid #ddd;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.3s ease;
}

.quick-action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    filter: brightness(1.05);
}

.quick-action-btn img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

#btnBackToTop {
    opacity: 0;
    pointer-events: none;
}

#btnBackToTop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .filters-top { flex-direction: column; align-items: stretch; }
    .filters-groups { grid-template-columns: 1fr; }
    .filters-clear { width: 100%; }
    .card { flex-direction: column; }
    .card-img { width: 100%; height: 200px; border-bottom: 1px solid #eee; }
    .card-img[src*="no_foto.png"] { padding: 30px; }
    header h1 { font-size: 1.5em; padding: 12px; }
    nav { flex-direction: column; gap: 8px; }
    .card-content { padding-right: 25px; padding-bottom: 60px; }
    .card-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .info-item { flex-direction: column; }
    .info-item b { min-width: auto; margin-bottom: 2px; }
    .btn-mapa { bottom: 10px; right: 10px; width: 55px; height: 55px; padding: 2px; }
    .quick-actions { right: 20px; bottom: 100px; }
    .quick-action-btn { width: 50px; height: 50px; }
    footer { position: relative; flex-direction: column; height: auto; padding: 15px; line-height: 1.5; text-align: center; }
}
