/**
 * Merch Block Styles
 * Sección de merchandising con slider horizontal de tarjetas
 * Basado en Figma: node 1030-32169
 * Card States: 641-15866 (Default), 641-15865 (Hover)
 * Navigation: 1422-17606
 */

.menudos-merch {
    position: relative;
    width: 100%;
    padding: 56px 64px;
    background-color: var(--wp--preset--color--white, #FFFFFF);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* Title */
.merch__title {
    margin: 0;
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: 36px;
    font-weight: 700;
    line-height: 1.21;
    text-align: center;
    color: var(--wp--preset--color--text-dark, #333333);
}

/* Slider Wrapper */
.merch__slider-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Splide Container */
.merch__splide {
    width: 100%;
    position: relative;
}

.merch__splide .splide__track {
    overflow: visible;
    padding: 40px 0;
}

.merch__splide .splide__list {
    padding-left: 64px;
}

/* Slide */
.merch__splide .splide__slide {
    width: 100%;
}

/* ==========================================================================
   Navigation Arrows
   ========================================================================== */

.merch__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 10px;
    background-color: var(--wp--preset--color--white, #FFFFFF);
    border: 1px solid var(--wp--preset--color--secondary, #787878);
    border-radius: 16px;
    box-shadow: 0px 14px 24px 0px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.merch__arrow--prev {
    left: 16px;
}

.merch__arrow--next {
    right: 16px;
}

.merch__arrow:hover {
    background-color: var(--wp--preset--color--light-gray, #F5F5F5);
    border-color: var(--wp--preset--color--text-dark, #333333);
}

.merch__arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.merch__arrow:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.merch__arrow svg {
    width: 24px;
    height: 24px;
    color: var(--wp--preset--color--text-dark, #333333);
}

/* Hide default Splide arrow SVG */
.merch__splide .splide__arrow svg.splide__arrow--svg {
    display: none;
}

/* ==========================================================================
   Card
   ========================================================================== */

.merch__card {
    position: relative;
    width: 100%;
    height: 320px;
    border-radius: 24px;
    overflow: hidden;
    cursor: default;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    border: 1px solid transparent;
}

.merch__card:hover {
    box-shadow: 0px 14px 24px 0px rgba(0, 0, 0, 0.12);
    border-color: #F4F4F4;
}

/* ==========================================================================
   Estado Normal (Default)
   ========================================================================== */

.merch__card-default {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 24px 64px;
    background-image: var(--card-bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.merch__card:hover .merch__card-default {
    opacity: 0;
}

/* Card Overlay */
.merch__card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 1;
}

/* Card Content */
.merch__card-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* Card Title (Default) */
.merch__card-title {
    margin: 0;
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.21;
    text-align: center;
    color: var(--wp--preset--color--white, #FFFFFF);
}

/* Card Icon */
.merch__card-icon {
    width: 16px;
    height: 16px;
    color: var(--wp--preset--color--white, #FFFFFF);
}

/* ==========================================================================
   Estado Hover
   ========================================================================== */

.merch__card-hover {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 43px;
    padding: 24px;
    background-color: var(--wp--preset--color--white, #FFFFFF);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.merch__card:hover .merch__card-hover {
    opacity: 1;
}

/* Card Title (Hover) */
.merch__card-hover-title {
    margin: 0;
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.21;
    text-align: center;
    color: var(--wp--preset--color--text-dark, #333333);
}

/* Card Description */
.merch__card-description {
    margin: 0;
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.21;
    text-align: center;
    color: var(--wp--preset--color--text-light, #787878);
    max-height: 70%;
    overflow-y: auto;
}


/* Custom scrollbar */
.merch__card-description::-webkit-scrollbar {
    width: 4px;
}

.merch__card-description::-webkit-scrollbar-track {
    background: transparent;
}

.merch__card-description::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 20px;
}

.merch__card-description::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.6);
}


/* Card Button - usa clases utilitarias .btn .btn--primary .btn--sm .btn--scale */
.merch__card-button {
    font-size: 12px; /* Tamaño específico para cards de merch */
}

/* ==========================================================================
   Gradient Fades
   ========================================================================== */

.merch__fade {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 64px;
    pointer-events: none;
    z-index: 10;
}

.merch__fade--left {
    left: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
}

.merch__fade--right {
    right: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.merch__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    width: 100%;
    background-color: var(--wp--preset--color--light-gray, #F5F5F5);
    border-radius: 24px;
    padding: 24px;
    border: 1px dashed var(--wp--preset--color--secondary, #787878);
}

.merch__empty p {
    margin: 0;
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: 14px;
    color: var(--wp--preset--color--text-light, #787878);
    text-align: center;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1200px) {
    .merch__card {
        width: 100%;
        height: 280px;
    }

    .merch__card-hover {
        gap: 32px;
    }
}

@media (max-width: 1024px) {
    .menudos-merch {
        padding: 48px 32px;
    }

    .merch__splide .splide__list {
        padding-left: 32px;
    }

    .merch__fade {
        width: 32px;
    }

    .merch__card {
        width: 100%;
        height: 260px;
    }

    .merch__arrow--prev {
        left: 8px;
    }

    .merch__arrow--next {
        right: 8px;
    }
}

@media (max-width: 768px) {
    .menudos-merch {
        padding: 40px 24px;
    }

    .merch__title {
        font-size: 28px;
    }

    /* Card: layout vertical (imagen arriba, info abajo) */
    .merch__card {
        height: auto;
        display: flex;
        flex-direction: column;
        gap: 8px;
        background: transparent;
        border: none;
        border-radius: 0;
        overflow: visible;
    }

    .merch__card:hover {
        box-shadow: none;
        border-color: transparent;
    }

    /* Estado default: solo muestra la imagen */
    .merch__card-default {
        position: relative;
        height: 240px;
        padding: 0;
        border-radius: 24px;
        flex-shrink: 0;
    }

    .merch__card:hover .merch__card-default {
        opacity: 1;
    }

    /* Ocultar overlay en mobile */
    .merch__card-overlay {
        display: none;
    }

    /* Ocultar contenido sobre imagen en mobile */
    .merch__card-content {
        display: none;
    }

    /* Estado hover: convertir en info visible debajo */
    .merch__card-hover {
        position: relative;
        opacity: 1;
        padding: 0;
        gap: 4px;
        background: transparent;
        align-items: flex-start;
    }

    .merch__card:hover .merch__card-hover {
        opacity: 1;
    }

    .merch__card-hover-title {
        font-size: 20px;
        text-align: left;
    }

    .merch__card-description {
        font-size: 14px;
        text-align: left;
        color: var(--wp--preset--color--text-light, #787878);
        /* Limitar a 2 líneas con ellipsis */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        max-height: none;
    }

    /* Botón en mobile - visible debajo del párrafo */
    .merch__card-button {
        display: inline-flex;
        align-self: flex-start;
        margin-top: 4px;
        padding: 8px 16px;
        font-size: 12px;
        height: 32px;
    }

    .merch__splide .splide__list {
        padding-left: 24px;
    }

    .merch__fade {
        width: 24px;
    }

    .merch__arrow {
        width: 40px;
        height: 40px;
        padding: 8px;
        border-radius: 12px;
    }

    .merch__arrow svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .menudos-merch {
        padding: 32px 16px;
    }

    .merch__title {
        font-size: 24px;
    }

    .merch__card-default {
        height: 200px;
        padding: 16px;
    }

    .merch__card-hover-title {
        font-size: 18px;
    }

    .merch__card-description {
        font-size: 13px;
    }

    .merch__splide .splide__list {
        padding-left: 16px;
    }

    .merch__fade {
        width: 16px;
    }

    .merch__arrow {
        width: 36px;
        height: 36px;
        padding: 6px;
        border-radius: 10px;
    }

    .merch__arrow svg {
        width: 18px;
        height: 18px;
    }

    .merch__arrow--prev {
        left: 4px;
    }

    .merch__arrow--next {
        right: 4px;
    }
}

/* ==========================================================================
   Full width alignment
   ========================================================================== */

.menudos-merch.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.menudos-merch.alignwide {
    width: calc(100% + 100px);
    max-width: 1400px;
    margin-left: -50px;
    margin-right: -50px;
}

/* ==========================================================================
   Editor Styles
   ========================================================================== */

.is-admin .menudos-merch,
.block-editor-block-list__block .menudos-merch {
    min-height: 400px;
}

/* Editor - show cards without slider when JS not loaded */
.block-editor-block-list__block .merch__splide:not(.is-initialized) .splide__list {
    display: flex;
    gap: 24px;
    overflow-x: auto;
}

.block-editor-block-list__block .merch__splide:not(.is-initialized) .splide__slide {
    flex-shrink: 0;
}
