/* Cores baseadas no site da prefeitura de Piquet Carneiro */
:root {
    --primary-blue: #1e40af;      /* Azul principal mais escuro */
    --secondary-blue: #2563eb;    /* Azul secundário */
    --accent-green: #047857;      /* Verde escuro mais conservador */
    --light-green: #059669;       /* Verde médio */
    --municipal-green: #10b981;   /* Verde claro para destaque */
    --dark-gray: #374151;
    --light-gray: #f3f4f6;
    --white: #ffffff;
    --text-dark: #1f2937;
    --border-color: #d1d5db;
    --background-light: #f8fafc;
    --official-blue: #1e3a8a;     /* Azul oficial governamental */
}

/* ========================================
   LEAFLET TILE IMPROVEMENTS
======================================== */

/* Corrigir gaps entre tiles - abordagem mais efetiva */
.leaflet-tile-container img {
    width: 256px !important;
    height: 256px !important;
    max-width: 256px !important;
    max-height: 256px !important;
}

.leaflet-tile {
    outline: 1px solid transparent;
    width: 256px !important;
    height: 256px !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.leaflet-tile-pane {
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.leaflet-layer {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* ========================================
   ACESSIBILIDADE PARA DALTONISMO
======================================== */

/* Filtros CSS para aplicar às classes do body */
.colorblind-protanopia {
    filter: url(#protanopia-filter);
}

.colorblind-deuteranopia {
    filter: url(#deuteranopia-filter);
}

.colorblind-tritanopia {
    filter: url(#tritanopia-filter);
}

.colorblind-achromatopsia {
    filter: url(#achromatopsia-filter);
}

/* Menu de acessibilidade visual */
.colorblind-accessibility-menu {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: inherit;
    max-width: 280px;
    transition: all 0.3s ease;
}

.colorblind-menu-header {
    position: relative;
}

.colorblind-toggle-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 16px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    min-width: 180px;
    justify-content: center;
}

.colorblind-toggle-btn:hover {
    background: var(--secondary-blue);
    box-shadow: 0 6px 16px rgba(30, 64, 175, 0.4);
    transform: translateY(-2px);
}

.colorblind-toggle-btn:focus {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
}

.colorblind-toggle-btn i {
    font-size: 16px;
}

.colorblind-menu-content {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    padding: 20px;
    margin-bottom: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    min-width: 260px;
}

.colorblind-accessibility-menu.expanded .colorblind-menu-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.colorblind-label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 14px;
}

.colorblind-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    color: var(--text-dark);
    transition: border-color 0.2s ease;
}

.colorblind-select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.colorblind-info {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.colorblind-description {
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
    display: block;
}

/* Responsividade para dispositivos móveis */
@media (max-width: 768px) {
    .colorblind-accessibility-menu {
        bottom: 15px;
        right: 15px;
        max-width: 260px;
    }

    .colorblind-toggle-btn {
        min-width: 160px;
        padding: 10px 14px;
        font-size: 13px;
    }

    .colorblind-toggle-btn .colorblind-menu-text {
        display: none;
    }

    .colorblind-menu-content {
        min-width: 240px;
    }
}

@media (max-width: 480px) {
    .colorblind-accessibility-menu {
        bottom: 10px;
        right: 10px;
    }

    .colorblind-toggle-btn {
        min-width: 50px;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        padding: 0;
    }

    .colorblind-menu-content {
        right: -10px;
        min-width: 220px;
    }
}

/* Reset e configurações gerais */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f8fafc;
}

/* Header */
.header-main {
    background: linear-gradient(135deg, var(--official-blue) 0%, var(--primary-blue) 100%);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.5rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--white) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand i {
    font-size: 2.4rem;
    color: var(--municipal-green);
}

.navbar-brand:hover {
    color: var(--municipal-green) !important;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--white) !important;
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.navbar-nav .nav-link.active {
    color: var(--white) !important;
    background-color: var(--accent-green);
}

/* Main Content */
.main-content {
    flex: 1;
    min-height: calc(100vh - 140px);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--official-blue) 0%, var(--primary-blue) 50%, var(--accent-green) 100%);
    color: var(--white);
    padding: 2rem 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="20" cy="20" r="1" fill="white" opacity="0.1"/><circle cx="80" cy="40" r="0.5" fill="white" opacity="0.05"/><circle cx="40" cy="80" r="1.5" fill="white" opacity="0.08"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.3rem;
    margin-bottom: 2.5rem;
    opacity: 0.95;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-btn {
    background-color: var(--municipal-green);
    color: var(--white);
    border: 3px solid var(--white);
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-btn:hover {
    background-color: var(--white);
    color: var(--official-blue);
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Cards */
.card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.2);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: var(--white);
    border: none;
    padding: 1rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

.layer-card {
    height: 100%;
    transition: all 0.3s ease;
}

.layer-preview {
    height: 200px;
    background: linear-gradient(45deg, var(--light-gray) 0%, #e5e7eb 100%);
    position: relative;
    overflow: hidden;
}

.layer-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.layer-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--dark-gray);
    font-size: 3rem;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--secondary-blue);
    border-color: var(--secondary-blue);
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--accent-green);
    border-color: var(--accent-green);
    border-radius: 0.5rem;
    font-weight: 500;
}

.btn-success:hover {
    background-color: var(--light-green);
    border-color: var(--light-green);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--primary-blue);
    border-color: var(--primary-blue);
    border-radius: 0.5rem;
}

.btn-outline-primary:hover {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}

/* Footer */
.footer-main {
    background-color: var(--dark-gray);
    color: var(--white);
    padding: 3rem 0 1rem;
    margin-top: auto;
}

.footer-main h5 {
    color: var(--light-green);
    margin-bottom: 1rem;
    font-weight: 600;
}

.footer-main a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-main a:hover {
    color: var(--light-green);
}

.social-links a {
    display: inline-block;
    margin-right: 1rem;
    font-size: 1.5rem;
    color: var(--white);
    transition: all 0.3s ease;
}

.social-links a:hover {
    color: var(--light-green);
    transform: translateY(-2px);
}

/* Map specific styles */
.map-container {
    height: 100%;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.map-controls {
    background-color: var(--white);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.layer-control {
    background-color: var(--white);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.layer-control:hover {
    border-color: var(--primary-blue);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.layer-control.active {
    border-color: var(--accent-green);
    background-color: rgba(5, 150, 105, 0.05);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .map-container {
        height: 400px;
    }

    .card-body {
        padding: 1rem;
    }
}

/* Loading animations */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Utility classes */
.text-primary-custom {
    color: var(--primary-blue) !important;
}

.text-success-custom {
    color: var(--accent-green) !important;
}

.bg-primary-custom {
    background-color: var(--primary-blue) !important;
}

.bg-success-custom {
    background-color: var(--accent-green) !important;
}

.border-primary-custom {
    border-color: var(--primary-blue) !important;
}

.border-success-custom {
    border-color: var(--accent-green) !important;
}

/* Section headers */
.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--dark-gray);
    max-width: 600px;
    margin: 0 auto;
}

/* Stats cards */
.stats-card {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--white) 0%, var(--light-gray) 100%);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.2);
}

.stats-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent-green);
    margin-bottom: 0.5rem;
}

.stats-label {
    color: var(--dark-gray);
    font-weight: 500;
}

/* Custom Map Markers */
.custom-marker {
    background: transparent !important;
    border: none !important;
}

.custom-marker div {
    transition: all 0.2s ease;
    cursor: pointer;
}

.custom-marker div:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4) !important;
}

/* Info Popup Styling */
.info-popup {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 300px;
}

.popup-header {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: white;
    padding: 0.75rem 1rem;
    margin: -0.5rem -0.75rem 0.75rem -0.75rem;
    border-radius: 0.5rem 0.5rem 0 0;
    font-weight: 600;
    text-align: center;
}

.popup-content {
    padding: 0.5rem 0;
}

.popup-property {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.popup-property:last-child {
    border-bottom: none;
}

.popup-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-right: 1rem;
}

.popup-value {
    color: var(--dark-gray);
    text-align: right;
}
