/* --- RESET BÁSICO Y ESTILOS GENERALES --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background-color: #f0f2f5;
}

.container {
    display: grid;
    grid-template-columns: 220px 1fr;
    grid-template-rows: 450px 1fr;
    gap: 16px;
    height: calc(100vh - 120px); /* Ajusta según header/footer */
    padding: 16px;
    box-sizing: border-box;
    max-width: 1400px;
    margin: 0 auto;
}

header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2.2rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

footer {
    text-align: center;
    padding: 1rem;
    background-color: #2c3e50;
    color: white;
    margin-top: 2rem;
}

/* --- SIDEBAR DE FILTROS MEJORADO --- */
.filters-sidebar {
    grid-row: 1 / span 2;
    grid-column: 1 / 2;
    min-width: 220px;
    max-width: 280px;
    height: 100%;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.filters-sidebar h2 {
    font-size: 1.3rem;
    color: #2c3e50;
    margin: 0;
    padding: 1.2rem 1rem 1rem 1rem;
    border-bottom: 2px solid #e8ecf0;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.filters-sidebar h2 .icon {
    margin-right: 8px;
    font-size: 1.2em;
    color: #3498db;
}

/* Navegación vertical */
.vertical-nav {
    padding: 1rem;
    border-bottom: 2px solid #e8ecf0;
    background: #ffffff;
    flex-shrink: 0;
}

.nav-btn {
    width: 100%;
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    border: none;
    background: transparent;
    color: #6c757d;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-btn:last-child {
    margin-bottom: 0;
}

.nav-btn:hover {
    background: #f8f9fa;
    color: #495057;
    transform: translateX(4px);
}

.nav-btn.active {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
    transform: none;
}

.nav-btn.active:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f5f8b 100%);
    transform: none;
}

.nav-icon {
    font-size: 1.2em;
    min-width: 20px;
    text-align: center;
}

.nav-text {
    flex: 1;
    font-size: 0.85rem;
    line-height: 1.2;
}

/* Contenedor scrolleable para todo el contenido */
.filters-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

/* Secciones de contenido */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Mejora del scrollbar */
.filters-content::-webkit-scrollbar {
    width: 6px;
}

.filters-content::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 3px;
}

.filters-content::-webkit-scrollbar-thumb {
    background-color: #c1c8cd;
    border-radius: 3px;
}

.filters-content::-webkit-scrollbar-thumb:hover {
    background-color: #a8b2ba;
}

/* Contenedores de secciones mejorados */
.route-container,
.report-container,
.assignments-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
}

.route-container:hover,
.report-container:hover,
.assignments-container:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: #d1d9e0;
}

.route-container h3,
.report-container h3,
.assignments-container h3 {
    font-size: 1rem;
    color: #2c3e50;
    margin: 0 0 0.8rem 0;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e8ecf0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Iconos para las secciones */
.route-container h3::before {
    content: "🗺️";
    font-size: 1.1em;
}

.report-container h3::before {
    content: "📊";
    font-size: 1.1em;
}

.assignments-container h3::before {
    content: "👥";
    font-size: 1.1em;
}

/* Área de filtros mejorada */
.filters-section {
    background: #ffffff;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.filters-section-title {
    font-size: 1rem;
    color: #2c3e50;
    margin: 0 0 1rem 0;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e8ecf0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filters-section-title::before {
    content: "🔍";
    font-size: 1.1em;
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background-color: #ffffff;
    box-sizing: border-box;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    background-color: #fafbfc;
}

/* Botón de limpiar mejorado y responsive */
.btn-limpiar-container {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid #e8ecf0;
    flex-shrink: 0;
    background: #ffffff;
}

#btn-limpiar-filtros.button-secondary {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
    color: white !important;
    border: none !important;
    padding: 0.8rem 1rem !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    width: 100% !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.2) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin: 0 !important;
}

#btn-limpiar-filtros.button-secondary:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3) !important;
}

#btn-limpiar-filtros.button-secondary:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.2) !important;
}

/* Clase especial para el botón mejorado */
.btn-limpiar-completo {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
    position: relative;
    overflow: hidden;
}

.btn-limpiar-completo::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-limpiar-completo:hover::before {
    left: 100%;
}

/* Responsividad mejorada */
@media (max-width: 1200px) {
    .filters-sidebar {
        min-width: 200px;
        max-width: 240px;
    }
    
    .nav-text {
        font-size: 0.8rem;
    }
    
    .nav-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .filter-group label {
        font-size: 0.8rem;
    }
    
    .filter-group input,
    .filter-group select {
        padding: 0.5rem 0.7rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 900px) {
    .filters-sidebar {
        min-width: unset;
        max-width: unset;
        height: auto;
        max-height: 70vh;
    }
    
    .filters-content {
        max-height: calc(70vh - 80px);
    }
    
    .route-container,
    .report-container,
    .assignments-container,
    .filters-section {
        padding: 0.8rem;
    }
    
    .button-secondary {
        padding: 0.7rem 0.8rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .filters-sidebar {
        border-radius: 8px;
        max-height: 60vh;
    }
    
    .filters-sidebar h2 {
        font-size: 1.1rem;
        padding: 1rem;
    }
    
    .vertical-nav {
        padding: 0.8rem;
    }
    
    .nav-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
    }
    
    .nav-text {
        font-size: 0.75rem;
    }
    
    .filters-content {
        padding: 0.8rem;
        gap: 1rem;
        max-height: calc(60vh - 70px);
    }
    
    .route-container h3,
    .report-container h3,
    .assignments-container h3,
    .filters-section-title {
        font-size: 0.9rem;
    }
    
    .filter-group input,
    .filter-group select {
        padding: 0.6rem;
        font-size: 0.9rem;
    }
    
    .button-secondary {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
}

/* --- ÁREA DE RESULTADOS --- */
.results-area {
    grid-row: 2 / 3;
    grid-column: 2 / 3;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem;
}

#info-resumen {
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 8px;
    flex: 1;
    align-items: stretch;
}

/* --- TARJETAS DE INMUEBLES --- */
.inmueble-card {
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    scroll-margin-top: 20px;
    position: relative;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.inmueble-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.inmueble-card h3 {
    color: #2c3e50;
    margin-bottom: 1.25rem;
    font-size: 1.3rem;
    font-weight: 600;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e0e0e0;
}

.inmueble-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.inmueble-info p {
    margin: 0;
    padding: 0.5rem 0;
    font-size: 0.95rem;
    border-bottom: 1px solid #f0f0f0;
    display: grid;
    grid-template-columns: 120px 1fr;
    align-items: center;
    position: relative;
}

.inmueble-info p::after {
    content: '';
    position: absolute;
    left: 120px;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #e0e0e0;
}

.inmueble-info p strong {
    color: #2c3e50;
    font-weight: 600;
    padding-right: 1rem;
    text-align: right;
}

.inmueble-info p span {
    padding-left: 1rem;
    color: #34495e;
}

/* --- BOTONES LEGACY (MANTENIDO PARA COMPATIBILIDAD) --- */
/* Los estilos del button-secondary ahora están definidos en la sección mejorada del sidebar */

/* --- MENSAGES --- */
.placeholder-message,
.error-message {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.error-message {
    color: #dc3545;
}

/* --- RESPONSIVIDAD --- */
@media (max-width: 900px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    .filters-sidebar {
        grid-row: 1 / 2;
        grid-column: 1 / 2;
        min-width: unset;
        height: auto;
    }
    #mapid {
        grid-row: 2 / 3;
        grid-column: 1 / 2;
        min-height: 200px;
    }
    .results-area {
        grid-row: 3 / 4;
        grid-column: 1 / 2;
    }
    .cards-container {
        grid-template-columns: 1fr;
    }
}

.map-link {
    display: inline-block;
    padding: 4px 8px;
    margin: 2px;
    background-color: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.map-link:hover {
    background-color: #e0e0e0;
    text-decoration: none;
}

.leaflet-popup-content a {
    color: #0066cc;
    text-decoration: none;
    display: inline-block;
    margin: 4px 0;
}

.leaflet-popup-content a:hover {
    text-decoration: underline;
}

.phone-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.phone-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Estilo específico para dispositivos móviles */
@media (hover: none) {
    .phone-link {
        color: #2ecc71;
        text-decoration: underline;
    }
    
    .phone-link:active {
        color: #27ae60;
    }
}

#mapid {
    grid-row: 1 / 2;
    grid-column: 2 / 3;
    min-height: 300px;
    width: 100%;
    border-radius: 8px;
    border: 1px solid #aaa;
    background: #eaeaea;
    touch-action: manipulation; /* Mejor comportamiento táctil en iPad */
    z-index: 1; /* Asegurar que el mapa se muestre correctamente */
}

/* Estilos para la ventana modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 1200px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
}

.modal-close {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
}

.modal-close:hover {
    color: #000;
}

/* Estilos para las pestañas */
.modal-tabs {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.tab-button {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background-color: #f0f0f0;
}

.tab-button.active {
    background-color: #007bff;
    color: white;
}

/* Estilos para el contenido de las pestañas */
.tab-content {
    margin-top: 20px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Estilos para la tabla de partidas */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.data-table tr:hover {
    background-color: #f5f5f5;
}

/* Estilos para la galería de fotos */
.galeria-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* Estilos para las gráficas */
.graficas-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.grafica {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    min-height: 300px;
    height: 400px; /* Altura fija para las gráficas */
    position: relative; /* Importante para Chart.js */
    margin-bottom: 20px;
}

/* Ajuste responsivo para las gráficas */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }

    .modal-tabs {
        flex-direction: column;
        gap: 5px;
    }

    .tab-button {
        width: 100%;
        text-align: left;
    }

    .data-table {
        display: block;
        overflow-x: auto;
    }

    .graficas-container {
        grid-template-columns: 1fr;
    }
    
    .grafica {
        height: 300px; /* Altura más pequeña en móviles */
    }
}

/* Estilos para el botón de avance */
.button-avance {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.button-avance:hover {
    background-color: #218838;
}

.button-avance:active {
    background-color: #1e7e34;
}

/* Ajuste para el enlace de avance en el popup del mapa */
.leaflet-popup-content a:last-child {
    color: #28a745;
    font-weight: 500;
}

.leaflet-popup-content a:last-child:hover {
    color: #218838;
    text-decoration: underline;
}

/* Estilos para la modal de configuración de reporte */
.modal-config {
    max-width: 600px;
    width: 90%;
}

.config-form {
    margin-top: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group input:invalid,
.form-group textarea:invalid {
    border-color: #e74c3c;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.char-counter {
    display: block;
    text-align: right;
    color: #7f8c8d;
    font-size: 12px;
    margin-top: 4px;
}

.char-counter.warning {
    color: #f39c12;
}

.char-counter.danger {
    color: #e74c3c;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e1e8ed;
}

.button-primary {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.button-primary:hover {
    background-color: #229954;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

.button-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.3);
}

.button-primary:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Ajustes responsivos para la modal de configuración */
@media (max-width: 768px) {
    .modal-config {
        width: 95%;
        margin: 5% auto;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions button {
        width: 100%;
    }
}

/* Estilos para el contenedor de rutas - MOVIDO A SECCIÓN MEJORADA DEL SIDEBAR */

/* Estilos para la lista de escuelas seleccionadas */
.selected-schools-list {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 1rem;
    max-height: 150px;
    overflow-y: auto;
    /* Mejora del scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #3498db #f0f0f0;
}

/* Estilo para scrollbar en Chrome/Safari */
.selected-schools-list::-webkit-scrollbar {
    width: 8px;
}

.selected-schools-list::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.selected-schools-list::-webkit-scrollbar-thumb {
    background-color: #3498db;
    border-radius: 4px;
}

/* Mejora de los elementos de la lista */
.selected-school-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    margin-bottom: 6px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #3498db;
    transition: background-color 0.2s ease;
    position: relative; /* Para posicionamiento correcto del botón */
}

.selected-school-item:hover {
    background-color: #eef5fd;
}

.selected-school-item:last-child {
    margin-bottom: 0;
}

/* Mejora del nombre de la escuela */
.selected-school-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #2c3e50;
    /* Añadir truncamiento con elipsis para nombres largos */
    max-width: calc(100% - 35px); /* Espacio para el botón */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mejora del botón para eliminar escuela */
.remove-school-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    min-width: 24px; /* Asegura tamaño mínimo */
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-left: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.remove-school-btn:hover {
    background-color: #c0392b;
    transform: scale(1.1);
}

.remove-school-btn:active {
    transform: scale(0.95);
}

/* Mensaje cuando no hay escuelas */
.empty-route-message {
    color: #95a5a6;
    text-align: center;
    font-size: 0.9rem;
    font-style: italic;
    padding: 0.8rem 0.5rem;
}

/* Mejora del botón de generar ruta */
.button-route {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

.button-route:hover {
    background-color: #27ae60;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.button-route:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.button-route:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Estilo para el botón de añadir a ruta en las tarjetas */
.add-to-route-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin-top: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.add-to-route-btn:hover {
    background-color: #2980b9;
}

.add-to-route-btn.selected {
    background-color: #e74c3c;
}

.add-to-route-btn.selected:hover {
    background-color: #c0392b;
}

/* Estilos para el botón de ruta en los popups del mapa */
.leaflet-popup-content .add-to-route-btn-map {
    display: block;
    width: 100%;
    margin: 8px 0;
    padding: 8px 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    transition: background-color 0.2s ease;
}

.leaflet-popup-content .add-to-route-btn-map:hover {
    background-color: #2980b9;
}

.leaflet-popup-content .add-to-route-btn-map.selected {
    background-color: #e74c3c;
}

.leaflet-popup-content .add-to-route-btn-map.selected:hover {
    background-color: #c0392b;
}

.leaflet-popup-content a:hover {
    text-decoration: underline;
}

#tabla-fotos td {
    padding: 20px;  /* 3 veces más espacio que el normal */
    vertical-align: top;
}

#tabla-fotos td:last-child {
    min-width: 300px;  /* Ancho mínimo para la columna de fotos */
}

#tabla-fotos img {
    max-width: 100%;
    height: auto;
    margin: 5px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* --- ESTILOS PARA SISTEMA DE REPORTES - MOVIDO A SECCIÓN MEJORADA DEL SIDEBAR --- */

.button-report {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin-top: 0.8rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.2);
}

.button-report:hover:not(:disabled) {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.button-report:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.2);
}

.button-report:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.icon-pdf {
    font-size: 1.1em;
    margin-right: 4px;
}

.empty-report-message {
    color: #7f8c8d;
    font-style: italic;
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
}

/* --- BOTÓN "AGREGAR A REPORTE" --- */
.add-to-report-btn {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    margin: 4px;
    transition: all 0.2s ease;
    display: inline-block;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.add-to-report-btn:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(243, 156, 18, 0.3);
}

.add-to-report-btn.selected {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.3);
}

.add-to-report-btn.selected:hover {
    background: linear-gradient(135deg, #2ecc71 0%, #58d68d 100%);
}

.add-to-report-btn.selected::before {
    content: "✓ ";
    font-weight: bold;
}

/* Botones en el popup del mapa */
.leaflet-popup-content .add-to-report-btn-map {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    text-decoration: none;
    display: inline-block;
    margin: 2px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.leaflet-popup-content .add-to-report-btn-map:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    color: white;
    text-decoration: none;
}

.leaflet-popup-content .add-to-report-btn-map.selected {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

.leaflet-popup-content .add-to-report-btn-map.selected:hover {
    background: linear-gradient(135deg, #2ecc71 0%, #58d68d 100%);
}

/* Contador de reportes */
#report-count {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 0.9em;
}

/* Indicador visual en marcadores seleccionados para reporte */
.leaflet-marker-icon.report-selected {
    filter: hue-rotate(40deg) saturate(1.5) brightness(1.2);
}

/* Estilos responsivos para reportes */
@media (max-width: 768px) {
    .report-container {
        padding: 0.8rem;
        margin-bottom: 1rem;
    }
    
    .button-report {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }
    
    .add-to-report-btn {
        font-size: 11px;
        padding: 5px 10px;
    }
}

/* Animación para el contador cuando cambia */
@keyframes counterUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.counter-updated {
    animation: counterUpdate 0.3s ease;
}

/* NUEVO: Estilos para el selector de municipio en reportes */
.municipio-select {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 2px solid #e0e6ed;
    border-radius: 6px;
    background-color: white;
    font-size: 14px;
    color: #2c3e50;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.municipio-select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.municipio-select:hover {
    border-color: #bdc3c7;
}

/* Estilos mejorados para los contenedores de reporte */
.report-container h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-container h3::before {
    content: "📊";
    font-size: 1.2em;
}

/* Estilos responsivos para los nuevos elementos */
@media (max-width: 768px) {
    .municipio-select {
        padding: 8px;
        font-size: 13px;
    }
    
    .report-container {
        padding: 0.8rem;
        margin-bottom: 1rem;
    }
}

/* NUEVO: Media queries específicas para iPad */
@media (max-width: 1024px) and (orientation: landscape) {
    /* iPad en modo horizontal */
    .container {
        grid-template-columns: 300px 1fr;
        grid-template-rows: 400px 1fr;
        gap: 12px;
        padding: 12px;
    }
    
    .cards-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .inmueble-card {
        min-height: 380px;
        font-size: 0.9rem;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 1024px) and (orientation: portrait) {
    /* iPad en modo vertical */
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 300px 1fr;
        gap: 12px;
        padding: 12px;
    }
    
    .filters-sidebar {
        grid-row: 1 / 2;
        grid-column: 1 / 2;
        height: auto;
        max-height: 400px;
        overflow-y: auto;
    }
    
    #mapid {
        grid-row: 2 / 3;
        grid-column: 1 / 2;
        min-height: 300px;
    }
    
    .results-area {
        grid-row: 3 / 4;
        grid-column: 1 / 2;
    }
    
    .cards-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    header h1 {
        font-size: 1.6rem;
    }
}

/* Estilos para mejorar experiencia táctil en iPad/iOS */
@media (pointer: coarse) {
    /* Dispositivos táctiles como iPad */
    .button-secondary,
    .button-route,
    .button-report,
    .add-to-route-btn,
    .add-to-report-btn,
    .button-avance {
        min-height: 44px; /* Tamaño mínimo recomendado por Apple */
        padding: 12px 16px;
        font-size: 16px; /* Evita zoom automático en iOS */
    }
    
    .filter-group input,
    .filter-group select,
    .municipio-select {
        min-height: 44px;
        font-size: 16px; /* Evita zoom automático en iOS */
        padding: 12px;
    }
    
    /* Mejor experiencia táctil para tarjetas */
    .inmueble-card {
        padding: 16px;
        margin-bottom: 8px;
    }
    
    /* Botones más grandes en modales para iPad */
    .modal-close {
        width: 44px;
        height: 44px;
        font-size: 24px;
        line-height: 44px;
    }
    
    .tab-button {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 16px;
    }
}

/* Corrección específica para Safari en iOS */
input, select, textarea, button {
    -webkit-appearance: none;
    appearance: none; /* Propiedad estándar para compatibilidad */
    -webkit-border-radius: 0;
    border-radius: 8px;
}

/* Evitar zoom en inputs en iOS */
input[type="text"],
input[type="search"],
select {
    font-size: 16px !important;
}

/* Mejor scrolling en iOS */
.filters-sidebar,
.selected-schools-list,
.results-area {
    -webkit-overflow-scrolling: touch;
}

/* Corrección para 100vh en iOS Safari */
.container {
    height: calc(100vh - 120px);
    height: calc(100dvh - 120px); /* Soporte para navegadores modernos */
}

/* Mejoras específicas para Leaflet en iPad */
.leaflet-container {
    -webkit-tap-highlight-color: transparent; /* Eliminar highlight táctil en iOS */
}

.leaflet-control {
    -webkit-tap-highlight-color: transparent;
}

.leaflet-popup-content {
    max-width: 300px !important; /* Asegurar que popups se vean bien en iPad */
}

/* Mejorar botones del mapa en iPad */
.leaflet-bar a {
    line-height: 44px !important;
    width: 44px !important;
    height: 44px !important;
    font-size: 18px !important;
}

/* --- ESTILOS MEJORADOS PARA POPUP --- */

/* Contenedor principal del popup */
.popup-container {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    max-width: 350px;
    line-height: 1.4;
}

/* Header del popup */
.popup-header {
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e8ecf0;
}

.popup-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.popup-cct {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.popup-label {
    font-weight: 600;
    color: #7f8c8d;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.popup-value {
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.popup-location {
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
    margin-top: 4px;
}

/* Sección de asignaciones mejorada */
.popup-assignments {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.popup-assignments-title {
    font-weight: 600;
    color: #8e44ad;
    margin-bottom: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.popup-assignments-content {
    font-size: 12px;
    color: #2c3e50;
    line-height: 1.4;
    margin-bottom: 6px;
}

.popup-assignments-content strong {
    color: #495057;
    font-weight: 600;
}

.popup-assignments-source {
    font-size: 10px;
    color: #7f8c8d;
    font-style: italic;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #e9ecef;
}

/* Acciones del popup */
.popup-actions {
    margin-top: 15px;
}

.popup-navigation {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.popup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 6px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
    border: 1px solid;
    gap: 4px;
    min-height: 36px;
    line-height: 1.2;
}

.popup-btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border-color: #2980b9;
}

.popup-btn-primary:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f5f8b 100%);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.popup-btn-secondary {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
    border-color: #7f8c8d;
}

.popup-btn-secondary:hover {
    background: linear-gradient(135deg, #7f8c8d 0%, #6c7b7d 100%);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.popup-btn-info {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    color: white;
    border-color: #d35400;
}

.popup-btn-info:hover {
    background: linear-gradient(135deg, #d35400 0%, #ba4a00 100%);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Controles del popup */
.popup-controls {
    margin-top: 12px;
}

.popup-button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

/* Botones mejorados para el popup */
.add-to-route-btn-map,
.add-to-report-btn-map {
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    min-height: 36px !important;
    transition: all 0.2s ease !important;
    border: 1px solid !important;
    cursor: pointer !important;
}

.add-to-route-btn-map {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%) !important;
    color: white !important;
    border-color: #27ae60 !important;
}

.add-to-route-btn-map:hover {
    background: linear-gradient(135deg, #2ecc71 0%, #58d68d 100%) !important;
    transform: translateY(-1px) !important;
}

.add-to-route-btn-map.selected {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
    border-color: #c0392b !important;
}

.add-to-route-btn-map.selected:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%) !important;
}

.add-to-report-btn-map {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%) !important;
    color: white !important;
    border-color: #f39c12 !important;
}

.add-to-report-btn-map:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%) !important;
    transform: translateY(-1px) !important;
}

.add-to-report-btn-map.selected {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%) !important;
    border-color: #27ae60 !important;
}

.add-to-report-btn-map.selected:hover {
    background: linear-gradient(135deg, #2ecc71 0%, #58d68d 100%) !important;
}

/* Botón de asignación rápida mejorado */
.btn-quick-assign {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%) !important;
    color: white !important;
    border: 1px solid #8e44ad !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    margin-bottom: 8px !important;
    transition: all 0.2s ease !important;
    min-height: 36px !important;
    width: 100% !important;
}

.btn-quick-assign:hover {
    background: linear-gradient(135deg, #8e44ad 0%, #7d3c98 100%) !important;
    color: white !important;
    text-decoration: none !important;
    transform: translateY(-1px) !important;
}

/* Contenedor de acciones de asignaciones */
.popup-assignments-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 8px;
}

/* Botón editar asignación */
.btn-edit-assignment {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%) !important;
    color: white !important;
    border: 1px solid #2980b9 !important;
    padding: 6px 10px !important;
    border-radius: 4px !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    min-height: 32px !important;
}

.btn-edit-assignment:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f5f8b 100%) !important;
    transform: translateY(-1px) !important;
}

/* Botón eliminar asignación */
.btn-remove-assignment {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
    color: white !important;
    border: 1px solid #c0392b !important;
    padding: 6px 10px !important;
    border-radius: 4px !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    min-height: 32px !important;
}

.btn-remove-assignment:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%) !important;
    transform: translateY(-1px) !important;
}

/* Indicador de desplazamiento */
.popup-container small {
    display: block;
    margin-top: 12px;
    padding: 6px 8px;
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-radius: 4px;
    font-size: 10px;
    text-align: center;
}

/* Ajustes responsivos para el popup */
@media (max-width: 1024px) {
    .leaflet-popup-content {
        max-width: 280px !important;
        font-size: 14px;
    }
    
    .popup-container {
        max-width: 100%;
    }
    
    .popup-navigation {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    
    .popup-btn {
        padding: 10px 8px;
        font-size: 12px;
        min-height: 40px;
    }
    
    .popup-button-group {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .add-to-route-btn-map,
    .add-to-report-btn-map {
        padding: 10px 12px !important;
        font-size: 12px !important;
        min-height: 40px !important;
    }
    
    .popup-assignments-actions {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    
    .btn-edit-assignment,
    .btn-remove-assignment {
        font-size: 11px !important;
        padding: 8px 10px !important;
        min-height: 36px !important;
    }
}

@media (max-width: 768px) {
    .leaflet-popup-content {
        max-width: 260px !important;
    }
    
    .popup-title {
        font-size: 14px;
    }
    
    .popup-btn {
        font-size: 11px;
        padding: 8px 6px;
    }
}

/* --- ESTILOS PARA SELECCIÓN RECTANGULAR --- */

/* Mejorar la apariencia de los controles de dibujo */
.leaflet-draw-toolbar {
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border: 1px solid #ddd !important;
}

.leaflet-draw-toolbar a {
    background-color: transparent !important;
    border: none !important;
    border-radius: 6px !important;
    margin: 2px !important;
    transition: all 0.2s ease !important;
}

.leaflet-draw-toolbar a:hover {
    background-color: #f0f0f0 !important;
    transform: scale(1.05) !important;
}

.leaflet-draw-toolbar a.leaflet-draw-draw-rectangle {
    background-image: none !important;
    position: relative !important;
}

.leaflet-draw-toolbar a.leaflet-draw-draw-rectangle::before {
    content: "🎯";
    font-size: 16px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Tooltip personalizado para el control de rectángulo */
.leaflet-draw-tooltip {
    background: rgba(44, 62, 80, 0.9) !important;
    color: white !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    border: none !important;
}

.leaflet-draw-tooltip::before {
    border-top-color: rgba(44, 62, 80, 0.9) !important;
}

/* Estilo para el rectángulo de selección */
.leaflet-interactive {
    cursor: crosshair !important;
}

/* Animación para marcadores resaltados */
@keyframes markerHighlight {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1.2); }
}

.marker-highlighted {
    animation: markerHighlight 0.5s ease !important;
}

/* Estilos responsivos para controles de dibujo */
@media (max-width: 768px) {
    .leaflet-draw-toolbar {
        transform: scale(1.2) !important;
        transform-origin: top right !important;
    }
    
    .leaflet-draw-toolbar a {
        width: 40px !important;
        height: 40px !important;
    }
    
    .leaflet-draw-toolbar a.leaflet-draw-draw-rectangle::before {
        font-size: 18px;
    }
}

/* Mejorar visibilidad en dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
    .leaflet-draw-toolbar a {
        min-width: 44px !important;
        min-height: 44px !important;
    }
}

/* --- ESTILOS PARA SISTEMA DE ASIGNACIONES --- */

/* NOTA: Los estilos básicos del assignments-container están definidos en la sección mejorada del sidebar */
/* Aquí solo agregamos estilos específicos adicionales */

/* Estilos específicos para el contenido de asignaciones */
.assignments-container .assignments-info {
    text-align: center;
    margin-bottom: 1rem;
}

.assignments-container .assignments-info p {
    margin: 0;
    font-size: 0.95rem;
    color: #2c3e50;
}

.assignments-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: space-between;
}

.button-assignment {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
    flex: 1;
    min-width: 60px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.button-assignment:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f5f8b 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.button-assignment.danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.button-assignment.danger:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
}

/* Contador de asignaciones */
#assignments-counter {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 1.1em;
}

/* Checkbox personalizado para guardar asignaciones */
.checkbox-group {
    margin: 1rem 0;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1.4;
    gap: 0.5rem;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    background-color: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    position: relative;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background-color: #28a745;
    border-color: #28a745;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.checkbox-help {
    display: block;
    color: #6c757d;
    font-size: 0.85rem;
    margin-top: 0.3rem;
    margin-left: 25px;
    line-height: 1.3;
}

/* Modal de asignación rápida */
.modal-assignment {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
}

.modal-assignment-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 25px;
    border: none;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
}

.modal-assignment h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 1.3rem;
    text-align: center;
    border-bottom: 2px solid #e0e6ed;
    padding-bottom: 10px;
}

.assignment-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.assignment-form .form-group {
    display: flex;
    flex-direction: column;
}

.assignment-form label {
    font-weight: 600;
    color: #34495e;
    margin-bottom: 5px;
}

.assignment-form input {
    padding: 10px;
    border: 2px solid #e0e6ed;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.assignment-form input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.assignment-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-assignment-save {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-assignment-save:hover {
    background: linear-gradient(135deg, #2ecc71, #58d68d);
    transform: translateY(-1px);
}

.btn-assignment-cancel {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-assignment-cancel:hover {
    background: #7f8c8d;
}

/* Botón de asignación rápida en popups */
.btn-quick-assign {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    text-decoration: none;
    display: inline-block;
    margin: 2px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-quick-assign:hover {
    background: linear-gradient(135deg, #8e44ad, #7d3c98);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Sección de responsables en popup */
.popup-assignments {
    background: rgba(155, 89, 182, 0.1);
    border: 1px solid rgba(155, 89, 182, 0.3);
    border-radius: 6px;
    padding: 8px;
    margin: 8px 0;
}

.popup-assignments-title {
    font-weight: bold;
    color: #8e44ad;
    margin-bottom: 4px;
    font-size: 13px;
}

.popup-assignments-content {
    font-size: 12px;
    color: #2c3e50;
    line-height: 1.3;
}

.popup-assignments-source {
    font-size: 10px;
    color: #7f8c8d;
    font-style: italic;
    margin-top: 2px;
}

/* Indicadores visuales para marcadores con asignaciones */
.leaflet-marker-icon.marker-assigned {
    filter: hue-rotate(270deg) saturate(1.3) brightness(1.1);
}

.leaflet-marker-icon.marker-unassigned {
    filter: grayscale(0.3) brightness(0.9);
}

/* Estilos responsivos para asignaciones */
@media (max-width: 768px) {
    .assignments-container {
        padding: 0.8rem;
        margin-bottom: 1rem;
    }
    
    .assignments-actions {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .button-assignment {
        padding: 0.6rem;
        font-size: 0.8rem;
        min-width: unset;
        flex: none;
    }
    
    .modal-assignment-content {
        margin: 5% auto;
        padding: 20px;
        width: 95%;
    }
    
    .assignment-actions {
        flex-direction: column;
    }
    
    .checkbox-label {
        font-size: 0.9rem;
    }
    
    .checkbox-help {
        font-size: 0.8rem;
    }
    
    /* Asegurar que el botón limpiar se vea bien en móviles */
    #btn-limpiar-filtros.button-secondary {
        padding: 0.7rem 0.8rem !important;
        font-size: 0.85rem !important;
    }
}

/* Estilos para el botón de eliminar asignación */
.btn-remove-assignment {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    text-decoration: none;
    display: inline-block;
    margin: 4px 0 0 0;
    transition: all 0.2s ease;
    font-weight: 500;
    width: 100%;
}

.btn-remove-assignment:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Estilos para marcadores seleccionados */
.marker-selected .marker-pin {
    background-color: #e74c3c;
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

.marker-selected .marker-pin::after {
    background-color: #e74c3c;
}

.marker-active .marker-pin {
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

/* Animación para marcadores seleccionados */
@keyframes markerSelected {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1.2); }
}

.marker-selected {
    animation: markerSelected 0.3s ease-out forwards;
}

/* Estilos para el popup de selección múltiple */
.popup-content {
    padding: 10px;
    min-width: 200px;
}

.popup-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #2c3e50;
}

.popup-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.popup-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background-color: #3498db;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.popup-btn:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.popup-btn.selected {
    background-color: #e74c3c;
}

/* Sistema de selección múltiple mejorado */
.multi-select-control {
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.multi-select-control a {
    display: block;
    width: 32px;
    height: 32px;
    text-align: center;
    transition: all 0.3s ease;
}

.multi-select-control a.active {
    background: #3498db !important;
    color: white !important;
}

.marker-multi-selected {
    filter: hue-rotate(200deg) saturate(1.5) brightness(1.2) !important;
    box-shadow: 0 0 0 3px #3498db, 0 0 0 5px rgba(52, 152, 219, 0.3) !important;
    border-radius: 50%;
    z-index: 1000 !important;
}

.selection-floating-bar {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    padding: 15px 25px;
    display: none;
    align-items: center;
    gap: 20px;
    z-index: 10000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.selection-counter {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.selection-count {
    color: #3498db;
    font-size: 18px;
    font-weight: 700;
}

.selection-actions {
    display: flex;
    gap: 10px;
}

.selection-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.selection-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.selection-btn:active {
    transform: translateY(0);
}

.selection-btn#add-selected-to-route {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.selection-btn#add-selected-to-route:hover {
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.selection-btn#add-selected-to-report {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.selection-btn#add-selected-to-report:hover {
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.selection-btn#clear-selection {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.selection-btn#clear-selection:hover {
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* Cursor crosshair cuando está en modo selección */
#mapid.multi-select-mode {
    cursor: crosshair !important;
}

/* Animación de selección */
@keyframes selectPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Responsividad */
@media (max-width: 768px) {
    .selection-floating-bar {
        bottom: 20px;
        padding: 12px 20px;
        flex-direction: column;
        gap: 15px;
        width: 90%;
        max-width: 350px;
    }
    
    .selection-counter {
        font-size: 14px;
    }
    
    .selection-actions {
        width: 100%;
        justify-content: space-around;
    }
    
    .selection-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
}