/* cidade_gastos.css - Estilos para a página de gastos da prefeitura */

:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --border: rgba(148, 163, 184, 0.4);
    --text: #0f172a;
    --muted: #64748b;
    --accent: #1d4ed8;
    --danger: #b91c1c;
    --success: #15803d;
}

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

body { 
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; 
    background: var(--bg); 
    color: var(--text);
    margin: 0;
    overflow-x: hidden;
    width: 100%;
}

.page-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.shell {
    max-width: 930px !important;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 2rem;
    width: 100%;
    overflow-x: hidden !important;
}

.card { 
    background: var(--card); 
    border: 1px solid var(--border); 
    border-radius: 12px; 
    padding: 1rem; 
    box-shadow: 0 10px 30px rgba(15,23,42,0.08); 
    margin-bottom: 1rem;
}

.card h3 { 
    font-size: 1rem; 
    font-weight: 700; 
    margin: 0 0 0.5rem 0;
    color: var(--text);
}

.stats-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 1rem; 
    margin-bottom: 1.5rem; 
}

.stat-card { 
    background: var(--card); 
    padding: 1.25rem; 
    border-radius: 12px; 
    box-shadow: 0 10px 30px rgba(15,23,42,0.08); 
    border: 1px solid var(--border);
}

.stat-card h3 { 
    font-size: 0.9rem; 
    color: var(--muted); 
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.stat-card .value { 
    font-size: 1.8rem; 
    font-weight: 700; 
    color: var(--accent); 
}

.stat-card .subtext { 
    font-size: 0.8rem; 
    color: var(--muted); 
    margin-top: 0.35rem; 
}

.btn { 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.9rem; 
    background: var(--accent); 
    color: white; 
    border: none; 
    border-radius: 10px; 
    cursor: pointer; 
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
}

.btn:hover { 
    background: #1e40af; 
}

.btn-light {
    background: #e5e7eb;
    color: #111827;
    border: 1px solid #cbd5e1;
}

.btn-light:hover {
    background: #d1d5db;
}

.back-btn { 
    display: inline-block; 
    padding: 0.45rem 0.9rem; 
    background: #6b7280; 
    color: white; 
    text-decoration: none; 
    border-radius: 10px; 
    margin-bottom: 1rem;
    font-weight: 600;
}

.back-btn:hover { 
    background: #4b5563; 
}

.results {
    margin-top: 1.5rem;
    max-width: 100%;
    overflow-x: hidden;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.results-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.results-header .filters {
    margin: 0;
}

.results-header .filters form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.results-header .filters select,
.results-header .filters input[type="text"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--card);
    color: var(--text);
}

.results-header .filters button {
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.results-header .filters button:hover {
    background: #1e40af;
}

.cache-info { 
    background: #dbeafe; 
    padding: 0.75rem; 
    border-radius: 8px; 
    margin-bottom: 1rem; 
    font-size: 0.9rem;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

table { 
    width: 100%; 
    border-collapse: collapse;
    max-width: 100%;
    table-layout: fixed;
}

th, td { 
    padding: 0.6rem; 
    text-align: left; 
    border-bottom: 1px solid var(--border); 
    font-size: 0.9rem;
}

th { 
    background: #f1f5f9; 
    font-weight: 700; 
    color: var(--muted); 
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.valor { 
    font-weight: 700; 
    color: var(--accent); 
}

.categoria { 
    display: inline-block; 
    padding: 0.25rem 0.6rem; 
    background: #dbeafe; 
    border-radius: 6px; 
    font-size: 0.8rem; 
    font-weight: 600;
}

.full-width-card {
    width: 100%;
}

.meses-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
}

.mes-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(15,23,42,0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mes-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15,23,42,0.12);
}

.mes-card .mes-header {
    padding: 0.5rem;
    text-align: center;
}

.mes-card .mes-nome {
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mes-card .mes-content {
    padding: 1rem;
    text-align: center;
}

.mes-card .mes-valor {
    font-size: 1.1rem;
    font-weight: 700;
    color: #000;
}

/* Cores azuis para todos os meses (mais suave) */
.mes-card:nth-child(n) .mes-header { background: #3b82f6; }
.mes-card:nth-child(n) .mes-content { background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); }
.mes-card:nth-child(n) .mes-valor { color: #000; }

/* Card Valores Anuais - Azul (padrão) */
.valores-anuais-card.azul {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}
.valores-anuais-card.azul .card-header {
    background: #3b82f6;
}
.valores-anuais-card.azul .valor-item {
    border-bottom: 1px solid rgba(59, 130, 246, 0.15);
}
.valores-anuais-card.azul .valor-item .label {
    color: #1e40af;
}

/* Card Valores Anuais - Verde (mais suave) */
.valores-anuais-card.verde {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}
.valores-anuais-card.verde .card-header {
    background: #22c55e;
}
.valores-anuais-card.verde .valor-item {
    border-bottom: 1px solid rgba(34, 197, 94, 0.15);
}
.valores-anuais-card.verde .valor-item .label {
    color: #15803d;
}

/* Card Top Categorias - Roxo (mais suave) */
.valores-anuais-card.roxo {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
}
.valores-anuais-card.roxo .card-header {
    background: #a855f7;
}
.valores-anuais-card.roxo .valor-item {
    border-bottom: 1px solid rgba(168, 85, 247, 0.15);
}
.valores-anuais-card.roxo .valor-item .label {
    color: #7e22ce;
}

/* Card Soma por Função - Amarelo (mais suave) */
.valores-anuais-card.amarelo {
    background: linear-gradient(135deg, #feffea 0%, #fefce8 100%);
}
.valores-anuais-card.amarelo .card-header {
    background: #ca8a04;
}
.valores-anuais-card.amarelo .valor-item {
    border-bottom: 1px solid rgba(234, 179, 8, 0.1);
}
.valores-anuais-card.amarelo .valor-item .label {
    color: #000;
}

/* Card Valores Anuais (padrão azul) */
.valores-anuais-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.valores-anuais-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(15,23,42,0.06);
}

.valores-anuais-card .card-header {
    padding: 0.75rem 1rem;
    text-align: center;
}

.valores-anuais-card .card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.valores-anuais-card .card-content {
    padding: 1rem;
}

.valor-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(30, 64, 175, 0.2);
}

.valor-item:last-child {
    border-bottom: none;
}

.valor-item .label {
    font-size: 0.9rem;
    color: #1e40af;
    font-weight: 500;
}

.valor-item .value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #000;
}

#modal-lancamento {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

#fechar-modal {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

#fechar-modal:hover {
    background: #dc2626;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    width: 100%;
}

.table-responsive table {
    width: 100%;
    min-width: 0;
}

/* Responsividade */
@media (max-width: 1200px) {
    .meses-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .meses-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .valores-anuais-grid {
        grid-template-columns: 1fr;
    }
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .results-header .filters form {
        width: 100%;
        flex-wrap: wrap;
    }
    .results-header .filters select,
    .results-header .filters input[type="text"] {
        flex: 1;
        min-width: 120px;
    }
    .results-header .filters button {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .meses-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    table {
        font-size: 0.8rem;
    }
    th, td {
        padding: 0.4rem;
    }
    .valores-anuais-card .card-header h3 {
        font-size: 0.9rem;
    }
    .valor-item .label,
    .valor-item .value {
        font-size: 0.8rem;
    }
}

@media (max-width: 400px) {
    .meses-grid {
        grid-template-columns: 1fr;
    }
    .shell {
        padding: 1rem;
    }
}
