.visor-vci-map-wrapper {
    margin: 20px auto;
    width: 100%;
    position: relative;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    background: #fff;
    box-sizing: border-box;
}

/* Clase para pantalla completa / ancho total */
.visor-vci-map-wrapper.full-width {
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    max-width: none !important;
    width: 100vw !important;
    border: none;
    border-radius: 0;
    padding: 0;
}

.visor-vci-map-wrapper.full-width .visor-vci-topbar {
    position: static;
    background: #1E88E5;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 6px;
    box-shadow: none;
    border: 1px solid #333333;
}

.visor-vci-map-wrapper.full-width .visor-vci-select {
    width: 260px;
    max-width: none;
}

.visor-vci-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.visor-vci-topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    background: #1E88E5;
    color: #ffffff;
    border: 1px solid #333333;
    border-radius: 6px;
    padding: 10px 16px;
}

.visor-vci-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

.visor-vci-body {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.visor-vci-map {
    flex: 2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.visor-vci-layer-selector {
    position: absolute;
    top: 60px;
    right: 10px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(0,0,0,.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.visor-vci-layer-selector label {
    font-size: 12px;
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.visor-vci-layer-selector input[type="radio"] {
    margin: 0;
}

.visor-vci-map-controls {
    position: absolute;
    top: 80px;
    left: 10px;
    z-index: 100;
    pointer-events: none; /* Dejar pasar eventos al mapa excepto a los hijos que activen pointer-events */
}

.visor-vci-hamburger {
    background: #ffffff;
    border: none;
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(0,0,0,.1);
    cursor: pointer;
    width: 34px;
    height: 34px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 0;
    pointer-events: auto;
    transition: background 0.2s ease;
}

.visor-vci-hamburger:hover {
    background: #f4f4f4;
}

.visor-vci-hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: #333;
    transition: all 0.2s ease;
}

.visor-vci-hamburger.is-active span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.visor-vci-hamburger.is-active span:nth-child(2) {
    opacity: 0;
}

.visor-vci-hamburger.is-active span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.visor-vci-modal {
    position: absolute;
    top: 40px;
    left: 0;
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    width: 350px;
    display: none;
    pointer-events: auto;
    overflow: hidden;
}

.visor-vci-modal.is-open {
    display: block;
}

.visor-vci-modal-content {
    padding: 12px;
}

.visor-vci-opacity-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.visor-vci-opacity-control label {
    font-size: 11px !important;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
}

.visor-vci-opacity-control input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.visor-vci-layer-toggle {
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.visor-vci-layer-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px !important;
    cursor: pointer;
    color: #333;
}

.visor-vci-layer-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

#visor-vci-map-container {
    width: 100%;
    min-height: 600px;
}

.visor-vci-select, .visor-vci-input-date {
    width: 260px;
    height: 40px;
    background: #FFFFFF;
    border: 1px solid #000000;
    border-radius: 4px;
    padding: 0 45px 0 4px; /* Aumentado padding-right para dar espacio a la X y la flecha */
    box-sizing: border-box;
    font-family: 'Roboto', serif;
    font-style: normal;
    font-weight: 400;
    font-size: 16px;
    line-height: 150%;
}

.visor-vci-clearable {
    position: relative;
    display: inline-block;
}

.visor-vci-clear-btn {
    position: absolute;
    right: 25px; /* Movido a la izquierda para no tapar la flecha */
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    font-size: 20px; /* Aumentado de 16px a 20px */
    cursor: pointer;
    color: #999;
    display: none; /* Oculto por defecto */
    align-items: center;
    justify-content: center;
    height: 100%;
    line-height: 1; /* Asegurar que el texto no herede line-heights que lo desplacen */
}

.visor-vci-clear-btn.is-visible {
    display: flex; /* Mostrar solo cuando tenga la clase is-visible */
}

.visor-vci-clear-btn:hover {
    color: #333;
}

.visor-vci-input-date {
    cursor: pointer;
}

.visor-vci-layer-control {
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 13px;
    margin-left: 10px;
}

.visor-vci-layer-control label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    white-space: nowrap;
}

.visor-vci-sidebar {
    flex: 1;
    min-width: 220px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #f9f9f9;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.visor-vci-tabs {
    display: flex;
    align-items: stretch;
    gap: 0;
    border-bottom: 1px solid #d5d5d5;
}

.visor-vci-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.visor-vci-tab:hover,
.visor-vci-tab:focus {
    color: #111;
    background: #f0f2f4;
}

.visor-vci-tab.is-active {
    border-color: #111;
    color: #111;
    background: #fff;
}

.visor-vci-summary {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.visor-vci-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

.visor-vci-summary-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.visor-vci-regional-chart-container,
.visor-vci-charts-container {
    width: 100%;
    min-height: 100px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.visor-vci-charts-container {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
}

.visor-vci-regional-chart-container {
    margin-bottom: 12px;
    min-height: auto;
}

.visor-vci-regional-chart-title {
    font-size: 13px;
    font-weight: 700;
    color: #2f6b2f;
    margin-bottom: 4px;
    text-align: center;
}

.visor-vci-chart {
    display: flex;
    flex-direction: row; /* Cambiado a row para poner el label al lado */
    align-items: stretch;
    gap: 0;
    width: calc(100% - 2px); /* Ajuste para evitar scroll horizontal por bordes */
    border: 1px solid #ccc;
    margin-bottom: 8px;
    background: #fff;
    box-sizing: border-box;
}

.visor-vci-chart-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 11px;
    font-weight: 700;
    color: #2f6b2f;
    text-align: center;
    background: #e0e0e0;
    padding: 4px 2px;
    border-left: 1px solid #ccc;
    min-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.visor-vci-chart-canvas-container {
    flex-grow: 1;
    position: relative;
    height: 120px; /* Incrementado para dar espacio a los años en el eje X */
    padding: 5px;
}

.visor-vci-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

.visor-vci-summary-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1f1f1f;
}

.visor-vci-gauge {
    position: relative;
    width: 250px;
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.visor-vci-gauge canvas {
    width: 250px !important;
    height: 250px !important;
}

.visor-vci-gauge-info {
    position: absolute;
    left: 50%;
    bottom: 5px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

.visor-vci-gauge-value {
    font-size: 32px;
    font-weight: 700;
    color: #111;
    line-height: 1;
}

.visor-vci-gauge-label {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-top: 4px;
    white-space: nowrap;
}

.visor-vci-downloads-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-top: 10px;
}

.visor-vci-downloads {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.visor-vci-download-logo img {
    max-height: 40px;
    width: auto;
    display: block;
}

.visor-vci-download-button {
    background: #0051A8;
    color: #FFFFFF !important;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-family: 'Roboto', sans-serif;
    font-style: normal;
    font-weight: 700;
    font-size: 16px;
    line-height: 150%;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease;
    flex: 1;
    min-width: 150px;
}

.visor-vci-download-button:hover{
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.26), rgba(0, 0, 0, 0.26)), #0051A8;
}

.visor-vci-download-button:focus {
    background: #0051A8;
    border: 3px solid #FFBE5C;
}

.visor-vci-error-message {
    background: #fee;
    color: #c00;
    padding: 10px;
    margin-top: 10px;
    border-radius: 4px;
    border: 1px solid #fcc;
    font-size: 14px;
}

.visor-vci-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
    padding: 10px 0 0 0;
}

.visor-vci-legend-items-wrapper {
    display: flex;
    justify-content: flex-start;
    gap: 2px;
    flex-wrap: nowrap;
    width: 100%;
}

.visor-vci-ndvi-selector-modal {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.visor-vci-ndvi-selector-modal > label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #333;
}

.visor-vci-ndvi-layer-selector {
    display: flex;
    gap: 15px;
    padding: 5px 10px;
    background: #f0f2f4;
    border-radius: 4px;
    margin-bottom: 5px;
    border: 1px solid #d5d5d5;
}

.visor-vci-ndvi-layer-selector label {
    font-size: 12px !important;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: #333;
}

.visor-vci-ndvi-layer-selector input[type="radio"] {
    margin: 0;
}

.visor-vci-legend-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    min-width: 0;
}

.visor-vci-legend-color {
    height: 30px;
    width: 100%;
    margin-bottom: 5px;
    box-sizing: border-box;
}

.visor-vci-legend-range {
    font-size: 9px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
}

.visor-vci-legend-label {
    font-size: 8px;
    line-height: 1.1;
    color: #333;
    word-wrap: break-word;
}

@media (max-width: 900px) {
    .visor-vci-legend-items-wrapper {
        flex-wrap: wrap;
    }
    .visor-vci-legend-item {
        flex: 1 1 18%;
        margin-bottom: 10px;
    }
}

@media (max-width: 900px) {
    .visor-vci-body {
        flex-direction: column;
    }

    .visor-vci-sidebar {
        min-height: 160px;
    }

    .visor-vci-summary-row {
        flex-direction: column;
        align-items: center;
    }

    .visor-vci-downloads-container {
        flex-direction: column;
        align-items: center;
    }

    .visor-vci-downloads {
        justify-content: center;
        width: 100%;
    }
}
