/* ─── Bento Card Modular ────────────────────────────────────────────────── */
.elementor-widget-bajonalon_bento_card,
.elementor-widget-bajonalon_bento_card .elementor-widget-container {
    height: 100%;
}

.bn-bento-card {
    position: relative;
    border-radius: 40px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    font-family: var(--e-global-typography-text-font-family);
}

.bn-bento-card:hover {
    transform: scale(1.02);
}

/* --- Flip Effect --- */
.bn-bento-card.bn-has-flip {
    perspective: 1500px; /* Increased perspective for a more formal feel */
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
    height: 100%;
    min-height: 280px;
}

.bn-bento-card.bn-has-flip:hover {
    transform: none !important;
}

.bn-bento-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.9s cubic-bezier(0.65, 0, 0.35, 1);
    transform-style: preserve-3d;
    border-radius: inherit;
}

.bn-bento-card.bn-has-flip:hover .bn-bento-inner {
    transform: rotateY(180deg) scale(1.01);
}

.bn-bento-front, .bn-bento-back {
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: inherit;
    overflow: hidden;
    transform: translateZ(0); /* Fix for blurriness in 3D transforms */
}

.bn-bento-front {
    position: relative;
    z-index: 2;
    transform: rotateY(0deg);
    box-shadow: var(--bn-shadow-md);
}

.bn-bento-back {
    position: absolute;
    inset: 0;
    z-index: 1;
    transform: rotateY(180deg);
    background: linear-gradient(145deg, #00222e 0%, #00151d 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 30px;
    box-shadow: var(--bn-shadow-lg);
}

.bn-bento-back .bn-back-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.2;
    z-index: -1;
    filter: grayscale(20%); /* Removed blur(1px) as it can cause subpixel rendering issues */
}

.bn-bento-back .bn-card-overlay {
    position: relative;
    padding: 0;
    background: transparent;
    text-align: left;
}

.bn-bento-back h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--bn-color-white);
    opacity: 0.9;
}

.bn-bento-back .bn-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 400;
    margin-bottom: 25px;
    text-align: justify;
}

.bn-back-btn {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 10px;
    padding: 12px 24px;
    background: var(--e-global-color-primary);
    color: var(--bn-color-white) !important;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none !important;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.bn-back-btn:hover {
    background: var(--bn-color-white);
    color: var(--e-global-color-primary) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.bn-back-btn i {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.bn-back-btn:hover i {
    transform: translateX(4px);
}

.bn-bento-card .bn-bento-img {
    position: relative;
    width: 100% !important;
    height: auto;
    min-height: 100%;
    object-fit: cover;
    display: block;
    z-index: 0;
}

/* Fallback para cualquier otra imagen que no tenga la clase nueva */
.bn-bento-card:not(.type-icon):not(.type-weather):not(.type-map) img:not(.bn-bento-img):not(.bn-back-bg):not(.bn-weather-icon) {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    z-index: 0;
}

.bn-bento-card.type-overlay {
    height: auto;
    min-height: 320px;
}

.bn-bento-card svg{
    fill: currentColor !important;

}

/* --- Variantes de Overlay (Surf, Dining, etc) --- */
.bn-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 80px 30px 40px; /* Más padding superior para el degradado */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
    color: var(--bn-color-white);
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.bn-card-overlay h3 {
    font-size: 2.3rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--bn-color-white);
    margin: 0;
}

.bn-card-overlay .bn-description {
    font-size: 1.1rem;
    line-height: 1.4;
    margin-top: 10px;
    opacity: 0.9;
    color: var(--bn-color-white);
}

.bn-tag {
    display: inline-block;
    align-self: flex-start;
    padding: 6px 15px;
    border-radius: var(--bn-radius-sm);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.bn-tag-blue   { background: var(--e-global-color-secondary); color: var(--bn-color-white); }
.bn-tag-yellow { background: var(--bn-color-yellow);          color: var(--e-global-color-text); }
.bn-tag-orange { background: var(--e-global-color-primary);   color: var(--bn-color-white); }
.bn-tag-dark   { background: var(--bn-color-surface-dark);    color: var(--bn-color-white); }

/* --- Variante Icono Modular (Unified Icon Box) --- */
.bn-bento-card.type-icon {
    background: var(--bn-color-white);
    color: var(--e-global-color-text);
    padding: var(--bn-space-xl) var(--bn-space-lg);
    display: flex;
    gap: var(--bn-space-lg);
    transition: all var(--bn-dur-base) ease;
}

/* Layout: Top (Vertical) */
.bn-bento-card.type-icon.layout-top {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* Layout: Left (Horizontal) */
.bn-bento-card.type-icon.layout-left {
    flex-direction: row;
    align-items: center;
    text-align: left;
}

/* Layout: Right (Horizontal Inverse) */
.bn-bento-card.type-icon.layout-right {
    flex-direction: row-reverse;
    align-items: center;
    text-align: right;
}

/* Elementos internos */
.bn-bento-card.type-icon .bn-icon-wrapper {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.04);
    border-radius: var(--bn-radius-md);
    transition: transform var(--bn-dur-base) var(--bn-ease-bounce);
}

.bn-bento-card.type-icon:hover .bn-icon-wrapper {
    transform: scale(1.1);
}

.bn-bento-card.type-icon .bn-icon-wrapper i,
.bn-bento-card.type-icon .bn-icon-wrapper svg {
    font-size: 2.2rem;
    color: var(--e-global-color-primary);
    fill: var(--e-global-color-primary);
    opacity: 1;
}

/* Ajuste tamaño icono para layout top (más grande por defecto si no se cambia) */
.bn-bento-card.type-icon.layout-top .bn-icon-wrapper {
    width: 80px;
    height: 80px;
    margin-bottom: var(--bn-space-xs);
}

.bn-bento-card.type-icon.layout-top .bn-icon-wrapper i {
    font-size: 3rem;
}

.bn-bento-card.type-icon .bn-text-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.bn-bento-card.type-icon h3 {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.1;
    margin: 0;
    color: var(--e-global-color-text);
}

.bn-bento-card.type-icon .bn-subtitle {
    font-size: 1.05rem;
    margin: 0;
    opacity: 0.7;
    font-weight: 500;
    line-height: 1.4;
}

.bn-download-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--e-global-color-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.bn-download-count i {
    font-size: 0.9rem !important;
}

/* --- Variante Descarga (Download Card) --- */
.bn-bento-card.type-download {
    background: var(--bn-color-bg-soft);
    border: 1px solid var(--bn-color-border);
}

.bn-bento-card.type-download .bn-icon-wrapper {
    background: var(--e-global-color-primary);
    color: var(--bn-color-white);
}

.bn-bento-card.type-download .bn-icon-wrapper i,
.bn-bento-card.type-download .bn-icon-wrapper svg {
    color: var(--bn-color-white);
    fill: var(--bn-color-white);
    font-size: 1.8rem;
}

.bn-bento-card.type-download:hover {
    background: var(--bn-color-white);
    border-color: var(--e-global-color-primary);
    box-shadow: var(--bn-shadow-lg);
}

.bn-bento-card.type-download:hover .bn-icon-wrapper {
    transform: scale(1.1) rotate(-10deg);
}

/* --- Variante Clima (Weather) --- */
.bn-bento-card.type-weather svg{
    width: 15%;
    height: auto;
}

.bn-bento-card.type-weather {
    background: var(--e-global-color-primary);
    color: var(--bn-color-white);
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.bn-weather-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bn-weather-top i {
    font-size: 3rem;
}

.bn-weather-top .bn-temp {
    font-size: 5rem;
    font-weight: 800;
}

.bn-weather-bottom p {
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
    font-size: 0.9rem;
    margin: 0;
}

.bn-weather-bottom h4 {
    font-size: 2.3rem;
    font-weight: 700;
    margin: 5px 0 0 0;
}

img.bn-weather-icon{
    width: 25%;
    max-width: 40px;
}

/* --- Variante Mapa (Map) --- */
.bn-bento-card.type-map {
    position: relative;
    padding: 0;
    min-height: 350px; /* Valor por defecto base */
    overflow: hidden;
}

.bn-map-canvas {
    width: 100%;
    height: 100%;
    flex: 1;
    min-height: 350px;
    z-index: 1;
}

.bn-map-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 40px 25px 25px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
    color: var(--bn-color-white);
    z-index: 5;
    pointer-events: none; /* Dejar que los clics pasen al mapa */
}

.bn-map-overlay h3 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.bn-bento-card.type-map .leaflet-container {
    background: #f8f9fa;
    font-family: inherit;
}

/* Controles de mapa personalizados */
.bn-map-layer-control {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
}

.bn-map-layer-control .btn-layer-sat,
.bn-map-layer-control .btn-recenter {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bn-color-white);
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    color: var(--bn-color-neutral-800);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.bn-map-layer-control .btn-layer-sat:hover,
.bn-map-layer-control .btn-recenter:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.bn-map-layer-control .btn-layer-sat.is-active {
    background: var(--bn-color-primary);
    color: var(--bn-color-white);
}

.bn-map-layer-control .hidden {
    display: none !important;
}

/* --- Experiencia Radical de Mapa Inmersivo --- */
.bn-map-immersive-panel {
    position: absolute;
    bottom: -100%;
    left: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    padding: 0;
    z-index: 1001;
    transition: all 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(255,255,255,0.2) inset;
    max-height: 85%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bn-map-immersive-panel.is-open {
    bottom: 20px;
}

.bn-panel-content {
    display: flex;
    flex-direction: column;
    position: relative;
    max-height: 100%;
}

.bn-map-focus-mode .bn-map-overlay {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-20px);
    transition: all 0.4s ease;
}

/* Imagen Flush */
.bn-panel-img-wrap {
    position: relative;
    width: 100%;
    height: 160px;
    flex-shrink: 0;
    overflow: hidden;
}

.bn-panel-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

.bn-map-immersive-panel:hover .bn-panel-img {
    transform: scale(1.05);
}

.bn-panel-img-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.6) 100%);
}

/* Close Button */
.bn-panel-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #333;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.bn-panel-close.has-img {
    background: rgba(0, 0, 0, 0.5);
    color: white;
}

.bn-panel-close:hover {
    transform: scale(1.1) rotate(90deg);
    background: var(--e-global-color-primary);
    color: white;
}

/* Panel Body */
.bn-panel-body {
    padding: 24px;
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bn-panel-body h3 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--e-global-color-text);
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.5px;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.bn-panel-title-link {
    text-decoration: none;
    display: inline-block;
}

.bn-panel-title-link h3 {
    color: var(--e-global-color-primary);
}

.bn-panel-title-link h3::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: var(--e-global-color-primary);
    transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bn-panel-title-link:hover h3 {
    color: #ff6b2b;
}

.bn-panel-title-link:hover h3::after {
    width: 100%;
    background-color: #ff6b2b;
}

.bn-panel-title-link h3 i {
    width: 18px;
    height: 18px;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bn-panel-title-link:hover h3 i {
    transform: translate(3px, -3px);
}

/* Animación de pulso para marcador activo */
@keyframes pinPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.pin-marker.is-active-pulse {
    animation: pinPulse 2s infinite ease-in-out;
}

/* Ajustes Leaflet para modo inmersivo */
.bn-bento-card.type-map .leaflet-container {
    transition: filter 0.5s ease;
}

.bn-map-focus-mode .leaflet-container {
    filter: brightness(0.95) saturate(1.1);
}

/* Cluster Markers */
.custom-leaflet-cluster-icon {
    background: transparent;
    border: none;
}

.bn-cluster-marker {
    width: 36px;
    height: 36px;
    background: var(--bn-color-primary, #E74F08);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    border: 3px solid white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.custom-leaflet-cluster-icon:hover .bn-cluster-marker {
    transform: scale(1.1);
}

/* Two-finger warning */
.bn-map-warning-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.bn-map-warning-overlay.is-visible {
    opacity: 1;
}

.bn-map-warning-overlay span {
    background: rgba(0,0,0,0.8);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Ajustes Leaflet */

.bn-bento-card.type-map .leaflet-bar {
    border: none !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.bn-bento-card.type-map .leaflet-bar a {
    width: 30px !important;
    height: 30px !important;
    line-height: 30px !important;
    background-color: var(--bn-color-white) !important;
    color: var(--bn-color-neutral-800) !important;
    border-bottom: 1px solid #eee !important;
}

.bn-bento-card.type-map .leaflet-bar a:first-child {
    border-top-left-radius: 8px !important;
    border-top-right-radius: 8px !important;
}

.bn-bento-card.type-map .leaflet-bar a:last-child {
    border-bottom-left-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
    border-bottom: none !important;
}

.bn-bento-card.type-map .leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 5px;
}

/* --- Responsive Adaptability --- */
@media (max-width: 1024px) {
    .bn-bento-card {
        border-radius: var(--bn-radius-lg);
    }
    .bn-card-overlay {
        padding: 40px 20px;
    }
    .bn-card-overlay h3 {
        font-size: 1.8rem;
    }
    .bn-bento-card.type-icon i {
        font-size: 3rem;
    }
    .bn-bento-card.type-icon h3 {
        font-size: 1.8rem;
    }
    .bn-weather-top i {
        font-size: 2.5rem;
    }
    .bn-weather-top .bn-temp {
        font-size: 3rem;
    }
    .bn-weather-bottom h4 {
        font-size: 1.8rem;
    }
}

@media (max-width: 700px) {
    .bn-card-overlay h3 {
        font-size: 1.5rem;
    }
    .bn-tag {
        font-size: 0.8rem;
        padding: 4px 10px;
    }
    .bn-bento-card.type-icon {
        padding: var(--bn-space-lg) var(--bn-space-md);
        gap: var(--bn-space-md);
    }
    .bn-bento-card.type-icon.layout-top .bn-icon-wrapper {
        width: 64px;
        height: 64px;
    }
    .bn-bento-card.type-icon.layout-top .bn-icon-wrapper i {
        font-size: 2.2rem;
    }
    .bn-bento-card.type-icon .bn-icon-wrapper {
        width: 48px;
        height: 48px;
    }
    .bn-bento-card.type-icon .bn-icon-wrapper i,
    .bn-bento-card.type-icon .bn-icon-wrapper svg {
        font-size: 1.5rem;
    }
    .bn-bento-card.type-icon h3 {
        font-size: 1.4rem;
    }
    .bn-bento-card.type-icon .bn-subtitle {
        font-size: 0.95rem;
    }
    .bn-bento-card.type-weather {
        padding: 20px;
    }
}

/* --- Video: overlay central play button + aspect ratio --- */
.bn-bento-card.type-video {
    /* Keep rounded corners and overflow from parent, ensure consistent aspect */
    display: block;
    aspect-ratio: 16 / 9;
    min-height: 160px;
    width: 100%;
    position: relative; /* ensure absolute overlay positions correctly */
}

.bn-bento-card.type-video img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bn-bento-card .play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
    transition: background 0.25s ease;
    pointer-events: none; /* allow clicks to pass through except the button */
}

.bn-bento-card .play-overlay::before {
    /* subtle dark vignette to improve contrast on the play button */
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.15), rgba(0,0,0,0));
    border-radius: inherit;
    pointer-events: none;
}

.bn-bento-card .play-overlay .play-btn {
    pointer-events: auto; /* make the button clickable */
    background: rgba(0,0,0,0.6);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bn-color-white);
    font-size: 1.6rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    transition: transform 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.bn-bento-card .play-overlay .play-btn i{
    margin-left: 3px; /* visually centers the triangular icon */
}

.bn-bento-card:hover .play-overlay .play-btn {
    transform: scale(1.06);
    background: rgba(0,0,0,0.72);
}

@media (max-width: 1024px) {
    .bn-bento-card.type-video { aspect-ratio: 4 / 3; min-height: 140px; }
    .bn-bento-card .play-overlay .play-btn { width: 64px; height: 64px; }
}

@media (max-width: 700px) {
    .bn-bento-card.type-video { aspect-ratio: 1 / 1; min-height: 120px; }
    .bn-bento-card .play-overlay .play-btn { width: 54px; height: 54px; font-size: 1.2rem; }
}
