/**
 * MERCADOAGRO - SHOWCASE DE CATEGORÍAS ESTILO APPLE STORE
 * Proporción Desktop: 3 tarjetas + 1/6 asomada
 * Proporción Móvil: 1 tarjeta + 1/6 asomada
 * Fondo transparente, textos en negro puro, tarjetas blancas con sombra tenue al activar.
 */

.ma-cat-showcase {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 10px 0 60px 0;
    background: transparent !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
}

/* ==========================================================================
   1. CARRUSEL SUPERIOR DE ICONOS (CATEGORÍAS PADRE)
   ========================================================================== */
.ma-cat-nav-wrap {
    width: 100%;
    position: relative;
    margin-bottom: 42px;
    padding: 0 16px;
    box-sizing: border-box;
}

.ma-cat-nav-carousel {
    display: flex;
    gap: 32px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 16px 8px 20px 8px;
    box-sizing: border-box;
}

.ma-cat-nav-carousel::-webkit-scrollbar {
    display: none;
}

.ma-cat-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-decoration: none !important;
    cursor: pointer;
    flex-shrink: 0;
    width: 118px;
    max-width: 128px;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

.ma-cat-nav-item:hover {
    opacity: 0.75;
    transform: translateY(-2px);
}

.ma-cat-nav-icon {
    width: 76px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.ma-cat-nav-icon img,
.ma-cat-nav-icon svg {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.ma-cat-nav-name {
    font-size: 12px;
    font-weight: 500;
    color: #000000 !important;
    text-align: center;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    letter-spacing: -0.01em;
    line-height: 1.28;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* ==========================================================================
   2. SECCIONES DE CATEGORÍA PADRE
   ========================================================================== */
.ma-cat-section {
    margin-top: 52px;
    padding: 0 16px;
    box-sizing: border-box;
    scroll-margin-top: 100px;
}

.ma-cat-section:first-of-type {
    margin-top: 36px;
}

.ma-cat-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 0 4px;
    box-sizing: border-box;
    gap: 16px;
}

.ma-cat-section-title {
    font-size: 26px;
    font-weight: 700;
    color: #000000 !important;
    letter-spacing: -0.025em;
    margin: 0;
    line-height: 1.2;
}

.ma-cat-section-link {
    font-size: 14px;
    font-weight: 600;
    color: #000000 !important;
    text-decoration: none !important;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: -0.01em;
    transition: opacity 0.2s ease;
}

.ma-cat-section-link:hover {
    opacity: 0.65;
    text-decoration: underline !important;
}

/* ==========================================================================
   3. SLIDER HORIZONTAL DE TARJETAS (ESTILO APPLE STORE)
   ========================================================================== */
.ma-cat-slider-wrap {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.ma-cat-slider-track {
    display: flex;
    gap: 22px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 24px 20px 36px 20px;
    margin-left: -20px;
    margin-right: -20px;
    width: calc(100% + 40px);
    scroll-snap-type: x mandatory;
    box-sizing: border-box;
}

.ma-cat-slider-track::-webkit-scrollbar {
    display: none;
}

/* DESKTOP: 3 tarjetas completas + 1/6 asomada (Estilo CHSMX con Zoom y Sombra Sutil) */
.ma-cat-card {
    flex: 0 0 calc((100% - (3 * 22px)) / 3.1666);
    min-width: calc((100% - (3 * 22px)) / 3.1666);
    max-width: calc((100% - (3 * 22px)) / 3.1666);
    scroll-snap-align: start;
    background-color: #ffffff !important;
    border-radius: 18px !important;
    border: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    transform: scale(1);
    transform-origin: center center;
    will-change: transform, box-shadow;
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), box-shadow 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
    position: relative;
    box-sizing: border-box;
    cursor: pointer;
}

/* HOVER / ACTIVA: Efecto Zoom (Ampliar 3%) + Sombra Sutil */
.ma-cat-card.is-active,
.ma-cat-card:hover {
    transform: scale(1.03) !important;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06) !important;
    z-index: 10;
}

/* Marco cuadrado superior para foto con fondo gris #f5f5f7 */
.ma-cat-card-media {
    background: #f5f5f7 !important;
    border-radius: 14px;
    margin: 12px 12px 0 12px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.ma-cat-card-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
    border-radius: 12px;
    box-sizing: border-box;
    display: block;
}

.ma-cat-card-no-img {
    font-size: 13px;
    font-weight: 600;
    color: #A0AEC0;
    letter-spacing: -0.01em;
}

/* Contenido inferior de la ficha */
.ma-cat-card-info {
    padding: 16px 14px 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-sizing: border-box;
}

.ma-cat-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #000000 !important;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 39px;
    letter-spacing: -0.01em;
}

.ma-cat-card-price {
    font-size: 14px;
    font-weight: 700;
    color: #000000 !important;
    margin: 0;
    line-height: 1.2;
}

.ma-cat-card-location {
    font-size: 12px;
    font-weight: 500;
    color: #000000 !important;
    opacity: 0.7;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.ma-cat-pin-icon {
    width: 12px;
    height: 12px;
    fill: #000000;
    flex-shrink: 0;
    display: inline-block;
}

/* ==========================================================================
   4. FLECHAS DE NAVEGACIÓN CIRCULARES (ESTILO APPLE)
   ========================================================================== */
.ma-cat-arrow-btn {
    position: absolute;
    top: 45%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(245, 245, 247, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    color: #000000;
}

.ma-cat-arrow-btn:hover {
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-50%) scale(1.06);
}

.ma-cat-arrow-btn.prev {
    left: -12px;
}

.ma-cat-arrow-btn.next {
    right: -12px;
}

.ma-cat-arrow-btn svg {
    width: 14px;
    height: 14px;
    stroke: #000000;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ==========================================================================
   5. RESPONSIVO MÓVIL (< 768px): 1 tarjeta completa + 1/6 asomada
   ========================================================================== */
@media (max-width: 768px) {
    .ma-cat-showcase {
        padding: 5px 0 40px 0;
    }

    .ma-cat-nav-wrap {
        padding: 0 12px;
        margin-bottom: 28px;
    }

    .ma-cat-nav-carousel {
        gap: 16px;
        padding: 10px 4px 16px 4px;
    }

    .ma-cat-nav-item {
        width: 96px;
        max-width: 106px;
        min-width: unset;
    }

    .ma-cat-nav-icon {
        width: 60px;
        height: 46px;
        margin-bottom: 6px;
    }

    .ma-cat-nav-name {
        font-size: 11px;
        line-height: 1.25;
        white-space: normal;
        word-break: normal;
        overflow-wrap: break-word;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
    }

    .ma-cat-section {
        margin-top: 40px;
        padding: 0 12px;
    }

    .ma-cat-section:first-of-type {
        margin-top: 24px;
    }

    .ma-cat-section-header {
        margin-bottom: 14px;
    }

    .ma-cat-section-title {
        font-size: 20px;
    }

    .ma-cat-section-link {
        font-size: 13px;
    }

    .ma-cat-slider-track {
        gap: 14px;
        padding: 16px 14px 28px 14px;
        margin-left: -14px;
        margin-right: -14px;
        width: calc(100% + 28px);
    }

    /* MÓVIL: 1 tarjeta + 1/6 asomada */
    .ma-cat-card {
        flex: 0 0 calc((100% - 14px) / 1.1666);
        min-width: calc((100% - 14px) / 1.1666);
        max-width: calc((100% - 14px) / 1.1666);
        background-color: #ffffff !important;
        border-radius: 18px !important;
        border: none !important;
        box-shadow: none !important;
        transform: scale(1);
        transform-origin: center center;
        will-change: transform, box-shadow;
        transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), box-shadow 0.4s ease !important;
    }

    .ma-cat-card.is-active,
    .ma-cat-card:hover {
        transform: scale(1.025) !important;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05) !important;
        z-index: 10;
    }

    .ma-cat-card-media {
        margin: 10px 10px 0 10px;
        border-radius: 12px;
    }

    .ma-cat-card-info {
        padding: 12px 10px 14px 10px;
    }

    .ma-cat-card-title {
        font-size: 14px;
        min-height: 36px;
    }

    .ma-cat-card-price {
        font-size: 13px;
    }

    .ma-cat-arrow-btn {
        display: none !important;
    }
}

/* ==========================================================================
   4. AVISO SUTIL (TOAST ESTILO APPLE PARA SUBCATEGORÍAS SIN ANUNCIOS)
   ========================================================================== */
.ma-cat-toast {
    position: fixed;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%) translateY(24px);
    background: rgba(18, 20, 24, 0.85) !important;
    -webkit-backdrop-filter: blur(24px) saturate(190%) !important;
    backdrop-filter: blur(24px) saturate(190%) !important;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    padding: 12px 26px;
    border-radius: 980px;
    box-shadow: inset 0 1px 1px 0 rgba(255, 255, 255, 0.20), 0 16px 36px rgba(0, 0, 0, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 999999;
    text-align: center;
    max-width: 90vw;
    box-sizing: border-box;
}

.ma-cat-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   5. BANNER DE DESTACADOS Y ÚLTIMOS AGREGADOS (PÁGINA DE INICIO / SHORTCODE)
   Proporción Desktop: 4 tarjetas completas + 1/4 asomada
   Proporción Móvil: 1 tarjeta completa + 1/4 asomada
   ========================================================================== */
.ma-destacados-showcase,
.ma-ultimos-showcase {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 0 36px 0;
    background: transparent !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
}

.ma-destacados-header,
.ma-ultimos-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 8px;
    padding: 0 4px;
    box-sizing: border-box;
    width: 100%;
}

.ma-destacados-header .ma-cat-section-link,
.ma-ultimos-header .ma-cat-section-link {
    font-size: 14px;
    font-weight: 600;
    color: #000000 !important;
    text-decoration: none !important;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: -0.01em;
    transition: opacity 0.2s ease;
    margin-left: auto;
}

.ma-destacados-header .ma-cat-section-link:hover,
.ma-ultimos-header .ma-cat-section-link:hover {
    opacity: 0.65;
    text-decoration: underline !important;
}

/* DESKTOP: 4 productos completos + 1/4 del otro asomado (4.25) */
.ma-destacados-slider-wrap .ma-cat-card,
.ma-ultimos-slider-wrap .ma-cat-card {
    flex: 0 0 calc((100% - (4 * 20px)) / 4.25) !important;
    min-width: calc((100% - (4 * 20px)) / 4.25) !important;
    max-width: calc((100% - (4 * 20px)) / 4.25) !important;
}

/* RESPONSIVO MÓVIL (< 768px): 1 producto completo + 1/4 del otro asomado (1.25) */
@media (max-width: 768px) {
    .ma-destacados-showcase,
    .ma-ultimos-showcase {
        padding: 0 0 28px 0;
    }

    .ma-destacados-header,
    .ma-ultimos-header {
        margin-bottom: 4px;
        padding: 0 4px;
    }

    .ma-destacados-slider-wrap .ma-cat-card,
    .ma-ultimos-slider-wrap .ma-cat-card {
        flex: 0 0 calc((100% - 14px) / 1.25) !important;
        min-width: calc((100% - 14px) / 1.25) !important;
        max-width: calc((100% - 14px) / 1.25) !important;
    }
}
