* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #741d2d;
    --primary-light: #a02838;
    --gold: #fbbf24;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #fef3c7 0%, #fce7f3 50%, #dbeafe 100%);
    color: #1f2937;
    overflow-x: hidden;
    padding-top: 80px;
    min-height: 100vh;
}

/* HERO COMPACTO */
.hero-compact {
    background: linear-gradient(135deg, var(--primary), var(--primary-light), #dc2626);
    padding: 50px 20px 40px;
    position: relative;
    overflow: hidden;
}

.hero-compact::before {
    content: '📍';
    position: absolute;
    font-size: 200px;
    color: rgba(255, 255, 255, 0.05);
    top: -50px;
    right: 10%;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

.hero-content-compact {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hero-icon {
    font-size: 3.5rem;
    color: var(--gold);
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 10px rgba(251, 191, 36, 0.5));
}

/* MAPA */
.map-section-title {
    font-size: clamp(1.8rem, 4vw, 2.2rem);
    font-weight: 900;
    margin-bottom: 25px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.map-section-title i {
    color: var(--gold);
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff, var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    color: rgba(255, 255, 255, 0.9);
}

/* CONTAINER */
.localidades-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 30px 20px 60px;
}

/* STATS BAR */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.stats-floating {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 30px;
}

.stat-badge {
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-badge:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(116, 29, 45, 0.2);
}

.stat-badge i {
    font-size: 1.5rem;
    color: var(--primary);
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--gold);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: #4b5563;
    text-transform: uppercase;
    font-weight: 600;
}

/* MAIN LAYOUT */
.map-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 25px;
    min-height: 750px;
}

/* SIDEBAR */
.sidebar {
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-radius: 25px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    max-height: 750px;
    overflow-y: auto;
    border: 3px solid transparent;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    margin-bottom: 20px;
}

.sidebar-title {
    font-size: 1.5rem;
    font-weight: 900;
    margin-bottom: 20px;
    color: var(--primary);
}

.search-box {
    position: relative;
    margin-bottom: 25px;
}

.search-input {
    width: 100%;
    padding: 14px 45px 14px 18px;
    background: rgba(116, 29, 45, 0.05);
    border: 2px solid rgba(116, 29, 45, 0.2);
    border-radius: 15px;
    color: #1f2937;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.search-input::placeholder {
    color: #9ca3af;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(116, 29, 45, 0.08);
}

.search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold);
    font-size: 1.2rem;
}

.churches-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}

.churches-list::-webkit-scrollbar {
    width: 6px;
}

.churches-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.churches-list::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 10px;
}

.church-item {
    background: rgba(116, 29, 45, 0.05);
    padding: 16px;
    border-radius: 15px;
    margin-bottom: 12px;
    border-left: 3px solid var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.church-item:hover {
    background: rgba(116, 29, 45, 0.1);
    transform: translateX(5px);
    border-left-width: 5px;
    box-shadow: 0 4px 15px rgba(116, 29, 45, 0.15);
}

.church-name {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 6px;
    color: #1f2937;
}

.church-detail {
    font-size: 0.9rem;
    color: #111827;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.church-detail i {
    color: var(--primary);
    font-size: 0.9rem;
}

/* MAP CONTAINER */
.map-wrapper {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 20px;
    height: 750px;
    display: flex;
    flex-direction: column;
}

.map-header {
    margin-bottom: 15px;
}

.map-title {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 10px;
}

#map {
    flex: 1;
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* POPUP LEAFLET CUSTOM */
.leaflet-popup-content-wrapper {
    background: #1a1a2e !important;
    border: 2px solid var(--gold);
    border-radius: 15px;
    padding: 0;
}

.leaflet-popup-content {
    margin: 20px;
    color: #fff;
    font-size: 0.95rem;
}

.leaflet-popup-content h3 {
    margin: 0 0 10px 0;
    color: var(--gold) !important;
    font-size: 1.1rem;
    font-weight: 700;
}

.leaflet-popup-content .church-detail {
    color: #e5e7eb;
    font-weight: 400;
    margin: 8px 0;
}

.leaflet-popup-content .church-detail i {
    color: var(--gold) !important;
    margin-right: 5px;
}

.leaflet-popup-tip {
    background: #1a1a2e;
    border: 2px solid var(--gold);
}

/* NO RESULTS */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.5);
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
    color: var(--gold);
    opacity: 0.5;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
    .map-layout {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .sidebar {
        max-height: 400px;
        order: 2;
    }

    .map-wrapper {
        height: 600px;
        order: 1;
    }
}

@media (max-width: 768px) {
    .map-wrapper {
        height: 500px;
    }

    .sidebar {
        max-height: 350px;
    }

    .stat-badge {
        padding: 12px 20px;
    }
}

/* ========== NUEVOS ESTILOS ========== */

/* Botón de Geolocalización */
.btn-ubicarme {
    margin-top: 20px;
    background: linear-gradient(135deg, var(--gold), #f59e0b);
    color: #1f2937;
    border: none;
    padding: 14px 32px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-ubicarme:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(251, 191, 36, 0.6);
}

.btn-ubicarme.loading {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    cursor: wait;
    animation: pulse 1.5s infinite;
}

.btn-ubicarme.success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Badges de Distancia */
.badge-distancia {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.badge-cerca {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.badge-media {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1f2937;
}

.badge-lejos {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

/* Botones de WhatsApp */
.btn-whatsapp-small {
    margin-top: 10px;
    width: 100%;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.5);
}

/* Imágenes de Iglesias */
.church-image-container {
    width: 100%;
    height: 140px;
    margin-bottom: 12px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.church-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.church-thumbnail:hover {
    transform: scale(1.05);
}

/* Toggle View (Mobile) */
.view-toggle {
    display: none;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px;
    border-radius: 20px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

.toggle-btn {
    flex: 1;
    max-width: 150px;
    background: rgba(116, 29, 45, 0.1);
    color: var(--primary);
    border: 2px solid transparent;
    padding: 12px 20px;
    border-radius: 15px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.toggle-btn:hover {
    background: rgba(116, 29, 45, 0.15);
}

.toggle-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border-color: var(--gold);
    box-shadow: 0 4px 15px rgba(116, 29, 45, 0.3);
}

.toggle-btn i {
    font-size: 1.1rem;
}

/* Modal personalizado */
.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border: 3px solid var(--gold);
    border-radius: 20px;
}

.modal-header {
    border-bottom: 2px solid rgba(116, 29, 45, 0.2);
    padding: 20px 25px;
}

.modal-title {
    color: var(--primary);
    font-weight: 900;
    font-size: 1.4rem;
}

.modal-body {
    padding: 25px;
}

#modalImage {
    max-height: 70vh;
    border: 2px solid rgba(116, 29, 45, 0.1);
}

/* Responsive Mobile Adjustments */
@media (max-width: 1200px) {
    .view-toggle {
        display: flex;
    }

    .map-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .btn-ubicarme {
        padding: 12px 24px;
        font-size: 0.9rem;
    }

    .toggle-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .badge-distancia {
        font-size: 0.75rem;
        padding: 5px 12px;
    }
}

/* ========== FILTROS AVANZADOS ========== */

.filters-container {
    margin-top: 15px;
}

.filters-toggle {
    width: 100%;
    background: linear-gradient(135deg, rgba(116, 29, 45, 0.08), rgba(116, 29, 45, 0.12));
    border: 2px solid rgba(116, 29, 45, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

.filters-toggle:hover {
    background: linear-gradient(135deg, rgba(116, 29, 45, 0.12), rgba(116, 29, 45, 0.18));
    border-color: var(--primary);
}

.filters-toggle.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border-color: var(--gold);
}

.filters-toggle span {
    flex: 1;
    text-align: left;
}

#filter-chevron {
    transition: transform 0.3s ease;
    font-size: 0.9rem;
}

#filter-chevron.rotate {
    transform: rotate(180deg);
}

.filters-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    margin-top: 12px;
}

.filters-panel.open {
    max-height: 600px;
}

.filter-group {
    margin-bottom: 15px;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1f2937;
    margin-bottom: 8px;
}

.filter-label i {
    color: var(--gold);
    font-size: 1rem;
}

.filter-select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(116, 29, 45, 0.05);
    border: 2px solid rgba(116, 29, 45, 0.2);
    border-radius: 10px;
    color: #1f2937;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(116, 29, 45, 0.08);
}

.filter-select:hover {
    border-color: var(--primary);
}

/* Distance Slider */
.distance-slider-container {
    background: rgba(116, 29, 45, 0.05);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid rgba(116, 29, 45, 0.1);
}

.distance-slider {
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: linear-gradient(to right,
            #10b981 0%,
            #fbbf24 50%,
            #ef4444 100%);
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 10px;
}

.distance-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.distance-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 12px rgba(116, 29, 45, 0.4);
}

.distance-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.distance-label {
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

/* Filter Actions */
.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-clear-filters,
.btn-apply-filters {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-clear-filters {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
}

.btn-clear-filters:hover {
    background: linear-gradient(135deg, #4b5563, #374151);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-apply-filters {
    background: linear-gradient(135deg, var(--gold), #f59e0b);
    color: #1f2937;
}

.btn-apply-filters:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}

/* Active Filters */
.active-filters {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-badge {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.3s ease;
}

.filter-badge i {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.filter-badge i:hover {
    transform: scale(1.3);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Results Counter */
.results-counter {
    padding: 10px 15px;
    background: rgba(116, 29, 45, 0.08);
    border-radius: 10px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
    font-size: 0.9rem;
}