/* ===========================
   Elevation Map Widget Styles
   ===========================*/

/* Variables CSS */
:root {
    --elevation-primary-color: #00a86b;
    --elevation-primary-dark: #006a00;
    --elevation-primary-light: #4ade80;
    --elevation-glass-bg: rgba(255, 255, 255, 0.1);
    --elevation-glass-border: rgba(255, 255, 255, 0.18);
    --elevation-shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.07);
    --elevation-shadow-md: 0 10px 30px rgba(0, 0, 0, 0.1);
    --elevation-shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.15);
    --elevation-border-radius: 16px;
    --elevation-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== ANIMACIONES ===== */
@keyframes elevationFadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes elevationSlideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes elevationPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

@keyframes elevationSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.elevation-map-wrapper {
    width: 100%;
    position: relative;
}

.elevation-map-container-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    animation: elevationFadeInUp 0.6s ease-out;
}

/* ===== HEADER ===== */
.elevation-map-wrapper .header {
    text-align: center;
    margin-bottom: 20px;
    animation: elevationSlideInLeft 0.6s ease-out;
}

.elevation-map-wrapper .header h1 {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 700;
    color: white;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.elevation-map-wrapper .header p {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: rgba(255, 255, 255, 0.9);
    font-weight: 300;
}

/* ===== GLASS CARD ===== */
.elevation-map-wrapper .glass-card {
    background: #ffffff;
    border-radius: var(--elevation-border-radius);
    border: 1px solid var(--elevation-glass-border);
    box-shadow: var(--elevation-shadow-lg);
    overflow: hidden;
    transition: var(--elevation-transition);
    animation: elevationFadeInUp 0.8s ease-out 0.2s backwards;
}

.elevation-map-wrapper .glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.2);
}

/* ===== MAPA ===== */
.elevation-map-wrapper .elevation-map-container {
    width: 100%;
    height: 350px;
    position: relative;
    z-index: 1;
    min-height: 350px;
    max-height: 350px;
    display: block;
    overflow: hidden;
}

.elevation-map-wrapper .elevation-map-container .leaflet-container {
    width: 100% !important;
    height: 100% !important;
    min-height: 350px !important;
}

/* ===== ELEVATION CARD ===== */
.elevation-map-wrapper .elevation-card {
    background: #ffffff;
    border-radius: var(--elevation-border-radius);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: var(--elevation-shadow-md);
    margin-top: 15px;
    overflow: hidden;
    transition: var(--elevation-transition);
    animation: elevationFadeInUp 1s ease-out 0.4s backwards;
}

.elevation-map-wrapper .elevation-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.elevation-map-wrapper .elevation-chart-container {
    height: 200px;
    padding: 15px;
    background: transparent;
    border-radius: var(--elevation-border-radius);
    min-height: 200px;
    position: relative;
}

.elevation-map-wrapper .elevation-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.elevation-map-wrapper .leaflet-control.elevation {
    width: 100% !important;
    height: 160px !important;
    display: block !important;
    visibility: visible !important;
}

.elevation-map-wrapper .leaflet-control.elevation svg {
    width: 100% !important;
    height: 160px !important;
    display: block !important;
    visibility: visible !important;
}

.elevation-map-wrapper .elevation-chart-container .leaflet-control {
    position: relative !important;
    width: 100% !important;
    height: 160px !important;
    display: block !important;
}

.elevation-map-wrapper .elevation-chart-container .elevation {
    width: 100% !important;
    height: 100% !important;
}

/* ===== ESTILOS DE ELEVACIÓN ===== */
.elevation-map-wrapper .elevation-control .area,
.elevation-map-wrapper .elevation svg path.area,
.elevation-map-wrapper .elevation svg .area,
.elevation-map-wrapper .elevation svg path.area-fill,
.elevation-map-wrapper .elevation svg .lime-theme .area {
    fill: #00a86b !important;
    fill-opacity: 0.6 !important;
    stroke: #00a86b !important;
    stroke-width: 2 !important;
    opacity: 1 !important;
    transition: var(--elevation-transition);
}

.elevation-map-wrapper .elevation svg path {
    stroke: var(--elevation-primary-color) !important;
}

.elevation-map-wrapper .elevation svg path:hover {
    opacity: 1 !important;
    filter: drop-shadow(0 0 8px var(--elevation-primary-light));
}

.elevation-map-wrapper .elevation-control .background {
    background-color: rgba(255, 255, 255, 0.95) !important;
}

/* Asegurar que el área se vea */
.elevation-map-wrapper .elevation .area {
    fill: var(--elevation-primary-color) !important;
    fill-opacity: 0.8 !important;
}

/* ===== RESUMEN DE ALTIMETRÍA ===== */
.elevation-map-wrapper .custom-elevation-summary {
    background: #ffffff;
    border-radius: var(--elevation-border-radius);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 15px 20px;
    margin-top: 15px;
    box-shadow: var(--elevation-shadow-md);
    animation: elevationFadeInUp 1.2s ease-out 0.6s backwards;
    transition: var(--elevation-transition);
}

.elevation-map-wrapper .custom-elevation-summary:hover {
    transform: translateY(-3px);
    box-shadow: var(--elevation-shadow-lg);
}

.elevation-map-wrapper .custom-elevation-summary > div {
    color: #333333 !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    margin-bottom: 10px !important;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
    border-left: 4px solid var(--elevation-primary-light);
    transition: var(--elevation-transition);
    display: block !important;
    line-height: 1.6;
    clear: both;
}

.elevation-map-wrapper .custom-elevation-summary .stat-item .stat-icon {
    display: inline-block;
    margin-right: 10px;
    font-size: 1.2em;
}

.elevation-map-wrapper .custom-elevation-summary .stat-item .stat-label {
    margin-right: 8px;
    font-weight: 600;
}

.elevation-map-wrapper .custom-elevation-summary .stat-item .stat-value {
    color: var(--elevation-primary-light) !important;
    font-weight: 700;
}

.elevation-map-wrapper .custom-elevation-summary > div:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
    border-left-width: 6px;
}

.elevation-map-wrapper .custom-elevation-summary > div:last-child {
    margin-bottom: 0 !important;
}

.elevation-map-wrapper .custom-elevation-summary strong {
    color: var(--elevation-primary-light) !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-weight: 700 !important;
}

.elevation-map-wrapper .custom-elevation-summary .icon {
    font-size: 1.3em;
    margin-right: 8px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    animation: elevationPulse 2s infinite;
}

/* ===== OCULTAR MARCADORES ===== */
.elevation-map-wrapper .leaflet-marker-icon,
.elevation-map-wrapper .leaflet-marker-shadow {
    display: none !important;
}

/* ===== LOADING ANIMATION ===== */
.elevation-map-wrapper .elevation-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.elevation-map-wrapper .elevation-loading.active {
    opacity: 1;
}

.elevation-map-wrapper .elevation-loading .spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: elevationSpin 1s linear infinite;
}

/* ===== PREVIEW NOTICE ===== */
.elevation-map-wrapper .elevation-preview-notice {
    background: rgba(255, 193, 7, 0.9);
    color: #000;
    padding: 15px;
    text-align: center;
    border-radius: var(--elevation-border-radius);
    margin-top: 20px;
    font-weight: 600;
}

/* ===== ESTILOS PARA LEAFLET ===== */
.elevation-map-wrapper .leaflet-container {
    background: linear-gradient(135deg, #e0f2f1 0%, #b2dfdb 100%);
    font-family: inherit;
}

.elevation-map-wrapper .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: var(--elevation-shadow-md);
}

.elevation-map-wrapper .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.95);
}

.elevation-map-wrapper .leaflet-control-zoom a {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(10px);
    color: var(--elevation-primary-dark) !important;
    border: none !important;
    transition: var(--elevation-transition) !important;
}

.elevation-map-wrapper .leaflet-control-zoom a:hover {
    background: white !important;
    transform: scale(1.1);
}

.elevation-map-wrapper .leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(10px);
    border-radius: 8px !important;
    padding: 4px 8px !important;
    font-size: 0.75rem !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .elevation-map-wrapper {
        padding: 10px;
    }

    .elevation-map-wrapper .elevation-map-container {
        height: 280px;
    }

    .elevation-map-wrapper .elevation-chart-container {
        height: 150px;
        padding: 8px;
    }

    .elevation-map-wrapper .custom-elevation-summary {
        padding: 15px 18px;
    }

    .elevation-map-wrapper .custom-elevation-summary > div {
        padding: 8px 12px;
        font-size: 0.9rem !important;
    }

    .elevation-map-wrapper .header h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .elevation-map-wrapper {
        padding: 10px;
    }

    .elevation-map-wrapper .elevation-map-container {
        height: 250px;
    }

    .elevation-map-wrapper .elevation-chart-container {
        height: 150px;
    }

    .elevation-map-wrapper .custom-elevation-summary > div {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px;
    }
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .elevation-map-wrapper .elevation-map-container {
        height: 250px;
    }

    .elevation-map-wrapper .elevation-chart-container {
        height: 150px;
    }

    .elevation-map-wrapper .header {
        margin-bottom: 15px;
    }
}

/* ===== ACCESIBILIDAD ===== */
@media (prefers-reduced-motion: reduce) {
    .elevation-map-wrapper *,
    .elevation-map-wrapper *::before,
    .elevation-map-wrapper *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== SCROLL SUAVE ===== */
.elevation-map-wrapper {
    scroll-behavior: smooth;
}

/* ===== AJUSTES PARA ELEMENTOR ===== */
.elementor-widget-elevation_map .elevation-map-wrapper {
    margin: 0 !important;
}

.elementor-widget-elevation_map {
    margin-bottom: 0 !important;
}

/* Asegurar que el contenedor se ajuste correctamente */
.elevation-map-container-wrapper {
    width: 100%;
    max-width: 100%;
}

/* Fix para el gráfico de elevación */
#elevation-div .elevation,
[id^="elevation-"] .elevation {
    width: 100% !important;
    height: 100% !important;
    position: relative !important;
}

/* Forzar visibilidad del contenedor de elevación */
.elevation-chart-container {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Asegurar que Leaflet control sea visible */
.elevation-chart-container .leaflet-control-elevation {
    display: block !important;
    visibility: visible !important;
}

/* Fix específico para el área del gráfico */
.elevation svg,
.elevation canvas {
    display: block !important;
    visibility: visible !important;
}

/* Forzar tema lime y colores */
.elevation .lime-theme .area,
.leaflet-control-elevation .lime-theme .area,
.elevation-chart-container .area {
    fill: #00a86b !important;
    fill-opacity: 0.8 !important;
    stroke: #00a86b !important;
    stroke-width: 2 !important;
}

/* Grid y ejes */
.elevation svg .grid .tick line {
    stroke: rgba(0, 0, 0, 0.1) !important;
}

.elevation svg .axis path,
.elevation svg .axis line {
    stroke: rgba(0, 0, 0, 0.3) !important;
}
