/**
 * Elementor Modern Carousel - Custom Carousel Styles
 */

/* =============================================
   VARIABLES CSS
   ============================================= */
.emc-custom-carousel {
    --peek-amount: 15%;
    --slide-gap: 20px;
    --transition-speed: 400ms;
    --emc-grid-columns: 4;
}

/* =============================================
   ESTRUCTURA PRINCIPAL
   ============================================= */
.emc-custom-carousel-wrapper {
    position: relative;
    width: 100%;
    overflow: visible;
}

.emc-custom-carousel {
    position: relative;
    overflow: hidden;
    width: 100%;
    touch-action: pan-y;
}

.emc-custom-carousel.emc-native-carousel {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.emc-custom-carousel.emc-native-carousel.dragging {
    cursor: grabbing;
}

.emc-custom-carousel:not(.emc-display-grid) .emc-custom-carousel-track {
    display: flex !important;
    align-items: stretch;
    width: auto;
    will-change: transform;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    transition: transform var(--transition-speed, 500ms) cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.emc-custom-carousel:not(.emc-display-grid) .emc-custom-carousel-track.is-animating {
    transition: transform var(--transition-speed, 500ms) cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.emc-custom-carousel:not(.emc-display-grid) .emc-custom-carousel-track.is-instant,
.emc-custom-carousel:not(.emc-display-grid).dragging .emc-custom-carousel-track {
    transition: none !important;
}

.emc-custom-slide.emc-clone {
    pointer-events: none;
}

/* Modo Grid */
.emc-custom-carousel.emc-display-grid {
    overflow: visible;
    cursor: default;
    touch-action: auto;
    user-select: auto;
}

.emc-custom-carousel.emc-display-grid .emc-custom-carousel-track {
    display: grid !important;
    grid-template-columns: repeat(var(--emc-grid-columns, 4), minmax(0, 1fr));
    gap: var(--slide-gap, 20px);
    width: 100% !important;
    max-width: 100%;
    transform: none !important;
    transition: none !important;
    will-change: auto;
}

.emc-custom-carousel.emc-display-grid .emc-custom-slide,
.emc-custom-carousel.emc-display-grid .emc-custom-slide.emc-clone {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: none !important;
    padding: 0 !important;
    display: block;
}

.emc-custom-carousel.emc-display-grid .emc-custom-slide.emc-clone {
    display: none !important;
}

/* Grid fade-in escalonado al entrar en viewport */
.emc-custom-carousel.emc-display-grid.emc-grid-animate .emc-custom-slide:not(.emc-clone) {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
    transition:
        opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1) var(--emc-grid-delay, 0ms),
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1) var(--emc-grid-delay, 0ms);
    will-change: opacity, transform;
}

.emc-custom-carousel.emc-display-grid.emc-grid-animate .emc-custom-slide.emc-grid-inview {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

@media (prefers-reduced-motion: reduce) {
    .emc-custom-carousel.emc-display-grid.emc-grid-animate .emc-custom-slide:not(.emc-clone) {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

.emc-custom-carousel-wrapper.emc-mode-grid .emc-nav-btn,
.emc-custom-carousel-wrapper.emc-mode-grid .emc-navigation,
.emc-custom-carousel-wrapper.emc-mode-grid .emc-custom-counter {
    display: none !important;
}

.emc-custom-carousel-track.emc-no-transition {
    transition: none !important;
}

/* =============================================
   SLIDES
   ============================================= */
.emc-custom-slide {
    flex: 0 0 auto;
    position: relative;
    box-sizing: border-box;
    padding: 0 calc(var(--slide-gap) / 2);
    height: auto;
    min-width: 0;
}

.emc-custom-slide-inner {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.emc-custom-slide-link {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.emc-custom-slide-image {
    position: relative;
    width: 100%;
    height: 450px;
    overflow: hidden;
    background-color: #f5f5f5;
}

.emc-custom-slide-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.5s ease, filter 0.3s ease;
}

/* Modo Auto: la imagen mantiene su proporcion natural al 100% de ancho */
.emc-custom-carousel-wrapper.emc-height-mode-auto .emc-custom-slide-image {
    height: auto;
    background-color: transparent;
}

.emc-custom-carousel-wrapper.emc-height-mode-auto .emc-custom-slide-image img {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    height: auto;
    object-fit: initial;
    display: block;
}

/* =============================================
   EFECTOS HOVER
   ============================================= */
.emc-hover-zoom:hover .emc-custom-slide-image img {
    transform: scale(1.08);
}

.emc-has-flip.emc-flip-trigger-hover .emc-hover-zoom:hover .emc-custom-slide-image img {
    transform: none;
}

.emc-hover-brightness:hover .emc-custom-slide-image img {
    filter: brightness(1.1);
}

.emc-hover-blur:hover .emc-custom-slide-image img {
    filter: blur(3px);
}

/* =============================================
   OVERLAY
   ============================================= */
.emc-custom-overlay {
    --overlay-color: rgba(0, 0, 0, 0.5);
    --gradient-direction: to top;
    --gradient-size: 70%;
    
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    padding: 25px;
    box-sizing: border-box;
    z-index: 5;
    border-radius: inherit;
    pointer-events: none;
}

.emc-custom-overlay > * {
    pointer-events: auto;
}

/* Overlay solido */
.emc-overlay-solid {
    background-color: var(--overlay-color);
}

/* Overlay gradiente */
.emc-overlay-gradient {
    background: linear-gradient(var(--gradient-direction), var(--overlay-color) 0%, transparent var(--gradient-size));
}

/* Sin overlay */
.emc-overlay-none {
    background: transparent;
}

/* =============================================
   POSICIONES DEL CONTENIDO
   ============================================= */
/* Top */
.emc-position-top-left {
    align-items: flex-start;
    justify-content: flex-start;
}

.emc-position-top-center {
    align-items: flex-start;
    justify-content: center;
}

.emc-position-top-right {
    align-items: flex-start;
    justify-content: flex-end;
}

/* Center */
.emc-position-center-left {
    align-items: center;
    justify-content: flex-start;
}

.emc-position-center-center {
    align-items: center;
    justify-content: center;
}

.emc-position-center-right {
    align-items: center;
    justify-content: flex-end;
}

/* Bottom */
.emc-position-bottom-left {
    align-items: flex-end;
    justify-content: flex-start;
}

.emc-position-bottom-center {
    align-items: flex-end;
    justify-content: center;
}

.emc-position-bottom-right {
    align-items: flex-end;
    justify-content: flex-end;
}

/* =============================================
   CONTENIDO
   ============================================= */
.emc-custom-content {
    max-width: 100%;
}

.emc-custom-content-below {
    padding: 15px 5px;
}

/* Typography sizes/weights come from Elementor controls — do not hardcode them here. */
.emc-custom-carousel :is(h1, h2, h3, h4, h5, h6).emc-custom-title {
    margin: 0 0 8px 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.emc-custom-title {
    margin: 0 0 8px 0;
    color: #ffffff;
}

.emc-custom-content-below .emc-custom-title a {
    color: inherit;
    text-decoration: none;
}

.emc-custom-content-below .emc-custom-title a:hover {
    opacity: 0.8;
}

.emc-custom-subtitle {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.emc-custom-description {
    margin: 0 0 15px 0;
    color: rgba(255, 255, 255, 0.9);
}

/* =============================================
   BOTON
   ============================================= */
.emc-custom-button {
    display: inline-block;
    padding: 12px 24px;
    text-decoration: none;
    color: #ffffff;
    background-color: #333333;
    border: 2px solid #333333;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    margin-top: 5px;
}

.emc-custom-button:hover {
    color: #333333;
    background-color: #ffffff;
    border-color: #ffffff;
}

/* =============================================
   BADGE
   ============================================= */
.emc-custom-badge {
    position: absolute;
    padding: 6px 12px;
    background-color: #e53935;
    color: #ffffff;
    border-radius: 4px;
    z-index: 10;
}

.emc-badge-top-left {
    top: 15px;
    left: 15px;
}

.emc-badge-top-right {
    top: 15px;
    right: 15px;
}

.emc-badge-bottom-left {
    bottom: 15px;
    left: 15px;
}

.emc-badge-bottom-right {
    bottom: 15px;
    right: 15px;
}

/* =============================================
   CONTADOR
   ============================================= */
.emc-custom-counter {
    position: absolute;
    bottom: 15px;
    right: 15px;
    padding: 6px 12px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    z-index: 15;
    pointer-events: none;
}

/* =============================================
  NAVEGACION OVERLAY (SOBRE IMAGEN)
  ============================================= */
.emc-nav-overlay-btn {
    position: absolute;
    z-index: 20;
    pointer-events: auto;
}

.emc-custom-carousel-wrapper .emc-nav-btn {
    pointer-events: auto;
    cursor: pointer;
}

.emc-custom-carousel-wrapper .emc-nav-btn.emc-nav-disabled,
.emc-custom-carousel-wrapper .emc-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.emc-nav-pos-sides.emc-prev {
    top: 50%;
    left: 25px;
    transform: translateY(-50%);
}

.emc-nav-pos-sides.emc-next {
    top: 50%;
    right: 25px;
    transform: translateY(-50%);
}

.emc-nav-pos-overlay-bottom-center.emc-prev {
    bottom: 20px;
    left: calc(50% - 48px);
}

.emc-nav-pos-overlay-bottom-center.emc-next {
    bottom: 20px;
    left: calc(50% + 8px);
}

.emc-nav-pos-overlay-bottom-corners.emc-prev {
    bottom: 20px;
    left: 20px;
}

.emc-nav-pos-overlay-bottom-corners.emc-next {
    bottom: 20px;
    right: 20px;
}

.emc-nav-pos-overlay-top-corners.emc-prev {
    top: 20px;
    left: 20px;
}

.emc-nav-pos-overlay-top-corners.emc-next {
    top: 20px;
    right: 20px;
}

.emc-nav-pos-sides:hover {
    transform: translateY(-50%) scale(1.1);
}

/* Variantes visuales de flechas */
.emc-custom-carousel-wrapper.emc-arrows-style-outline .emc-nav-btn {
    background-color: transparent;
}

.emc-custom-carousel-wrapper.emc-arrows-style-outline .emc-nav-btn:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.08);
}

.emc-custom-carousel-wrapper.emc-arrows-style-icon-only .emc-nav-btn {
    background-color: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.emc-custom-carousel-wrapper.emc-arrows-style-icon-only .emc-nav-btn:hover:not(:disabled) {
    background-color: transparent !important;
    border-color: transparent !important;
    transform: scale(1.15);
}

.emc-custom-carousel-wrapper.emc-arrows-style-icon-only .emc-nav-pos-sides:hover {
    transform: translateY(-50%) scale(1.15);
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
    .emc-custom-carousel.emc-display-grid .emc-custom-carousel-track {
        grid-template-columns: repeat(var(--emc-grid-columns, 2), minmax(0, 1fr));
    }

    .emc-custom-slide-image {
        height: 380px;
    }

    .emc-custom-carousel-wrapper.emc-height-mode-auto .emc-custom-slide-image {
        height: auto;
    }
}

@media (max-width: 767px) {
    .emc-custom-carousel.emc-display-grid .emc-custom-carousel-track {
        grid-template-columns: repeat(var(--emc-grid-columns, 1), minmax(0, 1fr));
    }

    .emc-custom-slide-image {
        height: 320px;
    }

    .emc-custom-carousel-wrapper.emc-height-mode-auto .emc-custom-slide-image {
        height: auto;
    }

    .emc-custom-overlay {
        padding: 20px 15px;
    }

    .emc-nav-pos-sides.emc-prev {
        left: 12px;
    }

    .emc-nav-pos-sides.emc-next {
        right: 12px;
    }

    .emc-nav-pos-overlay-bottom-corners.emc-prev,
    .emc-nav-pos-overlay-top-corners.emc-prev {
        left: 12px;
    }

    .emc-nav-pos-overlay-bottom-corners.emc-next,
    .emc-nav-pos-overlay-top-corners.emc-next {
        right: 12px;
    }

    .emc-nav-pos-overlay-bottom-center.emc-prev {
        left: calc(50% - 42px);
        bottom: 12px;
    }

    .emc-nav-pos-overlay-bottom-center.emc-next {
        left: calc(50% + 6px);
        bottom: 12px;
    }

    .emc-nav-pos-overlay-bottom-corners.emc-prev,
    .emc-nav-pos-overlay-bottom-corners.emc-next {
        bottom: 12px;
    }

    .emc-nav-pos-overlay-top-corners.emc-prev,
    .emc-nav-pos-overlay-top-corners.emc-next {
        top: 12px;
    }
}

/* =============================================
   DRAG
   ============================================= */
.emc-custom-carousel.dragging .emc-custom-slide-link,
.emc-custom-carousel.dragging .emc-custom-button {
    pointer-events: none;
}

/* =============================================
   FLIP CARD
   ============================================= */
.emc-custom-carousel-wrapper.emc-has-flip {
    --emc-flip-ms: 600;
    --emc-flip-back-bg: #1a365d;
}

.emc-has-flip .emc-custom-slide {
    cursor: pointer;
}

.emc-has-flip .emc-custom-slide-inner {
    overflow: visible;
    perspective: 1200px;
    background: transparent;
}

.emc-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    border-radius: inherit;
    transition: transform calc(var(--emc-flip-ms, 600) * 1ms) cubic-bezier(0.22, 1, 0.36, 1);
}

.emc-flip-front,
.emc-flip-back {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: inherit;
    overflow: hidden;
}

.emc-flip-front {
    position: relative;
    z-index: 1;
}

.emc-flip-back {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
    padding: 28px 24px;
    background-color: var(--emc-flip-back-bg, #1a365d);
    transform: rotateY(180deg);
    pointer-events: none;
}

.emc-flip-back-content {
    width: 100%;
    max-height: 100%;
    overflow: auto;
}

.emc-flip-back-title {
    margin: 0 0 12px 0;
    padding: 0;
    color: #ffffff;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
}

.emc-flip-back-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    line-height: 1.5;
}

.emc-has-flip .emc-custom-slide.is-flipped .emc-flip-inner {
    transform: rotateY(180deg);
}

.emc-has-flip.emc-flip-dir-x .emc-flip-back {
    transform: rotateX(180deg);
}

.emc-has-flip.emc-flip-dir-x .emc-custom-slide.is-flipped .emc-flip-inner {
    transform: rotateX(180deg);
}

.emc-has-flip .emc-custom-slide.is-flipped .emc-flip-front {
    pointer-events: none;
}

.emc-has-flip .emc-custom-slide.is-flipped .emc-flip-back {
    pointer-events: auto;
}

@media (hover: hover) and (pointer: fine) {
    .emc-flip-trigger-hover .emc-custom-slide:hover .emc-flip-inner,
    .emc-flip-trigger-hover .emc-custom-slide:focus-within .emc-flip-inner {
        transform: rotateY(180deg);
    }

    .emc-has-flip.emc-flip-dir-x.emc-flip-trigger-hover .emc-custom-slide:hover .emc-flip-inner,
    .emc-has-flip.emc-flip-dir-x.emc-flip-trigger-hover .emc-custom-slide:focus-within .emc-flip-inner {
        transform: rotateX(180deg);
    }

    .emc-flip-trigger-hover .emc-custom-slide:hover .emc-flip-front,
    .emc-flip-trigger-hover .emc-custom-slide:focus-within .emc-flip-front {
        pointer-events: none;
    }

    .emc-flip-trigger-hover .emc-custom-slide:hover .emc-flip-back,
    .emc-flip-trigger-hover .emc-custom-slide:focus-within .emc-flip-back {
        pointer-events: auto;
    }
}

.emc-custom-carousel.dragging .emc-flip-inner {
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    .emc-flip-inner {
        transition: none;
    }
}

/* Mejorar clicks en móvil */
@media (max-width: 1024px) {
    .emc-custom-slide-link {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    .emc-custom-carousel:not(.dragging) .emc-custom-slide-link,
    .emc-custom-carousel:not(.dragging) .emc-custom-button {
        pointer-events: auto;
    }
}

/* =============================================
   ACCESIBILIDAD
   ============================================= */
@media (prefers-reduced-motion: reduce) {
    .emc-custom-slide-image img {
        transition: none;
    }
}
