/**
 * Controles del mapa - Estilos para botones de zoom, estilo, etc.
 */

/* Contenedor principal del mapa */
#map {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #87ceeb;
}

/* Controles de estilo de mapa (superior derecha) - LEGACY - OCULTO */
.style-controls {
    display: none !important;
}

.style-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: #1a1a1a;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px) saturate(180%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    position: relative;
    flex-shrink: 1;
    flex-grow: 0;
    width: auto;
}

/* Iconos de Lucide en botones style-btn */
.style-btn i,
.style-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Labels de texto en botones style-btn */
.style-btn .btn-text {
    font-size: calc(var(--font-size-sm) + 1px);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

/* 🎯 Container Queries - Responsive automático basado en el ancho del panel */

/* Panel muy grande - Mostrar todo */
@container button-panel (min-width: 800px) {
    .style-btn .btn-text {
        display: inline;
    }
    .style-btn .btn-count {
        display: inline-flex;
    }
}

/* Panel mediano - Texto con ellipsis */
@container button-panel (max-width: 799px) and (min-width: 600px) {
    .style-btn .btn-text {
        display: inline;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 80px;
    }
    .style-btn .btn-count {
        display: inline-flex;
    }
}

/* Panel pequeño - Texto más corto */
@container button-panel (max-width: 599px) and (min-width: 450px) {
    .style-btn .btn-text {
        display: inline;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 50px;
    }
    .style-btn .btn-count {
        display: inline-flex;
    }
}

/* Panel más pequeño - Solo icono + contador */
@container button-panel (max-width: 449px) and (min-width: 350px) {
    .style-btn .btn-text {
        display: none;
    }
    .style-btn .btn-count {
        display: inline-flex;
    }
}

/* Panel muy pequeño - Solo iconos */
@container button-panel (max-width: 349px) {
    .style-btn .btn-text {
        display: none;
    }
    .style-btn .btn-count {
        display: none;
    }
    .style-btn {
        min-width: 44px;
        padding: 0;
        width: 44px;
    }
}

.style-controls .style-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.6), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.style-controls .style-btn:hover::before {
    opacity: 1;
}

.style-controls .style-controls .style-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
}

.style-controls .style-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.style-controls .style-btn.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow:
        0 4px 16px rgba(16, 185, 129, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.style-controls .style-btn.active:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 6px 20px rgba(16, 185, 129, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.style-controls .style-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    background: rgba(200, 200, 200, 0.5);
    color: #999;
}

.style-controls .style-btn:disabled:hover {
    transform: none;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.style-controls .back-button {
    background: var(--warning-color);
    color: var(--text-primary);
    border-color: var(--warning-color);
}

.style-controls .back-button:hover {
    background: #e0a800;
}

/* ========================================
   🎯 CONTENEDOR PRINCIPAL FLEX DINÁMICO
   ======================================== */

/* 🔥 Nuevo contenedor principal que agrupa TODOS los paneles de controles */
.left-controls-container {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    flex-direction: row; /* 🔄 Cambiado de column a row para alinear horizontalmente */
    gap: 12px;
    z-index: var(--z-fixed);
    pointer-events: none; /* Permite clicks en el mapa */
    align-items: flex-start; /* Alineación superior para mantener controles alineados */
}

.left-controls-container > * {
    pointer-events: auto; /* Reactiva clicks solo en los controles */
    flex-shrink: 0; /* Evita que los paneles se compriman */
    width: auto; /* 🆕 Permitir que cada panel tenga su propio ancho */
}

/* Animación suave al aparecer */
.left-controls-container > * {
    animation: fadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.left-controls-container > *:nth-child(1) {
    animation-delay: 0ms;
}

.left-controls-container > *:nth-child(2) {
    animation-delay: 50ms;
}

.left-controls-container > *:nth-child(3) {
    animation-delay: 100ms;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   🎯 CONTROLES DE ZOOM MODERNOS
   ======================================== */

/* Controles de zoom (superior izquierda) - REDISEÑO MODERNO */
.zoom-controls {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    width: auto;
}

/* Variante compacta de controles de zoom */
.zoom-controls.compact {
    padding: 6px;
    gap: 4px;
    border-radius: 10px;
}

/* Botones compactos de zoom */
.zoom-btn.compact {
    width: 36px;
    height: 36px;
    font-size: 16px;
}

/* Iconos más pequeños en botones compactos */
.zoom-btn.compact i,
.zoom-btn.compact svg {
    width: 16px;
    height: 16px;
}

/* Contenedor del botón de búsqueda */
.search-button-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* 🎨 Botones Zoom - Diseño Glassmorphism Minimalista */
.zoom-controls .zoom-btn,
.visualization-controls .zoom-btn,
.editing-controls .zoom-btn,
.back-button-controls .zoom-btn,
.back-button-panel .zoom-btn,
.date-controls-panel .zoom-btn {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: #1a1a1a;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px) saturate(180%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.zoom-controls .zoom-btn::before,
.visualization-controls .zoom-btn::before,
.editing-controls .zoom-btn::before,
.back-button-controls .zoom-btn::before,
.back-button-panel .zoom-btn::before,
.date-controls-panel .zoom-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.6), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.zoom-controls .zoom-btn:hover::before,
.visualization-controls .zoom-btn:hover::before,
.editing-controls .zoom-btn:hover::before,
.back-button-controls .zoom-btn:hover::before,
.back-button-panel .zoom-btn:hover::before,
.date-controls-panel .zoom-btn:hover::before {
    opacity: 1;
}

.zoom-controls .zoom-btn:hover,
.visualization-controls .zoom-btn:hover,
.editing-controls .zoom-btn:hover,
.back-button-controls .zoom-btn:hover,
.back-button-panel .zoom-btn:hover,
.date-controls-panel .zoom-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
}

.zoom-controls .zoom-btn:active,
.visualization-controls .zoom-btn:active,
.editing-controls .zoom-btn:active,
.back-button-controls .zoom-btn:active,
.back-button-panel .zoom-btn:active,
.date-controls-panel .zoom-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.zoom-controls .zoom-btn.active,
.visualization-controls .zoom-btn.active,
.editing-controls .zoom-btn.active,
.back-button-controls .zoom-btn.active,
.back-button-panel .zoom-btn.active,
.date-controls-panel .zoom-btn.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow:
        0 4px 16px rgba(16, 185, 129, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.zoom-controls .zoom-btn.active:hover,
.visualization-controls .zoom-btn.active:hover,
.editing-controls .zoom-btn.active:hover,
.back-button-controls .zoom-btn.active:hover,
.back-button-panel .zoom-btn.active:hover,
.date-controls-panel .zoom-btn.active:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 6px 20px rgba(16, 185, 129, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.zoom-controls .zoom-btn.expanded,
.visualization-controls .zoom-btn.expanded,
.editing-controls .zoom-btn.expanded,
.back-button-controls .zoom-btn.expanded,
.back-button-panel .zoom-btn.expanded,
.date-controls-panel .zoom-btn.expanded {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow:
        0 4px 16px rgba(16, 185, 129, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.zoom-controls .zoom-btn.expanded:hover,
.visualization-controls .zoom-btn.expanded:hover,
.editing-controls .zoom-btn.expanded:hover,
.back-button-controls .zoom-btn.expanded:hover,
.back-button-panel .zoom-btn.expanded:hover,
.date-controls-panel .zoom-btn.expanded:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px) scale(1.05);
}

/* Estado explícito para botones NO expandidos - Blanco */
.zoom-controls .zoom-btn:not(.expanded):not(.active):not(:disabled),
.visualization-controls .zoom-btn:not(.expanded):not(.active):not(:disabled),
.editing-controls .zoom-btn:not(.expanded):not(.active):not(:disabled) {
    background: rgba(255, 255, 255, 0.85);
    color: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.3);
}

.zoom-controls .zoom-btn:disabled,
.visualization-controls .zoom-btn:disabled,
.editing-controls .zoom-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    background: rgba(200, 200, 200, 0.5);
    color: #999;
}

.zoom-controls .zoom-btn:disabled:hover,
.visualization-controls .zoom-btn:disabled:hover,
.editing-controls .zoom-btn:disabled:hover {
    transform: none;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.zoom-btn span {
    line-height: 1;
}

/* Contador de cambios pendientes */
.pending-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    animation: pulse-pending 2s infinite;
}

@keyframes pulse-pending {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Estilos para detalles de cambios pendientes */
.pending-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.pending-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-size: 12px;
}

.pending-icon {
    font-size: 14px;
}

.pending-label {
    flex: 1;
    color: #666;
}

.pending-count {
    font-weight: bold;
    color: #2c3e50;
    background: #ecf0f1;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* Botón de guardar cambios elegante flotante */
.save-changes-floating {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    pointer-events: none;
}

.save-changes-btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border: none;
    border-radius: 50px;
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.3);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    min-width: 180px;
    padding: 0;
}

.save-changes-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 35px rgba(39, 174, 96, 0.4);
    background: linear-gradient(135deg, #229954, #27ae60);
}

.save-changes-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.save-changes-btn:disabled {
    background: linear-gradient(135deg, #95a5a6, #bdc3c7);
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.2);
}

.save-btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    color: white;
    font-weight: 600;
    font-size: 16px;
    position: relative;
}

.save-btn-icon {
    font-size: 20px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.save-btn-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: 0.5px;
}

.save-btn-count {
    background: rgba(255, 255, 255, 0.9);
    color: #27ae60;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: pulse-save-count 2s infinite;
}

@keyframes pulse-save-count {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.save-btn-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: white;
    font-weight: 500;
    font-size: 15px;
    border-radius: 50px;
}

.save-btn-loading .loading-spinner {
    animation: spin 1s linear infinite;
    font-size: 18px;
}

/* Estados especiales del botón */
.save-changes-btn.saving {
    pointer-events: none;
    animation: saving-pulse 1.5s infinite;
}

@keyframes saving-pulse {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(39, 174, 96, 0.3);
    }
    50% {
        box-shadow: 0 8px 25px rgba(39, 174, 96, 0.6);
    }
}

.save-changes-btn.success {
    background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
    animation: success-flash 0.6s ease-out;
}

@keyframes success-flash {
    0% {
        background: linear-gradient(135deg, #f39c12, #e67e22) !important;
        transform: scale(1.1);
    }
    100% {
        background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
        transform: scale(1);
    }
}

.save-changes-btn.error {
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
    animation: error-shake 0.5s ease-in-out;
}

@keyframes error-shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Panel colapsable de cambios pendientes */
.pending-changes-panel {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 9999;
    max-width: 400px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pending-changes-panel.collapsed .pending-changes-content {
    display: none;
}

.pending-changes-toggle {
    background: rgba(44, 62, 80, 0.95);
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.3);
    transition: all 0.3s ease;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.pending-changes-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.4);
    background: rgba(52, 73, 94, 0.95);
}

.toggle-icon {
    font-size: 16px;
}

.toggle-text {
    font-size: 14px;
}

.toggle-count {
    background: #e74c3c;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    min-width: 22px;
}

.pending-changes-content {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    margin-top: 10px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.pending-changes-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pending-changes-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.pending-changes-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.pending-changes-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.pending-changes-body {
    max-height: 300px;
    overflow-y: auto;
    padding: 15px;
}

.no-changes-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    color: #7f8c8d;
    font-style: italic;
    text-align: center;
    justify-content: center;
}

.no-changes-icon {
    font-size: 20px;
    opacity: 0.7;
}

.pending-change-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-left: 4px solid transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.pending-change-item:hover {
    background: #e9ecef;
    transform: translateX(2px);
}

.pending-change-item.line {
    border-left-color: #3498db;
}

.pending-change-item.polygon {
    border-left-color: #9b59b6;
}

.change-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.change-type {
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 6px;
}

.change-details {
    font-size: 12px;
    color: #7f8c8d;
}

.change-actions {
    display: flex;
    gap: 6px;
}

.toggle-visibility-btn, .delete-change-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-visibility-btn:hover {
    background: #3498db;
    color: white;
}

.delete-change-btn:hover {
    background: #e74c3c;
    color: white;
}

.pending-changes-footer {
    background: #f8f9fa;
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
}

.clear-all-btn {
    background: #e74c3c;
    border: none;
    border-radius: 6px;
    padding: 8px 15px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
    justify-content: center;
}

.clear-all-btn:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-1px);
}

.clear-all-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

/* Scrollbar personalizado para el panel */
.pending-changes-body::-webkit-scrollbar {
    width: 6px;
}

.pending-changes-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.pending-changes-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.pending-changes-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ========================================
   🎨 CONTROLES DE VISUALIZACIÓN MODERNOS
   ======================================== */

/* Controles de visualización - REDISEÑO MODERNO (solo 1 botón) */
.visualization-controls {
    display: inline-grid;
    grid-template-columns: 44px;
    gap: 8px;
    width: auto;
    padding: 10px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Variante horizontal de controles de visualización */
.visualization-controls.horizontal {
    display: inline-flex;
    flex-direction: row;
    gap: 4px;
    padding: 6px;
    border-radius: 10px;
}

/* Controles de edición en cuadrícula 2x2 - REDISEÑO MODERNO */
.editing-controls {
    display: inline-grid;
    grid-template-columns: repeat(2, 44px);
    gap: 8px;
    width: auto;
    padding: 10px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.control-separator {
    height: 1px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.3) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    margin: 2px 0;
    border-radius: 2px;
    grid-column: span 2; /* Ocupa ambas columnas */
    opacity: 0.6;
}

/* 🎨 Controles de color - Estilo consistente con zoom-btn */
.color-picker-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-picker-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 1;
}

.color-picker-btn {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px) saturate(180%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    position: relative;
    overflow: hidden;
}

.color-picker-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.6), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.color-picker-btn:hover::before {
    opacity: 1;
}

.color-picker-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Controles expandibles con toggle */
.toggle-icon {
    transition: all var(--transition-fast);
}

.zoom-btn.expanded .toggle-icon {
    transform: rotate(90deg);
}

/* Wrapper para controles toggle */
.toggle-control-wrapper {
    position: relative;
    display: contents; /* Permite que los hijos participen en el grid */
}

/* 🎨 CONTROLES EXPANDIBLES - Diseño Moderno Glassmorphism */
.expandable-control {
    display: none;
    position: absolute;
    top: calc(var(--control-height) + 12px);
    left: 0;
    right: auto;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 14px;
    padding: 16px;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(24px) saturate(180%);
    flex-direction: column;
    gap: 12px;
    z-index: 10000;
    min-width: 220px;
    animation: slideDownFade 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.expandable-control.show {
    display: flex;
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.control-label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    text-align: left;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    margin-bottom: 0;
}

/* 🎨 Slider Moderno con Gradiente */
.size-slider-expandable {
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #e5e7eb 0%, #d1d5db 100%);
    border-radius: 12px;
    outline: none;
    cursor: pointer;
    margin: 8px 0;
    position: relative;
    transition: all 0.2s ease;
}

.size-slider-expandable:hover {
    background: linear-gradient(90deg, #d1d5db 0%, #9ca3af 100%);
}

/* Thumb personalizado - WebKit (Chrome, Safari, Edge) */
.size-slider-expandable::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: grab;
    box-shadow:
        0 2px 8px rgba(102, 126, 234, 0.4),
        0 0 0 3px rgba(255, 255, 255, 0.9),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.size-slider-expandable::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow:
        0 4px 12px rgba(102, 126, 234, 0.5),
        0 0 0 4px rgba(255, 255, 255, 0.95),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.size-slider-expandable::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.05);
    box-shadow:
        0 2px 6px rgba(102, 126, 234, 0.6),
        0 0 0 2px rgba(255, 255, 255, 0.95);
}

/* Thumb personalizado - Firefox */
.size-slider-expandable::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: grab;
    box-shadow:
        0 2px 8px rgba(102, 126, 234, 0.4),
        0 0 0 3px rgba(255, 255, 255, 0.9);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.size-slider-expandable::-moz-range-thumb:hover {
    transform: scale(1.15);
}

.size-slider-expandable::-moz-range-thumb:active {
    cursor: grabbing;
    transform: scale(1.05);
}

/* Track - Firefox */
.size-slider-expandable::-moz-range-track {
    background: linear-gradient(90deg, #e5e7eb 0%, #d1d5db 100%);
    border-radius: 12px;
    height: 6px;
    border: none;
}

.control-value {
    font-size: 14px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

/* Mantener compatibilidad con size-slider original */
.size-slider {
    width: 60px;
    height: 4px;
    background: var(--border-light);
    border-radius: var(--border-radius-sm);
    outline: none;
    cursor: pointer;
}

.size-slider::-webkit-slider-thumb,
.size-slider-compact::-webkit-slider-thumb,
.size-slider-expandable::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--primary-blue);
    border-radius: var(--border-radius-circle);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.size-slider::-moz-range-thumb,
.size-slider-compact::-moz-range-thumb,
.size-slider-expandable::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--primary-blue);
    border-radius: var(--border-radius-circle);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-sm);
}

/* Controles de cámara 3D */
.camera-3d-controls {
    position: absolute;
    top: 20px; /* Alineado con el botón VISTA */
    right: 85px; /* Posicionado a la izquierda del botón VISTA (54px + 20px gap + 11px) */
    display: flex;
    gap: 8px;
    z-index: var(--z-fixed);
}

.camera-btn {
    width: var(--control-height);
    height: var(--control-height);
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--control-shadow);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-btn:hover {
    background: var(--control-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.camera-btn:active {
    background: var(--control-active);
    color: var(--text-light);
}

/* Búsqueda por coordenadas */
.coordinates-search {
    position: absolute;
    top: calc(var(--control-height) + var(--spacing-xs));
    left: 0;
    width: 280px;
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: var(--border-radius-md);
    box-shadow: var(--control-shadow);
    backdrop-filter: blur(8px);
    z-index: calc(var(--z-fixed) + 1);
    display: none;
}

.search-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs);
}

.search-icon {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
}

.search-input {
    flex: 1;
    height: var(--control-height-sm);
    padding: 0 var(--spacing-sm);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-sm);
    background: var(--bg-primary);
}

.search-input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px rgba(51, 136, 255, 0.2);
}

.search-btn,
.clear-search-btn {
    width: var(--control-height-sm);
    height: var(--control-height-sm);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover,
.clear-search-btn:hover {
    background: var(--primary-blue);
    color: var(--text-light);
    border-color: var(--primary-blue);
}

/* ========================================
   📱 ESTADOS RESPONSIVOS AVANZADOS
   ======================================== */

/* Tablets y pantallas medianas */
@media (max-width: 768px) {
    .style-controls {
        flex-wrap: wrap;
        max-width: calc(100vw - 2 * var(--spacing-md));
    }

    /* ✅ Ocultar texto en botones de estilo, mantener solo icono */
    .style-btn .btn-text {
        display: none;
    }

    .coordinates-search {
        width: 240px;
    }

    .left-controls-container {
        max-width: calc(100vw - 24px);
        left: 12px;
        top: 12px;
        gap: 10px;
    }

    .visualization-controls,
    .editing-controls {
        grid-template-columns: repeat(2, 40px);
        padding: 8px;
        gap: 6px;
    }

    .zoom-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .toggle-control-wrapper {
        display: block;
    }

    .expandable-control {
        position: static;
        margin-top: var(--spacing-xs);
        min-width: auto;
        width: 100%;
    }

    .control-separator {
        grid-column: span 2;
    }

    .size-slider-expandable,
    .size-slider-compact,
    .size-slider {
        width: 100%;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    .style-controls {
        top: var(--spacing-sm);
        right: var(--spacing-sm);
        gap: 4px;
        padding: 4px;
    }

    /* ✅ Ocultar texto en botones de estilo en móviles, mantener solo icono */
    .style-btn .btn-text {
        display: none;
    }

    .left-controls-container {
        left: 8px;
        top: 8px;
        gap: 8px;
        max-width: calc(100vw - 16px);
    }

    .zoom-controls {
        padding: 6px;
        gap: 4px;
    }

    .visualization-controls,
    .editing-controls {
        grid-template-columns: repeat(2, 36px);
        padding: 6px;
        gap: 4px;
    }

    .coordinates-search {
        width: calc(100vw - 2 * var(--spacing-sm));
        left: var(--spacing-sm);
    }

    .style-btn {
        min-width: var(--control-height-sm);
        height: var(--control-height-sm);
        font-size: var(--font-size-xs);
        padding: 0 var(--spacing-xs);
    }

    .zoom-btn,
    .color-picker-btn,
    .camera-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .expandable-control {
        min-width: 180px;
        padding: 12px;
    }
}

/* ===== MODAL DE BÚSQUEDA AVANZADA — Dark Green Ultra Modern ===== */

/* Variables del modal — MODO CLARO; los tokens auto-conmutan con .dark en <html> */
.search-modal {
    /* Superficies */
    --sm-bg:             var(--color-widget-bg);
    --sm-body:           var(--color-widget-bg-alt);
    --sm-section:        var(--color-panel-item-bg);
    --sm-footer-bg:      var(--color-widget-bg-hover);
    --sm-tabs-bg:        rgba(0,70,41,0.06);
    /* Bordes */
    --sm-border:         var(--color-widget-border);
    /* Acentos */
    --sm-accent:         var(--color-cp-lime);
    --sm-accent-lt:      var(--color-widget-primary-lighter);
    --sm-accent-hover:   var(--color-cp-sage);
    --sm-header:         linear-gradient(135deg, var(--color-widget-header-from) 0%, var(--color-widget-header-to) 100%);
    /* Texto */
    --sm-text:           var(--color-widget-text);
    --sm-muted:          var(--color-widget-text-muted);
    --sm-label-color:    var(--color-widget-primary);
    --sm-placeholder:    rgba(0,70,41,0.28);
    /* Inputs */
    --sm-input-bg:       var(--color-widget-bg-hover);
    --sm-input-brd:      var(--color-widget-border);
    --sm-input-focus-bg: var(--color-widget-bg);
    --sm-focus:          rgba(5,150,105,0.18);
    /* Botones overlay */
    --sm-overlay-bg:     rgba(0,70,41,0.06);
    --sm-overlay-hover:  rgba(0,70,41,0.12);
    /* Tabs */
    --sm-tab-active:     var(--color-cp-lime);
    --sm-tab-inactive:   var(--color-widget-text-muted);
    /* Sombra */
    --sm-shadow:         0 16px 40px rgba(0,80,40,0.12), 0 0 0 1px rgba(0,80,40,0.06);
    /* Estático */
    --sm-radius:         16px;
}

/* Overrides modo oscuro — solo los valores rgba() que no pueden auto-conmutar */
.dark .search-modal {
    --sm-tabs-bg:        rgba(0,0,0,0.35);
    --sm-footer-bg:      rgba(0,0,0,0.3);
    --sm-placeholder:    rgba(200,230,200,0.3);
    --sm-input-bg:       rgba(0,0,0,0.35);
    --sm-input-focus-bg: rgba(0,0,0,0.45);
    --sm-focus:          rgba(74,222,128,0.3);
    --sm-overlay-bg:     rgba(255,255,255,0.05);
    --sm-overlay-hover:  rgba(255,255,255,0.1);
    --sm-shadow:         0 16px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04);
}

/* Contenedor raíz — snackbar superior, NO bloquea el resto de la pantalla.
   Anclado justo debajo del panel de capas (Lotes, Coordenadas, Tags, Elementos). */
.search-modal {
    position: fixed !important;
    inset: auto !important;
    top: 84px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    height: auto !important;
    display: none !important;          /* oculto por defecto */
    align-items: flex-start !important;
    justify-content: center !important;
    z-index: var(--z-modal, 9000) !important;
    font-family: 'Inter', -apple-system, sans-serif !important;
    pointer-events: none !important;
}

/* La clase .is-open gana sobre el display:none con !important del estado base */
.search-modal.is-open {
    display: flex !important;
}

/* Tarjeta del panel — único elemento interactivo (el resto del mapa sigue clicable) */
.search-modal-content {
    position: relative !important;
    width: min(90vw, 400px) !important;
    max-height: calc(100vh - 110px) !important;
    background: var(--sm-bg) !important;
    border: 1px solid var(--sm-border) !important;
    border-radius: 12px !important;
    box-shadow: var(--sm-shadow) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    pointer-events: auto !important;
    animation: smSlideDown 0.24s cubic-bezier(0.34,1.2,0.64,1) !important;
}

@keyframes smSlideDown {
    from { opacity:0; transform: translateY(-14px) scale(0.98); }
    to   { opacity:1; transform: translateY(0)      scale(1); }
}

/* Header con gradiente verde */
.search-modal-header {
    background: var(--sm-header) !important;
    padding: 8px 10px 8px 12px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    border-bottom: none !important;
}

.search-modal-header h3 {
    margin: 0 !important;
    color: #ffffff !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 1 !important;
}

.search-modal-header h3 i,
.search-modal-header h3 svg {
    width: 13px !important;
    height: 13px !important;
    stroke-width: 2.5 !important;
    flex-shrink: 0 !important;
}

/* Botón cerrar */
.close-modal-btn {
    width: 20px !important;
    height: 20px !important;
    border: 1px solid rgba(255,255,255,0.25) !important;
    background: rgba(255,255,255,0.12) !important;
    color: #ffffff !important;
    font-size: 14px !important;
    cursor: pointer !important;
    border-radius: 5px !important;
    transition: all 0.18s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
}

.close-modal-btn:hover {
    background: rgba(255,255,255,0.22) !important;
    color: #ffffff !important;
    transform: scale(1.08) !important;
}

/* Body */
.search-modal-body {
    padding: 10px 12px !important;
    background: var(--sm-body) !important;
    overflow-y: auto !important;
    min-height: 0 !important;
    scrollbar-width: thin !important;
    scrollbar-color: var(--sm-accent) transparent !important;
}

.search-modal-body::-webkit-scrollbar { width: 4px; }
.search-modal-body::-webkit-scrollbar-track { background: transparent; }
.search-modal-body::-webkit-scrollbar-thumb { background: var(--sm-accent); border-radius: 4px; }

/* ── Tabs ── */
.search-tabs {
    display: flex !important;
    gap: 3px !important;
    padding: 3px !important;
    background: var(--sm-tabs-bg) !important;
    border: 1px solid var(--sm-border) !important;
    border-radius: 8px !important;
    margin-bottom: 10px !important;
}

.search-tab {
    flex: 1 !important;
    padding: 5px 4px !important;
    border: none !important;
    background: transparent !important;
    color: var(--sm-tab-inactive) !important;
    cursor: pointer !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    transition: all 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
    letter-spacing: 0.01em !important;
}

.search-tab svg, .search-tab i {
    width: 11px !important;
    height: 11px !important;
    stroke-width: 2.5 !important;
    flex-shrink: 0 !important;
}

.search-tab:hover {
    background: rgba(74,222,128,0.1) !important;
    color: var(--sm-accent-lt) !important;
}

.search-tab.active {
    background: var(--sm-accent) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 10px rgba(22,163,74,0.45) !important;
}

/* ── Tab panes ── */
.tab-pane {
    display: none !important;
}

.tab-pane.active {
    display: block !important;
    animation: smFadeIn 0.2s ease !important;
}

@keyframes smFadeIn {
    from { opacity:0; transform: translateY(4px); }
    to   { opacity:1; transform: translateY(0); }
}

/* ── Campos de formulario ── */
.search-field {
    margin-bottom: 8px !important;
}

.search-field label {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    margin-bottom: 4px !important;
    color: var(--sm-label-color) !important;
    font-weight: 600 !important;
    font-size: 10px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
}

.search-field label svg,
.search-field label i {
    width: 11px !important;
    height: 11px !important;
    stroke-width: 2.5 !important;
    color: var(--sm-accent-lt) !important;
    flex-shrink: 0 !important;
}

.search-field input {
    width: 100% !important;
    padding: 6px 9px !important;
    border: 1px solid var(--sm-input-brd) !important;
    border-radius: 6px !important;
    background: var(--sm-input-bg) !important;
    color: var(--sm-text) !important;
    font-size: 12.5px !important;
    font-family: 'Inter', monospace !important;
    outline: none !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
    box-sizing: border-box !important;
}

.search-field input::placeholder {
    color: var(--sm-placeholder) !important;
}

.search-field input:focus {
    border-color: var(--sm-accent-lt) !important;
    box-shadow: 0 0 0 3px var(--sm-focus) !important;
    background: var(--sm-input-focus-bg) !important;
}

.search-field small {
    display: block !important;
    margin-top: 3px !important;
    color: var(--sm-muted) !important;
    font-size: 10px !important;
}

/* Fila de dos campos coordinadas GPS */
.coord-fields-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
}

/* ── Footer ── */
.search-modal-footer {
    padding: 8px 12px !important;
    background: var(--sm-footer-bg) !important;
    border-top: 1px solid var(--sm-border) !important;
    display: flex !important;
    gap: 8px !important;
    justify-content: flex-end !important;
    flex-shrink: 0 !important;
}

.search-btn-primary {
    padding: 6px 14px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    border: none !important;
    background: var(--sm-accent) !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    letter-spacing: 0.01em !important;
    box-shadow: 0 2px 12px rgba(22,163,74,0.4) !important;
}

.search-btn-primary svg, .search-btn-primary i {
    width: 12px !important;
    height: 12px !important;
    stroke-width: 2.5 !important;
}

.search-btn-primary:hover {
    background: var(--sm-accent-hover) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 18px rgba(22,163,74,0.55) !important;
}

.search-btn-secondary {
    padding: 6px 12px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    border: 1px solid var(--sm-border) !important;
    background: var(--sm-overlay-bg) !important;
    color: var(--sm-muted) !important;
}

.search-btn-secondary:hover {
    background: var(--sm-overlay-hover) !important;
    color: var(--sm-text) !important;
}

/* ── Resultados ── */
.search-results {
    margin-top: 10px !important;
    padding-top: 8px !important;
    border-top: 1px solid var(--sm-border) !important;
}

.results-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 6px !important;
}

.results-header h4 {
    margin: 0 !important;
    color: var(--sm-accent-lt) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
}

.clear-results-btn {
    padding: 3px 8px !important;
    border: 1px solid var(--sm-border) !important;
    background: var(--sm-overlay-bg) !important;
    color: var(--sm-muted) !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    transition: all 0.18s !important;
}

.clear-results-btn:hover {
    background: var(--sm-overlay-hover) !important;
    color: var(--sm-text) !important;
}

.results-list {
    max-height: 140px !important;
    overflow-y: auto !important;
    scrollbar-width: thin !important;
    scrollbar-color: var(--sm-accent) transparent !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
}

.result-item {
    padding: 7px 9px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.18s !important;
    border: 1px solid var(--sm-border) !important;
    background: var(--sm-section) !important;
}

.result-item:hover {
    background: rgba(74,222,128,0.08) !important;
    border-color: rgba(74,222,128,0.3) !important;
}

.result-title {
    font-weight: 600 !important;
    color: var(--sm-text) !important;
    font-size: 12px !important;
    margin-bottom: 2px !important;
}

.result-details {
    font-size: 10px !important;
    color: var(--sm-muted) !important;
}

.no-results {
    text-align: center !important;
    color: var(--sm-muted) !important;
    font-style: italic !important;
    padding: 16px !important;
    font-size: 12px !important;
}

/* ===== CUADRO DE BÚSQUEDA RÁPIDA ===== */
.quick-search-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 320px;
    background: white;
    border: 2px solid #3b82f6;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: var(--z-popover);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.quick-search-header {
    background: #3b82f6;
    color: white;
    padding: 12px 16px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quick-search-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.quick-search-content {
    padding: 16px;
}

.search-mode-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 6px;
}

.mode-tab {
    flex: 1;
    padding: 6px 8px;
    border: none;
    background: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #64748b;
    transition: all 0.2s;
}

.mode-tab.active {
    background: white;
    color: #3b82f6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-input-area {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

#quick-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

#quick-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-execute-btn {
    padding: 8px 16px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.search-execute-btn:hover {
    background: #2563eb;
}

.quick-results {
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
}

.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: #6b7280;
}

.clear-btn {
    background: none;
    border: 1px solid #d1d5db;
    color: #6b7280;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
}

.clear-btn:hover {
    background: #f3f4f6;
}

.quick-results-list {
    max-height: 150px;
    overflow-y: auto;
}

.quick-result-item {
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.quick-result-item:hover {
    background: #f8fafc;
    border-color: #3b82f6;
}

.quick-result-title {
    font-weight: 500;
    color: #111827;
    font-size: 13px;
}

.quick-result-details {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}

/* ========================================
   🎯 CONTROLES DE TIPO DE PIN (TAG e IDEAL)
   ======================================== */

/* Panel de controles de tipo de pin - Centro superior con estilo glassmorphism */
.pin-type-controls {
    position: absolute;
    top: var(--spacing-md);
    left: 0;
    right: 0;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    z-index: var(--z-fixed);
    container-type: inline-size;
    container-name: button-panel;
}

/* 🆕 Estilos para contadores de botones de capa */
.btn-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    margin-left: 6px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 9px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.style-btn.active .btn-count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* Estilos específicos para botones de capas */
#toggle-virtual-points.style-btn.active {
    background: linear-gradient(135deg, #FF6B00 0%, #E65C00 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow:
        0 4px 16px rgba(255, 107, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#toggle-products.style-btn.active {
    background: linear-gradient(135deg, #FF1744 0%, #D50000 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow:
        0 4px 16px rgba(255, 23, 68, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#toggle-visits.style-btn.active {
    background: linear-gradient(135deg, #0E6B0B 0%, #5AB40C 25%, #90E029 50%, #F7B42D 75%, #5F9AFF 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow:
        0 4px 16px rgba(144, 224, 41, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#toggle-visits-ideal.style-btn.active {
    background: linear-gradient(135deg, #9370DB 0%, #7B68C8 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow:
        0 4px 16px rgba(147, 112, 219, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#toggle-visits-real.style-btn.active {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow:
        0 4px 16px rgba(6, 182, 212, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#toggle-subpolygons.style-btn.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow:
        0 4px 16px rgba(139, 92, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#toggle-polygons.style-btn.active {
    background: linear-gradient(135deg, #D4AF37 0%, #B8941F 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow:
        0 4px 16px rgba(212, 175, 55, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* 🔥 Mapa de Calor - Rojo/Fuego cuando activo */
#toggle-heatmap.style-btn.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow:
        0 4px 16px rgba(239, 68, 68, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#toggle-heatmap.style-btn.active:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow:
        0 6px 20px rgba(239, 68, 68, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ========================================
   🆕 BOTÓN DE VISTA DE MAPA - GLASSMORPHISM
   ======================================== */

.map-style-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: var(--z-fixed, 1000);
    /* En fila: apilados verticalmente el popup (top: 58px) tapaba el segundo botón.
       El popup es position:absolute, así que no participa en el flex. */
    display: flex;
    flex-direction: row;
    gap: 8px;
}

/* 🌿 Botones de estilo de mapa y tema.
   Mismo lenguaje visual que los controles laterales (.lt-tab): base verde muy
   oscura, acento #16a34a y texto #86efac. Con variante para modo claro. */
.map-style-btn {
    width: 48px;
    height: 48px;
    background: rgba(9, 21, 12, 0.85);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid rgba(22, 163, 74, 0.28);
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 20px;
    cursor: pointer;
    transition: background 0.22s ease, color 0.22s ease, border-color 0.22s ease,
                transform 0.22s ease, box-shadow 0.22s ease;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.map-style-btn:hover {
    background: rgba(22, 163, 74, 0.16);
    border-color: rgba(22, 163, 74, 0.5);
    color: #86efac;
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(22, 163, 74, 0.28);
}

/* Estado abierto/activo del botón de estilos */
.map-style-btn.active {
    background: rgba(22, 163, 74, 0.22);
    border-color: rgba(22, 163, 74, 0.6);
    color: #86efac;
}

.map-style-btn:active {
    transform: translateY(0) scale(0.97);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.map-style-btn i {
    width: 21px;
    height: 21px;
}

/* ── Modo claro ── */
html:not(.dark) .map-style-btn {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(22, 163, 74, 0.3);
    color: #166534;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

html:not(.dark) .map-style-btn:hover {
    background: rgba(22, 163, 74, 0.12);
    border-color: rgba(22, 163, 74, 0.55);
    color: #15803d;
    box-shadow: 0 10px 26px rgba(22, 163, 74, 0.22);
}

html:not(.dark) .map-style-btn.active {
    background: rgba(22, 163, 74, 0.16);
    border-color: rgba(22, 163, 74, 0.6);
    color: #15803d;
}

/* Popup colapsable */
.map-style-popup {
    position: absolute;
    top: 58px;
    right: 0;
    width: 280px;
    background: rgba(9, 21, 12, 0.92);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid rgba(22, 163, 74, 0.3);
    border-radius: 16px;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transform-origin: top right;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    overflow: hidden;
}

.map-style-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header del popup */
.map-style-popup-header {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(22, 163, 74, 0.22);
    background: rgba(22, 163, 74, 0.08);
}

.map-style-popup-title {
    font-size: 12px;
    font-weight: 700;
    color: #86efac;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* ── Modo claro ── */
html:not(.dark) .map-style-popup {
    background: rgba(255, 255, 255, 0.97);
    border-color: rgba(22, 163, 74, 0.28);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.16);
}

html:not(.dark) .map-style-popup-header {
    border-bottom-color: rgba(22, 163, 74, 0.18);
    background: rgba(22, 163, 74, 0.07);
}

html:not(.dark) .map-style-popup-title {
    color: #15803d;
}

/* Contenido del popup */
.map-style-popup-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Opciones de estilo de mapa */
.map-style-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(22, 163, 74, 0.18);
    border-radius: 11px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.map-style-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: rgba(16, 185, 129, 0.15);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.map-style-option:hover::before {
    width: 100%;
}

.map-style-option:hover {
    background: rgba(22, 163, 74, 0.12);
    border-color: rgba(22, 163, 74, 0.42);
    transform: translateX(3px);
}

.map-style-option.active {
    background: rgba(22, 163, 74, 0.2);
    border-color: rgba(22, 163, 74, 0.55);
}

.map-style-option.active::before {
    background: rgba(22, 163, 74, 0.12);
    width: 100%;
}

/* ── Modo claro ── */
html:not(.dark) .map-style-option {
    background: rgba(15, 23, 42, 0.025);
    border-color: rgba(22, 163, 74, 0.16);
}

html:not(.dark) .map-style-option:hover {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.4);
}

html:not(.dark) .map-style-option.active {
    background: rgba(22, 163, 74, 0.14);
    border-color: rgba(22, 163, 74, 0.5);
}

/* Icono de la opción */
.map-style-option-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(22, 163, 74, 0.15);
    border-radius: 9px;
    color: #86efac;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.map-style-option:hover .map-style-option-icon {
    background: rgba(22, 163, 74, 0.3);
    transform: scale(1.06);
}

.map-style-option.active .map-style-option-icon {
    background: rgba(22, 163, 74, 0.45);
    color: #ffffff;
}

/* ── Modo claro ── */
html:not(.dark) .map-style-option-icon {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
}

html:not(.dark) .map-style-option:hover .map-style-option-icon {
    background: rgba(22, 163, 74, 0.22);
}

html:not(.dark) .map-style-option.active .map-style-option-icon {
    background: rgba(22, 163, 74, 0.85);
    color: #ffffff;
}

.map-style-option-icon i {
    width: 20px;
    height: 20px;
}

/* Info de la opción */
.map-style-option-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    z-index: 1;
}

.map-style-option-title {
    font-size: 13px;
    font-weight: 600;
    color: #f0fdf4;
    line-height: 1.2;
}

.map-style-option-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.3;
}

/* ── Modo claro ── */
html:not(.dark) .map-style-option-title {
    color: #0f172a;
}

html:not(.dark) .map-style-option-desc {
    color: #64748b;
}

/* Check de selección */
.map-style-option-check {
    width: 24px;
    height: 24px;
    min-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.4);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.map-style-option.active .map-style-option-check {
    opacity: 1;
    transform: scale(1);
    color: #4ade80;
}

html:not(.dark) .map-style-option.active .map-style-option-check {
    color: #16a34a;
}

.map-style-option-check i {
    width: 18px;
    height: 18px;
    stroke-width: 3;
}

/* Animación de entrada */
@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.map-style-popup.active {
    animation: slideInFromTop 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsive */
@media (max-width: 768px) {
    .map-style-container {
        top: 15px;
        right: 15px;
    }

    .map-style-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .map-style-popup {
        width: 260px;
        top: 58px;
    }

    /* Ajustar posición de controles de cámara 3D en móviles */
    .camera-3d-controls {
        top: 15px;
        right: 75px; /* Ajustado para botón VISTA de 48px + 15px gap + 12px */
    }
}