/**
 * ============================================================================
 * ESTILOS PARA SISTEMA DUAL DE DIBUJO v2.1 - SINCRONIZACIÓN MEJORADA
 * ============================================================================
 * Diseño moderno, responsivo y accesible
 * Incluye mejoras para evitar superposición de controles
 */

:root {
    /* Colores principales */
    --roi-color: #e74c3c;
    --roi-color-light: #f8d7da;
    --roi-color-dark: #c0392b;
    
    --marker-color: #3498db;
    --marker-color-light: #d6eaf8;
    --marker-color-dark: #2980b9;
    
    /* Colores de estado */
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --error-color: #e74c3c;
    --info-color: #3498db;
    
    /* Neutrales */
    --bg-color: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-color: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: #dee2e6;
    
    /* Sombras */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
    
    /* Espaciado */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    
    /* Transiciones */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
}

/* =========================================================================
   MEJORAS PARA EVITAR SUPERPOSICIÓN DE CONTROLES
   ========================================================================= */

/* Contenedor del mapa con mejores z-index */
#map .leaflet-control-container .leaflet-top.leaflet-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 55px; /* Espacio para el header del mapa */
}

#map .leaflet-control-container .leaflet-top.leaflet-right,
#satelliteMap .leaflet-control-container .leaflet-top.leaflet-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 55px; /* Espacio para el header del mapa */
}

/* Evitar que los controles de dibujo se superpongan con el header */
.leaflet-draw.leaflet-control {
    margin-top: 10px !important;
}

/* Quitar borde del contenedor de toolbar de dibujo */
.leaflet-draw-toolbar.leaflet-bar {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* Quitar borde del control de zoom */
.leaflet-control-zoom.leaflet-bar.leaflet-control {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* Badges de sincronización */
.sync-indicator {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.9) 0%, rgba(30, 91, 79, 0.9) 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.4);
    animation: syncPulse 2s infinite;
}

.sync-indicator.disabled {
    background: linear-gradient(135deg, rgba(149, 165, 166, 0.9) 0%, rgba(127, 140, 141, 0.9) 100%);
    box-shadow: 0 2px 8px rgba(149, 165, 166, 0.4);
    animation: none;
}

@keyframes syncPulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(39, 174, 96, 0.4); }
    50% { box-shadow: 0 2px 16px rgba(39, 174, 96, 0.8); }
}

/* =========================================================================
   ESTILOS PARA MODAL DE PROPIEDADES MEJORADO
   ========================================================================= */

/* Range sliders personalizados */
.form-range {
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    outline: none;
    cursor: pointer;
}

.form-range::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #1e5b4f, #4ade80);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(30, 91, 79, 0.4);
    border: 2px solid rgba(255,255,255,0.2);
}

.form-range::-webkit-slider-thumb:hover {
    background: linear-gradient(135deg, #4ade80, #1e5b4f);
    box-shadow: 0 4px 12px rgba(74, 222, 128, 0.6);
    transform: scale(1.1);
}

.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #1e5b4f, #4ade80);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(30, 91, 79, 0.4);
    border: 2px solid rgba(255,255,255,0.2);
}

.form-range::-moz-range-thumb:hover {
    background: linear-gradient(135deg, #4ade80, #1e5b4f);
    box-shadow: 0 4px 12px rgba(74, 222, 128, 0.6);
    transform: scale(1.1);
}

/* Color pickers mejorados */
.form-control-color {
    cursor: pointer;
    border: 2px solid rgba(30, 91, 79, 0.4);
    transition: all 0.3s ease;
}

.form-control-color:hover {
    border-color: #4ade80;
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.4);
    transform: scale(1.05);
}

/* Form switch mejorado */
.form-check-input {
    cursor: pointer;
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(30, 91, 79, 0.4);
}

.form-check-input:checked {
    background-color: #1e5b4f;
    border-color: #4ade80;
}

.form-check-input:focus {
    border-color: #4ade80;
    box-shadow: 0 0 0 0.25rem rgba(30, 91, 79, 0.25);
}

/* Inputs hex personalizados */
input[type="text"][id*="Hex"] {
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Custom marker icons */
.custom-marker-icon {
    background: none;
    border: none;
}

.custom-marker-icon div {
    transition: all 0.3s ease;
}

.custom-marker-icon:hover div {
    transform: scale(1.2);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* Scrollbar para modal */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.8);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #1e5b4f, #4ade80);
    border-radius: 4px;
    border: 1px solid rgba(30, 91, 79, 0.3);
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #4ade80, #1e5b4f);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
}

/* =========================================================================
   TÍTULOS DE TOOLBARS - VERSIÓN COMPACTA
   ========================================================================= */

.drawing-toolbar-title {
    background: var(--bg-color);
    border-radius: 4px 4px 0 0;
    padding: 4px 8px;
    margin-bottom: 2px;
    box-shadow: var(--shadow-sm);
    border: 2px solid;
}

.roi-toolbar-title {
    border-color: var(--roi-color);
    background: linear-gradient(135deg, var(--roi-color-light) 0%, var(--bg-color) 100%);
}

.roi-toolbar-title .toolbar-title-content {
    color: #8b1e1e;
}

.marker-toolbar-title {
    border-color: var(--marker-color);
    background: linear-gradient(135deg, var(--marker-color-light) 0%, var(--bg-color) 100%);
}

.marker-toolbar-title .toolbar-title-content {
    color: #1a4d7a;
}

.toolbar-title-content {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    color: #1a252f;
    font-size: 11px;
}

.toolbar-icon {
    font-size: 14px;
}

.toolbar-text {
    flex: 1;
}

/* =========================================================================
   PANELES DE INFORMACIÓN - VERSIÓN COMPACTA
   ========================================================================= */

.info-panel {
    background: var(--bg-color);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    min-width: 180px;
    max-width: 220px;
    margin: 4px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    transition: all var(--transition-normal);
}

.info-panel.compact {
    min-width: 160px;
    max-width: 200px;
}

.info-panel:hover {
    box-shadow: var(--shadow-lg);
}

.info-panel-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    font-weight: 700;
    color: #1a252f;
    font-size: 11px;
    border-bottom: 2px solid var(--border-color);
}

.roi-info-panel .info-panel-header {
    background: linear-gradient(135deg, var(--roi-color-light) 0%, var(--bg-color) 100%);
    border-bottom-color: var(--roi-color);
    color: #8b1e1e;
}

.marker-info-panel .info-panel-header {
    background: linear-gradient(135deg, var(--profepa-verde-claro, rgba(30, 91, 79, 0.2)) 0%, rgba(0, 0, 0, 0.8) 100%);
    border-bottom: 2px solid var(--profepa-verde, #1e5b4f);
    color: var(--profepa-verde-claro, #4ade80);
    box-shadow: 0 2px 8px rgba(30, 91, 79, 0.3);
}

.info-panel-icon {
    font-size: 14px;
}

.marker-count {
    margin-left: auto;
    background: linear-gradient(135deg, var(--profepa-verde, #1e5b4f) 0%, var(--profepa-verde-claro, #4ade80) 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(30, 91, 79, 0.4);
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.info-panel-content {
    padding: 8px;
    font-size: 11px;
    max-height: 200px; /* Reducido de 300px */
    overflow-y: auto;
    color: #e2e8f0;
    /* Agregar borde sutil con colores PROFEPA */
    border: 1px solid rgba(30, 91, 79, 0.3);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(30, 41, 59, 0.6) 100%);
    backdrop-filter: blur(8px);
}

.compact .info-panel-content {
    padding: 6px;
    font-size: 10px;
    color: #2c3e50;
    max-height: 150px; /* Altura aún más limitada para versión compacta */
}

/* Scrollbar personalizado */
.info-panel-content::-webkit-scrollbar {
    width: 6px;
}

.info-panel-content::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.8);
    border-radius: 3px;
}

.info-panel-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--profepa-verde, #1e5b4f) 0%, var(--profepa-verde-claro, #4ade80) 100%);
    border-radius: 3px;
    border: 1px solid rgba(30, 91, 79, 0.3);
}

.info-panel-content::-webkit-scrollbar-thumb:hover {
    background: var(--profepa-verde-claro, #4ade80);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
}

/* =========================================================================
   TABLAS DE INFORMACIÓN - VERSIÓN COMPACTA
   ========================================================================= */

.info-table,
.roi-popup-table,
.marker-popup-table {
    width: 100%;
    font-size: 11px;
    border-collapse: collapse;
    color: #2c3e50;
}

.compact-table {
    font-size: 10px;
    color: #2c3e50;
}

.info-table strong,
.roi-popup-table strong,
.marker-popup-table strong {
    color: #1a252f;
    font-weight: 700;
}

.info-table td,
.roi-popup-table td,
.marker-popup-table td {
    padding: 2px 0;
    border-bottom: 1px solid var(--bg-secondary);
}

.info-table tr:last-child td,
.roi-popup-table tr:last-child td,
.marker-popup-table tr:last-child td {
    border-bottom: none;
}

.text-right {
    text-align: right;
    color : var(--text -color);
}

.text-muted {
    color: #5a6c7d;
    font-size: 12px;
}

.text-center {
    text-align: center;
}

/* =========================================================================
   ESTADO DEL PANEL - VERSIÓN COMPACTA
   ========================================================================= */

.info-panel-status {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-color);
}

.status-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 600;
}

.status-ready {
    background: var(--success-color);
    color: white;
}

.status-warning {
    background: var(--warning-color);
    color: white;
}

.status-error {
    background: var(--error-color);
    color: white;
}

/* =========================================================================
   PANEL COLAPSABLE MEJORADO
   ========================================================================= */

.info-panel.collapsible {
    max-height: 60px; /* Altura mínima cuando colapsado */
    transition: max-height 0.3s ease;
    overflow: hidden;
}

.info-panel.collapsible.expanded {
    max-height: 500px; /* Altura máxima cuando expandido */
}

.info-panel-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.info-panel-toggle:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
    transform: scale(1.1);
}

.info-panel-toggle i {
    font-size: 12px;
    color: #94a3b8;
    transition: transform 0.2s ease;
}

.info-panel.collapsible .info-panel-toggle i {
    transform: rotate(0deg);
}

.info-panel.collapsible.expanded .info-panel-toggle i {
    transform: rotate(180deg);
}

/* Ocultar contenido cuando está colapsado */
.info-panel.collapsible:not(.expanded) .info-panel-content,
.info-panel.collapsible:not(.expanded) .export-section {
    display: none;
}

/* Mejorar el header cuando es colapsable */
.info-panel.collapsible .info-panel-header {
    position: relative;
    cursor: pointer;
    padding-right: 40px; /* Espacio para el botón toggle */
}

.info-panel.collapsible .info-panel-header:hover {
    background: linear-gradient(135deg, rgba(30, 91, 79, 0.4) 0%, rgba(74, 222, 128, 0.1) 100%);
}

/* ROI panel collapsible: use red tones on hover */
.roi-info-panel.collapsible .info-panel-header:hover {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.25) 0%, rgba(192, 57, 43, 0.1) 100%);
}

.roi-info-panel .info-panel-toggle:hover {
    background: rgba(231, 76, 60, 0.3);
    border-color: rgba(231, 76, 60, 0.5);
}

.marker-list-items {
    display: flex;
    flex-direction: column;
    gap: 3px; /* Reducido de 4px */
}

.marker-list-item {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.4) 100%);
    border-radius: 6px;
    padding: 4px 6px;
    border-left: 3px solid var(--profepa-verde, #1e5b4f);
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid rgba(30, 91, 79, 0.2);
}

.marker-list-item:hover {
    background: linear-gradient(135deg, rgba(30, 91, 79, 0.3) 0%, rgba(74, 222, 128, 0.1) 100%);
    transform: translateX(2px);
    box-shadow: 0 4px 12px rgba(30, 91, 79, 0.4);
    border-color: var(--profepa-verde-claro, #4ade80);
}

.marker-item-header {
    display: flex;
    align-items: center;
    gap: 3px; /* Reducido gap */
    margin-bottom: 1px; /* Reducido margen */
}

.marker-item-icon {
    font-size: 10px; /* Reducido */
}

.marker-item-header strong {
    font-size: 9px; /* Reducido */
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60px; /* Más corto para hacer espacio al ID */
    flex: 1;
}

.marker-item-id {
    font-size: 7px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 3px;
    border-radius: 8px;
    margin-left: auto;
    font-weight: 600;
}

.marker-item-metrics {
    font-size: 8px; /* Reducido */
    color: var(--text-muted);
    margin-bottom: 2px; /* Reducido */
    line-height: 1.2;
}

.marker-item-actions {
    display: flex;
    gap: 1px; /* Reducido gap */
    justify-content: space-between;
}

.btn-mini {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.6) 100%);
    border: 1px solid rgba(30, 91, 79, 0.4);
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 9px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 22px;
    text-align: center;
    color: #e2e8f0;
    font-weight: 500;
}

.btn-mini:hover {
    background: linear-gradient(135deg, var(--profepa-verde, #1e5b4f) 0%, var(--profepa-verde-claro, #4ade80) 100%);
    border-color: var(--profepa-verde-claro, #4ade80);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(30, 91, 79, 0.5);
}

.btn-mini:hover {
    background: var(--marker-color);
    border-color: var(--marker-color);
    color: white;
    transform: translateY(-1px);
}

/* =========================================================================
   POPUPS
   ========================================================================= */

.roi-popup,
.marker-popup {
    min-width: 250px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.roi-popup-header,
.marker-popup-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--border-color);
    font-size: 14px;
}

.roi-popup-header {
    color: var(--roi-color);
}

.marker-popup-header {
    color: var(--marker-color);
}

.roi-popup-icon,
.marker-popup-icon {
    font-size: 18px;
}

.roi-popup-footer,
.marker-popup-footer {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.marker-popup-actions {
    margin-top: var(--spacing-md);
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

.btn-popup {
    flex: 1;
    min-width: 80px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-popup:hover {
    background: var(--marker-color);
    border-color: var(--marker-color);
    color: white;
    transform: translateY(-1px);
}

/* =========================================================================
   SISTEMA DE NOTIFICACIONES TOAST
   ========================================================================= */

.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-width: 350px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    background: var(--bg-color);
    border-radius: 8px;
    padding: var(--spacing-md);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid;
    opacity: 0;
    transform: translateX(400px);
    transition: all var(--transition-normal);
    pointer-events: auto;
    min-width: 250px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left-color: var(--success-color);
}

.toast-error {
    border-left-color: var(--error-color);
}

.toast-warning {
    border-left-color: var(--warning-color);
}

.toast-info {
    border-left-color: var(--info-color);
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    color: var(--text-color);
    font-weight: 500;
}

/* =========================================================================
   RESPONSIVE DESIGN
   ========================================================================= */

@media (max-width: 768px) {
    .info-panel {
        min-width: 200px;
        max-width: 250px;
        font-size: 12px;
    }
    
    .toolbar-title-content {
        font-size: 12px;
    }
    
    .toolbar-icon {
        font-size: 16px;
    }
    
    .toast-container {
        right: 10px;
        top: 70px;
        max-width: 300px;
    }
    
    .toast {
        padding: var(--spacing-sm);
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .info-panel {
        min-width: 180px;
        max-width: 220px;
    }
    
    .marker-item-actions {
        flex-wrap: wrap;
    }
    
    .btn-mini {
        flex: 1;
    }
}

/* =========================================================================
   MEJORAS DE ACCESIBILIDAD
   ========================================================================= */

/* Focus visible para navegación por teclado */
button:focus-visible,
.btn-mini:focus-visible,
.btn-popup:focus-visible {
    outline: 2px solid var(--info-color);
    outline-offset: 2px;
}

/* Reducir animaciones para usuarios que prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Alto contraste para mejor legibilidad */
@media (prefers-contrast: high) {
    :root {
        --text-color: #000000;
        --text-muted: #404040;
        --border-color: #000000;
    }
}

/* =========================================================================
   ANIMACIONES
   ========================================================================= */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(400px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Aplicar animaciones sutiles */
.info-panel {
    animation: fadeIn var(--transition-normal);
}

.toast {
    animation: slideInRight var(--transition-normal);
}

.status-badge {
    animation: pulse 2s infinite;
}

/* =========================================================================
   MEJORAS VISUALES ADICIONALES
   ========================================================================= */

/* Efecto de carga/procesamiento */
.processing {
    position: relative;
    overflow: hidden;
}

.processing::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}

/* Estilo para elementos deshabilitados */
.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Tooltips mejorados */
[title] {
    cursor: help;
}

/* Separador visual */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--spacing-md) 0;
}

/* Indicador de scroll para muchos marcadores */
.scroll-indicator {
    text-align: center;
    padding: 4px;
    font-size: 8px;
    color: var(--profepa-verde-claro, #4ade80);
    border-top: 1px solid rgba(30, 91, 79, 0.3);
    margin-top: 4px;
    background: linear-gradient(135deg, rgba(30, 91, 79, 0.2) 0%, rgba(74, 222, 128, 0.1) 100%);
    border-radius: 0 0 6px 6px;
}

.scroll-indicator i {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-2px);
    }
    60% {
        transform: translateY(-1px);
    }
}

.export-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.export-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.btn-export {
    flex: 1;
    min-width: 50px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.6) 100%);
    border: 1px solid rgba(30, 91, 79, 0.4);
    border-radius: 6px;
    padding: 6px 4px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 600;
    color: #e2e8f0;
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 91, 79, 0.4);
    border-color: var(--profepa-verde-claro, #4ade80);
}

.btn-export:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-geojson {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.btn-geojson:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.1) 100%);
    border-color: #22c55e;
    color: white;
}

.btn-kml {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.btn-kml:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.1) 100%);
    border-color: #ef4444;
    color: white;
}

.btn-csv {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-color: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.btn-csv:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
    border-color: #f59e0b;
    color: white;
}

.btn-wkt {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-color: rgba(139, 92, 246, 0.3);
    color: #8b5cf6;
}

.btn-wkt:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-color: #8b5cf6;
    color: white;
}

/* ========== DISEÑO MODERNO DEL ACCORDION ========== */
.satellite-tabs {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.9) 100%);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    overflow: hidden;
    border: 1px solid rgba(71, 85, 105, 0.3);
}

.satellite-tab {
    border-bottom: 1px solid rgba(71, 85, 105, 0.2);
}

.satellite-tab:last-child {
    border-bottom: none;
}

/* Header con diseño mejorado */
.tab-header {
    width: 100%;
    background: linear-gradient(135deg, rgba(51, 65, 85, 0.6) 0%, rgba(30, 41, 59, 0.4) 100%);
    border: none;
    padding: 18px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tab-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tab-header:hover::before {
    opacity: 1;
}

.tab-header:hover {
    background: linear-gradient(135deg, rgba(51, 65, 85, 0.8) 0%, rgba(30, 41, 59, 0.6) 100%);
    transform: translateX(4px);
}

.tab-header.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-left: 3px solid #3b82f6;
}

.tab-header-content {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1;
}

/* Icono del header con gradiente */
.tab-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
}

.tab-header:hover .tab-icon-wrapper {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.tab-icon-wrapper i {
    font-size: 22px;
    color: white;
}

/* Texto del header */
.tab-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tab-title {
    font-size: 15px;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: 0.3px;
}

.tab-subtitle {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 400;
}

.tab-header.active .tab-subtitle {
    color: #bfdbfe;
}

/* Chevron animado */
.tab-chevron {
    font-size: 16px;
    color: #64748b;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: 8px;
}

.tab-header:hover .tab-chevron {
    color: #94a3b8;
}

.tab-header.active .tab-chevron {
    transform: rotate(180deg);
    color: #60a5fa;
}

/* Contenido colapsable */
.tab-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s ease,
                padding 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.4) 0%, rgba(15, 23, 42, 0.2) 100%);
}

.tab-content.active {
    max-height: 1000px;
    opacity: 1;
    padding: 16px 0;
}

/* Contenedor de botones */
.tab-buttons {
    padding: 0 16px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Botones satelitales estilo card */
.satellite-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.4) 100%);
    border: 1px solid rgba(71, 85, 105, 0.4);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.satellite-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.satellite-btn:hover::before {
    opacity: 1;
}

.satellite-btn:hover {
    border-color: rgba(59, 130, 246, 0.6);
    transform: translateX(6px) scale(1.02);
    box-shadow: 
        0 8px 24px rgba(59, 130, 246, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.satellite-btn.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-color: #3b82f6;
    box-shadow: 
        0 0 30px rgba(59, 130, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 0 0 1px rgba(59, 130, 246, 0.3);
}

.satellite-btn.active::before {
    opacity: 0;
}

.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.satellite-btn:hover .btn-icon {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(139, 92, 246, 0.3) 100%);
    transform: scale(1.1) rotate(-5deg);
}

.satellite-btn.active .btn-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-icon i {
    font-size: 20px;
    color: #60a5fa;
    transition: color 0.3s ease;
}

.satellite-btn.active .btn-icon i {
    color: white;
}

.btn-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.btn-title {
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: 0.2px;
}

.btn-desc {
    font-size: 11px;
    color: #64748b;
    font-weight: 400;
}

.satellite-btn.active .btn-desc {
    color: #94a3b8;
}

/* Efecto de brillo para botones avanzados */
.satellite-btn::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;
}

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

/* =========================================================================
   RESPONSIVE PARA PESTAÑAS
   ========================================================================= */

@media (max-width: 768px) {
    .tab-buttons {
        grid-template-columns: 1fr;
    }
    
    .satellite-btn {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .tab-header {
        padding: 14px 16px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .satellite-tabs {
        margin: 0 8px;
    }
    
    .tab-content.active {
        padding: 12px;
    }
    
    .satellite-btn {
        min-height: 44px;
        font-size: 14px;
    }
}

/* =========================================================================
   TEMA INSTITUCIONAL PROFEPA — unificación visual de controles del mapa
   (mantener al final del archivo: sobrescribe las reglas anteriores)
   ========================================================================= */

:root {
    /* Acentos funcionales alineados a la identidad: vino (ROI) y azul petróleo (marcadores) */
    --roi-color: #9d2148;
    --roi-color-light: rgba(157, 33, 72, 0.2);
    --roi-color-dark: #7a1840;
    --marker-color: #2c6e8f;
    --marker-color-light: rgba(44, 110, 143, 0.2);
    --marker-color-dark: #1f4f68;
    /* Superficie glass común de los controles del mapa */
    --map-glass-bg: rgba(8, 38, 32, 0.85);
    --map-glass-border: rgba(255, 255, 255, 0.16);
}

/* ---- Títulos de las barras de dibujo (ROI / Marcadores) — COMPACTOS ----
   Por defecto muestran SOLO el icono (chip pequeño) para no tapar el mapa;
   al pasar el cursor revelan el texto. */
.drawing-toolbar-title {
    background: var(--map-glass-bg);
    border: 1px solid var(--map-glass-border);
    border-radius: 7px;
    padding: 3px 6px;
    margin-bottom: 3px;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    width: fit-content;
    cursor: default;
}
.roi-toolbar-title {
    background: var(--map-glass-bg);
    border-color: var(--map-glass-border);
    border-left: 3px solid #d4647c;
}
.marker-toolbar-title {
    background: var(--map-glass-bg);
    border-color: var(--map-glass-border);
    border-left: 3px solid #6fb3d2;
}
.roi-toolbar-title .toolbar-title-content { color: #f1c2cf; }
.marker-toolbar-title .toolbar-title-content { color: #bfe0f2; }
.toolbar-title-content {
    display: flex;
    align-items: center;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.toolbar-icon { font-size: 11px; }
/* El texto se colapsa por defecto y se revela al hover (ahorra espacio). */
.drawing-toolbar-title .toolbar-text {
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    white-space: nowrap;
    transition: max-width 0.25s ease, opacity 0.2s ease, margin-left 0.25s ease;
}
.drawing-toolbar-title:hover .toolbar-text {
    max-width: 100px;
    opacity: 1;
    margin-left: 5px;
}

/* ---- Paneles de información (ROI / contador de marcadores) ---- */
.info-panel,
.info-panel.compact {
    background: var(--map-glass-bg);
    border: 1px solid var(--map-glass-border);
    border-radius: 10px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.info-panel-header {
    color: #e5e7eb;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.roi-info-panel .info-panel-header {
    background: transparent;
    border-bottom: 1px solid rgba(212, 100, 124, 0.45);
    color: #f1c2cf;
}
.marker-info-panel .info-panel-header {
    background: transparent;
    border-bottom: 2px solid rgba(111, 179, 210, 0.45);
    color: #bfe0f2;
    box-shadow: none;
}
.info-panel-content,
.compact .info-panel-content {
    background: transparent;
    border: none;
    color: #d1d5db;
    backdrop-filter: none;
}
.info-panel-content .text-muted { color: rgba(255, 255, 255, 0.55) !important; }
.marker-count {
    background: var(--marker-color);
    border: 1px solid rgba(191, 224, 242, 0.4);
    box-shadow: none;
}

/* ---- Control de zoom: misma tarjeta que las herramientas de dibujo ---- */
.leaflet-control-zoom a {
    background: rgba(0, 47, 42, 0.95) !important;
    border: 2px solid var(--profepa-verde, #1e5b4f) !important;
    color: #e6d194 !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 32px !important;
    border-radius: 6px !important;
    margin: 2px !important;
    font-size: 16px !important;
    transition: all 0.25s ease !important;
}
.leaflet-control-zoom a:hover {
    background: var(--profepa-verde, #1e5b4f) !important;
    border-color: #4a9d7f !important;
    color: #ffffff !important;
}
.leaflet-control-zoom-in { margin-bottom: 4px !important; }

/* ---- Control de capas Leaflet ---- */
.leaflet-control-layers {
    background: var(--map-glass-bg) !important;
    border: 1px solid var(--map-glass-border) !important;
    border-radius: 10px !important;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4) !important;
    color: #e5e7eb !important;
}
.leaflet-control-layers-toggle {
    background-color: transparent !important;
    border-radius: 10px !important;
    filter: invert(1) brightness(1.6);
}
.leaflet-control-layers-expanded { padding: 10px 14px !important; font-size: 12px; }
.leaflet-control-layers-expanded label { margin-bottom: 4px; }

/* ---- Buscador geográfico (leaflet-geosearch) ----
   El fondo blanco por defecto del plugin vive en ".leaflet-geosearch-bar form";
   cubrir todas las variantes de estructura para que el vidrio oscuro aplique
   siempre debajo del texto claro. */
.leaflet-geosearch-bar form,
.geosearch form,
form.leaflet-control-geosearch,
.leaflet-control-geosearch form,
.leaflet-control-geosearch.bar form {
    background: var(--map-glass-bg) !important;
    border: 1px solid var(--map-glass-border) !important;
    border-radius: 20px !important;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4) !important;
    overflow: hidden;
}
.leaflet-control-geosearch form input,
.leaflet-geosearch-bar form input,
.geosearch form input,
.leaflet-geosearch-bar input.glass {
    background: transparent !important;
    border: none !important;
    color: #f3f4f6 !important;
    font-size: 12.5px !important;
    padding: 7px 14px !important;
    text-indent: 0 !important;
}
.leaflet-control-geosearch form input::placeholder,
.leaflet-geosearch-bar form input::placeholder,
.geosearch form input::placeholder {
    color: rgba(255, 255, 255, 0.55) !important;
}
.leaflet-geosearch-bar {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: min(340px, 60%) !important;
    margin: 8px auto 0 !important;
}
.leaflet-control-geosearch .results,
.leaflet-geosearch-bar .results {
    background: var(--map-glass-bg) !important;
    border: 1px solid var(--map-glass-border) !important;
    border-radius: 10px !important;
    margin-top: 4px;
    color: #e5e7eb !important;
}
.leaflet-control-geosearch .results > *,
.leaflet-geosearch-bar .results > * {
    color: #e5e7eb !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.leaflet-control-geosearch .results > *:hover,
.leaflet-control-geosearch .results > .active {
    background: rgba(30, 91, 79, 0.5) !important;
    color: #ffffff !important;
}
.leaflet-control-geosearch a.reset,
.leaflet-geosearch-bar form a.reset,
.leaflet-geosearch-bar form button.reset,
.geosearch form a.reset {
    background: transparent !important;
    color: rgba(255, 255, 255, 0.6) !important;
    border: none !important;
    line-height: 30px !important;
}
.leaflet-control-geosearch a.reset:hover,
.leaflet-geosearch-bar form a.reset:hover,
.leaflet-geosearch-bar form button.reset:hover { color: #fff !important; }

/* ---- Escala y atribución ---- */
.leaflet-control-scale-line {
    background: rgba(8, 38, 32, 0.7) !important;
    color: #e5e7eb !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    text-shadow: none !important;
    font-size: 10px !important;
}
.leaflet-control-attribution {
    background: rgba(8, 38, 32, 0.6) !important;
    color: rgba(255, 255, 255, 0.55) !important;
    font-size: 9px !important;
    border-radius: 6px 0 0 0;
}
.leaflet-control-attribution a { color: rgba(255, 255, 255, 0.75) !important; }

/* ---- Tema claro: superficies glass claras ---- */
[data-theme="light"] .drawing-toolbar-title,
[data-theme="light"] .info-panel,
[data-theme="light"] .info-panel.compact,
[data-theme="light"] .leaflet-control-layers,
[data-theme="light"] form.leaflet-control-geosearch,
[data-theme="light"] .leaflet-control-geosearch.bar form,
[data-theme="light"] .leaflet-geosearch-bar form,
[data-theme="light"] .geosearch form,
[data-theme="light"] .leaflet-control-geosearch form,
[data-theme="light"] .leaflet-geosearch-bar .results,
[data-theme="light"] .leaflet-control-geosearch .results {
    background: rgba(255, 255, 255, 0.92) !important;
    border-color: rgba(30, 91, 79, 0.3) !important;
    color: #1f2937 !important;
}
[data-theme="light"] .roi-toolbar-title .toolbar-title-content { color: #9d2148; }
[data-theme="light"] .marker-toolbar-title .toolbar-title-content { color: #1f4f68; }
[data-theme="light"] .info-panel-header,
[data-theme="light"] .info-panel-content,
[data-theme="light"] .compact .info-panel-content { color: #374151; }
[data-theme="light"] .info-panel-content .text-muted { color: rgba(0, 0, 0, 0.5) !important; }
[data-theme="light"] .leaflet-control-geosearch form input,
[data-theme="light"] .geosearch form input,
[data-theme="light"] .leaflet-geosearch-bar form input { color: #1f2937 !important; }
[data-theme="light"] .leaflet-control-geosearch form input::placeholder,
[data-theme="light"] .leaflet-geosearch-bar form input::placeholder { color: rgba(0, 0, 0, 0.45) !important; }
[data-theme="light"] .leaflet-geosearch-bar .results > *,
[data-theme="light"] .leaflet-control-geosearch .results > * { color: #1f2937 !important; border-bottom-color: rgba(0,0,0,0.08) !important; }
[data-theme="light"] .leaflet-control-layers-toggle { filter: none; }
[data-theme="light"] .leaflet-control-geosearch .results > *:hover { background: rgba(30, 91, 79, 0.12) !important; color: #0d3b32 !important; }
