:root {
    --primary-color: #005f87;
    --secondary-color: #003d5b;
    --accent-color: #ff7d00;
    --light-color: #f8f9fa;
    --dark-color: #2d3436;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --danger-color: #d63031;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background: linear-gradient(135deg, #005f87, #003d5b);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    gap: 2rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: 110px;
}

.logo {
    height: 100px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
    object-fit: contain;
}

.logo:hover {
    transform: scale(1.05);
}

.municipio-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.municipio-nome {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.secretaria {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 400;
    margin-top: 0.3rem;
}

.header-text {
    text-align: right;
    border-right: 3px solid rgba(255, 255, 255, 0.2);
    padding-right: 2rem;
}

.header-text h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-text p {
    margin: 0.5rem 0 0;
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 300;
    font-style: italic;
}

.main-content {
    flex: 1;
    width: 90%;
    max-width: 1200px;
    margin: 2rem auto;
    padding-bottom: 2rem;
}

.leaflet-popup-content-wrapper {
    border-radius: var(--border-radius) !important;
    box-shadow: var(--box-shadow) !important;
    padding: 0 !important;
    overflow: hidden;
    min-width: 280px;
}

.leaflet-popup-content {
    margin: 0 !important;
    width: auto !important;
    min-width: 280px;
}

.popup-header {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 1rem;
}

.popup-body {
    padding: 1rem;
    background: white;
}

.popup-row {
    display: flex;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.popup-label {
    font-weight: 600;
    color: var(--secondary-color);
    min-width: 120px;
    margin-right: 0.5rem;
}

.popup-value {
    color: var(--dark-color);
    word-break: break-word;
}

.map-container {
    width: 100%;
    height: 65vh;
    min-height: 500px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
    background-color: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

.info-panel {
    background-color: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    box-shadow: var(--box-shadow);
    border-left: 4px solid var(--accent-color);
}

.info-panel h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.25rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.info-item {
    margin-bottom: 0.5rem;
}

.info-item strong {
    display: block;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.info-item span {
    font-size: 1rem;
    color: var(--dark-color);
}

.info-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.action-btn {
    flex: 1 1 auto;
    min-width: 150px;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    background-color: var(--primary-color);
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: var(--box-shadow);
}

.action-btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.action-btn i {
    font-size: 1rem;
}

#btn-cronograma-geral {
    background-color: #6c5ce7;
}

#btn-cronograma-geral:hover {
    background-color: #5649be;
}

#btn-compartilhar {
    background-color: #25D366;
}

#btn-compartilhar:hover {
    background-color: #128C7E;
}

.no-data-message {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.no-data-message i {
    font-size: 2rem;
    color: #999;
    margin-bottom: 1rem;
}

.no-data-message p {
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-header h2 {
    margin: 0;
    color: var(--primary-color);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark-color);
    transition: all 0.2s ease;
}

.close-modal:hover {
    color: var(--danger-color);
}

.modal-body {
    margin-bottom: 1.5rem;
}

/* ==================== */
/* IMPROVED CALENDAR STYLES */
/* ==================== */

.cronograma-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
}

.cronograma-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.cronograma-header h2 {
    color: #2c3e50;
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Month grouping styles */
.mes-section {
    margin-bottom: 2.5rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    border-top: 3px solid var(--primary-color);
}

.mes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.mes-header h3 {
    color: var(--primary-color);
    font-size: 1.4rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.mes-header h3 i {
    font-size: 1.2rem;
    color: var(--accent-color);
}

.total-atividades {
    background-color: var(--accent-color);
    color: white;
    padding: 0.4rem 1.2rem;
    border-radius: 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
}

/* Activity cards grid */
.atividades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
}

.atividade-card {
    position: relative;
    padding: 1.5rem 1rem 1rem;
    /* Mais espaço no topo */
    border-radius: 8px;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    border-left: 4px solid;
    min-height: 120px;
    /* Altura mínima consistente */
}

.atividade-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Status badges */
.atividade-status {
    position: absolute;
    top: 0.5rem;
    /* Posicionado mais para cima */
    right: 0.5rem;
    padding: 0.3rem 0.8rem;
    /* Tamanho reduzido */
    border-radius: 1rem;
    font-size: 0.7rem;
    /* Fonte menor */
    font-weight: 600;
    text-transform: uppercase;
    max-width: 100px;
    /* Largura máxima */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.atividade-status.Concluída {
    background: #e6ffed;
    color: #22863a;
}

.atividade-status.Em-Andamento {
    background: #fff5b1;
    color: #d97706;
}

.atividade-status.Planejada {
    background: #e1effe;
    color: #1c64f2;
}

/* Card content */
.atividade-servico {
    margin: 0.2rem 0 0.8rem;
    color: var(--dark-color);
    font-size: 1rem;
    font-weight: 600;
    padding-right: 4rem;
    /* Espaço para o status */
    word-break: break-word;
    /* Quebra de linha */
}

.atividade-local {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #4b5563;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.atividade-local i {
    color: var(--primary-color);
    font-size: 0.9rem;
}

.atividade-trecho {
    color: var(--secondary-color);
    font-size: 0.95rem;
    margin: 0;
    padding-top: 0.8rem;
    border-top: 1px dashed #e5e7eb;
}

.atividade-local,
.atividade-trecho {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Status-specific card borders */
.atividade-card.Concluída {
    border-left-color: var(--success-color);
}

.atividade-card.Em-Andamento {
    border-left-color: var(--warning-color);
}

.atividade-card.Planejada {
    border-left-color: var(--primary-color);
}

/* Filters section */
.filtros-container {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filtro-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filtro-group label {
    font-size: 0.9rem;
    color: var(--dark-color);
    font-weight: 500;
}

.filtro-select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background-color: white;
    font-size: 0.9rem;
    min-width: 150px;
    cursor: pointer;
}

.filtro-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 95, 135, 0.1);
}

.download-btn {
    background: #d32f2f;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.download-btn:hover {
    background: #b71c1c;
    transform: translateY(-2px);
}

.download-btn i {
    font-size: 0.9rem;
}

/* Footer */
.cronograma-footer {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mes-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .atividades-grid {
        grid-template-columns: 1fr;
    }

    .filtros-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .filtro-group {
        width: 100%;
    }

    .filtro-select {
        width: 100%;
    }

    .atividade-card {
        padding: 1.2rem 0.8rem 0.8rem;
    }

    .atividade-status {
        font-size: 0.65rem;
        padding: 0.2rem 0.6rem;
        max-width: 80px;
    }

    .atividade-servico {
        padding-right: 3.5rem;
        font-size: 0.95rem;
    }
}

footer {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    padding: 1rem;
    text-align: center;
    font-size: 0.85rem;
    margin-top: auto;
    /* Mantém o footer no rodapé */
}

footer a {
    color: white !important;
    /* Força cor branca */
    text-decoration: none !important;
    /* Remove sublinhado */
    transition: opacity 0.3s ease;
    display: inline-block;
    /* Melhor controle do espaçamento */
}

footer a:hover {
    opacity: 0.8;
    /* Efeito sutil ao passar o mouse */
}

/* Remove qualquer estilo de link visitado */
footer a:visited {
    color: white !important;
}

/* Remove outline em foco para dispositivos móveis */
footer a:focus {
    outline: none;
}

.map-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.map-btn {
    background-color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: var(--box-shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark-color);
    transition: all 0.2s ease;
}

.map-btn:hover {
    background-color: var(--light-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.map-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.map-btn i {
    font-size: 1.1rem;
}

.legend {
    padding: 0.75rem;
    background: white;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    line-height: 1.5;
    font-size: 0.8rem;
    backdrop-filter: blur(2px);
}

.legend h4 {
    margin: 0 0 0.5rem;
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    margin-right: 0.5rem;
    border-radius: 3px;
    flex-shrink: 0;
}

.loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.spinner {
    border: 4px solid rgba(0, 95, 135, 0.1);
    border-radius: 50%;
    border-top: 4px solid var(--primary-color);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.error-message {
    background-color: var(--danger-color);
    color: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    display: none;
    align-items: center;
}

.error-message i {
    margin-right: 0.5rem;
}

.select-container {
    margin-bottom: 1.5rem;
}

.select-container label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--secondary-color);
    font-size: 0.95rem;
}

.select-container select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background-color: white;
    box-shadow: var(--box-shadow);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    transition: all 0.2s;
}

.select-container select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 95, 135, 0.1);
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

body {
    font-size: 14px;
    line-height: 1.5;
}

.header-text h1 {
    font-size: 1.3rem;
}

.header-text p {
    font-size: 0.85rem;
}

.info-panel h2 {
    font-size: 1.1rem;
}

.info-item span {
    font-size: 0.9rem;
}

.leaflet-control-layers {
    display: none !important;
}

.map-controls {
    gap: 0.3rem;
}

.map-btn {
    width: 36px;
    height: 36px;
}

.map-btn i {
    font-size: 1rem;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .logo-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .header-text {
        text-align: center;
        border-right: none;
        padding-right: 0;
        border-bottom: 3px solid rgba(255, 255, 255, 0.2);
        padding-bottom: 1rem;
    }

    .municipio-info {
        align-items: center;
    }
}

/* ==================== */
/* PRINT STYLES         */
/* ==================== */
@media print {

    /* Remove TODOS os elementos de ícone */
    i.fas,
    i.fab,
    i.fa,
    [class^="fa-"],
    [class*=" fa-"],
    .filter-icon,
    .calendar-icon,
    .info-icon {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        font-size: 0 !important;
        opacity: 0 !important;
    }

    /* Remove pseudo-elementos de ícones */
    *::before,
    *::after {
        content: "" !important;
        display: none !important;
    }

    /* Mantém o texto dos ícones importantes */
    .fa-calendar-alt::after {
        content: "Cronograma:";
        display: inline !important;
        margin-left: 5px;
    }

    .fa-info-circle::after {
        content: "Info:";
        display: inline !important;
        margin-left: 5px;
    }


    /* Adiciona texto descritivo após os elementos que tinham ícones */
    .cronograma-header h2::after {
        content: "Cronograma de Manutenção";
        display: inline !important;
        margin-left: 5px;
    }

    .cronograma-footer p::before {
        content: "Última atualização: ";
        display: inline !important;
    }

    /* Mantém o resto do estilo de impressão */
    body * {
        visibility: hidden;
    }

    .modal-content,
    .modal-content * {
        visibility: visible;
    }

    .modal-content {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: auto;
        box-shadow: none;
        border: none;
        font-size: 12pt;
    }

    /* Esconde elementos não necessários */
    .modal-header,
    .filtros-container,
    .close-modal,
    .download-btn,
    .fa-map-marker-alt {
        display: none !important;
    }

    .filtros-aplicados {
        background-color: #f8f8f8;
        padding: 8px;
        border-radius: 4px;
        margin-bottom: 15px;
        border: 1px solid #eee;
    }

    .filtros-aplicados strong {
        font-weight: bold;
        color: #333;
    }

    .print-header {
        margin-bottom: 15px;
        padding-bottom: 10px;
        border-bottom: 2px solid #005f87;
    }

    /* Melhora a tabela para impressão */
    table {
        width: 100%;
        border-collapse: collapse;
        margin: 0.5cm 0;
        font-size: 9pt;
    }

    th,
    td {
        border: 1px solid #ddd;
        padding: 4px;
        text-align: left;
    }

    th {
        background-color: #f2f2f2 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    caption {
        font-weight: bold;
        font-size: 11pt;
        margin: 0.5cm 0 0.3cm;
        text-align: left;
    }

    /* Evita quebra de página dentro de seções */
    .mes-section {
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 1cm;
    }

    /* Ajusta cabeçalho do documento */
    h1 {
        color: #005f87 !important;
        font-size: 14pt !important;
        margin-bottom: 0.5cm;
    }
}