/* ============================================================
   Divi WooCommerce Showcase - Frontend Styles
   Compatibilidad total con Divi Theme
   ============================================================ */

:root {
    --dws-primary: #7b2ff7;
    --dws-secondary: #f72f7b;
    --dws-btn-bg: #7b2ff7;
    --dws-btn-text: #ffffff;
    --dws-radius: 8px;
    --dws-shadow: 0 4px 20px rgba(0,0,0,.1);
    --dws-shadow-hover: 0 8px 30px rgba(0,0,0,.18);
    --dws-transition: 0.3s ease;
    --dws-overlay-bg: rgba(0,0,0,.5);
}

/* ============================================================
   SECCIÓN
   ============================================================ */
.dws-section {
    width: 100%;
    box-sizing: border-box;
}

.dws-section-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--dws-primary);
    text-align: center;
    letter-spacing: -0.02em;
}

/* ============================================================
   GRILLA RESPONSIVA (via CSS custom properties)
   ============================================================ */
.dws-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols, 4), 1fr);
    gap: 24px;
}

@media (max-width: 1024px) {
    .dws-grid {
        grid-template-columns: repeat(var(--cols-tablet, 2), 1fr);
        gap: 18px;
    }
}

@media (max-width: 767px) {
    .dws-grid {
        grid-template-columns: repeat(var(--cols-mobile, 1), 1fr);
        gap: 14px;
    }
}

/* ============================================================
   CARRUSEL (Swiper)
   ============================================================ */
.dws-carousel {
    position: relative;
    overflow: hidden;
    padding-bottom: 40px;
}

.dws-carousel .swiper-wrapper {
    align-items: stretch;
}

.dws-carousel .swiper-slide {
    height: auto;
}

.dws-carousel .swiper-button-prev,
.dws-carousel .swiper-button-next {
    color: var(--dws-primary);
    background: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,.15);
    transition: var(--dws-transition);
}

.dws-carousel .swiper-button-prev:after,
.dws-carousel .swiper-button-next:after {
    font-size: 14px;
    font-weight: 900;
}

.dws-carousel .swiper-button-prev:hover,
.dws-carousel .swiper-button-next:hover {
    background: var(--dws-primary);
    color: #fff;
}

.dws-carousel .swiper-pagination-bullet-active {
    background: var(--dws-primary);
}

.dws-carousel .swiper-pagination-progressbar-fill {
    background: var(--dws-primary);
}

/* ============================================================
   TARJETAS DE CATEGORÍA - BASE
   ============================================================ */
.dws-category-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--dws-radius);
    transition: transform var(--dws-transition), box-shadow var(--dws-transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.dws-cat-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.dws-cat-image-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4/3;
    background: #f0f0f0;
}

.dws-cat-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}

.dws-cat-info {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.dws-cat-name {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
    color: #1a1a1a;
    line-height: 1.3;
}

.dws-cat-count {
    font-size: 0.8rem;
    color: #888;
    display: block;
    margin-bottom: 0.5rem;
}

.dws-cat-desc {
    font-size: 0.85rem;
    color: #666;
    margin: 0.5rem 0;
    line-height: 1.5;
}

.dws-cat-btn {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.45rem 1.1rem;
    background: var(--dws-btn-bg);
    color: var(--dws-btn-text);
    border-radius: var(--dws-radius);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    transition: var(--dws-transition);
    align-self: flex-start;
}

.dws-cat-link:hover .dws-cat-btn {
    background: var(--dws-secondary);
    color: #fff;
    transform: translateY(-2px);
}

.dws-cat-link:hover .dws-cat-image {
    transform: scale(1.06);
}

/* ============================================================
   ESTILO: CARD (default)
   ============================================================ */
.dws-cat-style-card {
    box-shadow: var(--dws-shadow);
}

.dws-cat-style-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--dws-shadow-hover);
}

/* ============================================================
   ESTILO: OVERLAY
   ============================================================ */
.dws-cat-style-overlay .dws-cat-image-wrap {
    aspect-ratio: 3/4;
}

.dws-cat-style-overlay .dws-cat-overlay {
    position: absolute;
    inset: 0;
    background: var(--dws-overlay-bg);
    transition: background var(--dws-transition);
}

.dws-cat-style-overlay .dws-cat-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 1rem 1rem;
    background: linear-gradient(transparent, rgba(0,0,0,.7));
    color: #fff;
}

.dws-cat-style-overlay .dws-cat-name {
    color: #fff;
}

.dws-cat-style-overlay .dws-cat-count {
    color: rgba(255,255,255,.75);
}

.dws-cat-style-overlay .dws-cat-btn {
    background: rgba(255,255,255,.2);
    border: 1px solid rgba(255,255,255,.5);
    color: #fff;
    backdrop-filter: blur(4px);
}

.dws-cat-style-overlay:hover .dws-cat-btn {
    background: var(--dws-primary);
    border-color: var(--dws-primary);
}

/* ============================================================
   ESTILO: MINIMAL
   ============================================================ */
.dws-cat-style-minimal {
    background: transparent;
    text-align: center;
}

.dws-cat-style-minimal .dws-cat-image-wrap {
    border-radius: 50%;
    aspect-ratio: 1/1;
    width: 120px;
    height: 120px;
    margin: 0 auto 1rem;
}

.dws-cat-style-minimal .dws-cat-info {
    align-items: center;
    padding: 0.5rem;
}

.dws-cat-style-minimal .dws-cat-btn {
    display: none;
}

.dws-cat-style-minimal .dws-cat-name {
    font-size: 0.9rem;
    color: var(--dws-primary);
}

/* ============================================================
   ESTILO: BORDERED
   ============================================================ */
.dws-cat-style-bordered {
    border: 2px solid #e5e5e5;
    transition: border-color var(--dws-transition), var(--dws-transition);
}

.dws-cat-style-bordered:hover {
    border-color: var(--dws-primary);
    transform: translateY(-3px);
}

/* ============================================================
   ESTILO: GLASSMORPHISM
   ============================================================ */
.dws-cat-style-glassmorphism .dws-cat-image-wrap {
    aspect-ratio: 3/4;
}

.dws-cat-style-glassmorphism .dws-cat-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(123,47,247,.3), rgba(247,47,123,.3));
}

.dws-cat-style-glassmorphism .dws-cat-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,.3);
    color: #fff;
    padding: 1.2rem 1rem;
}

.dws-cat-style-glassmorphism .dws-cat-name,
.dws-cat-style-glassmorphism .dws-cat-count {
    color: #fff;
}

.dws-cat-style-glassmorphism .dws-cat-btn {
    background: rgba(255,255,255,.25);
    border: 1px solid rgba(255,255,255,.5);
    color: #fff;
}

/* ============================================================
   TARJETAS DE PRODUCTO - BASE
   ============================================================ */
.dws-product-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--dws-radius);
    background: #fff;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform var(--dws-transition), box-shadow var(--dws-transition);
}

.dws-badge-sale {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--dws-secondary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dws-prod-image-link {
    display: block;
    text-decoration: none;
}

.dws-prod-image-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1/1;
    background: #f5f5f5;
}

.dws-prod-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}

.dws-product-card:hover .dws-prod-image {
    transform: scale(1.06);
}

.dws-prod-info {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.dws-prod-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.dws-prod-name a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color var(--dws-transition);
}

.dws-prod-name a:hover {
    color: var(--dws-primary);
}

/* Estrellas */
.dws-prod-rating {
    display: flex;
    align-items: center;
    gap: 2px;
}

.dws-star {
    color: #ddd;
    font-size: 0.9rem;
}

.dws-star.filled {
    color: #f5a623;
}

.dws-rating-count {
    font-size: 0.75rem;
    color: #999;
    margin-left: 4px;
}

/* Precio */
.dws-prod-price {
    font-size: 1rem;
    font-weight: 700;
}

.dws-prod-price .woocommerce-Price-amount {
    color: var(--dws-primary);
}

.dws-prod-price del {
    color: #aaa;
    font-weight: 400;
    font-size: 0.85em;
}

/* Acciones */
.dws-prod-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.5rem;
    flex-wrap: wrap;
}

.dws-btn-cart,
.dws-btn-view {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.75rem;
    border-radius: var(--dws-radius);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--dws-transition);
    border: none;
    text-decoration: none !important;
}

.dws-btn-cart,
.dws-product-card .button {
    background: var(--dws-btn-bg) !important;
    color: var(--dws-btn-text) !important;
    border-radius: var(--dws-radius) !important;
}

.dws-btn-cart:hover,
.dws-product-card .button:hover {
    background: var(--dws-secondary) !important;
    color: #fff !important;
    transform: translateY(-1px);
}

.dws-btn-view {
    background: transparent;
    color: var(--dws-primary);
    border: 2px solid var(--dws-primary);
}

.dws-btn-view:hover {
    background: var(--dws-primary);
    color: #fff;
}

/* ============================================================
   ESTILO PRODUCTO: CARD
   ============================================================ */
.dws-prod-style-card {
    box-shadow: var(--dws-shadow);
}

.dws-prod-style-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--dws-shadow-hover);
}

/* ============================================================
   ESTILO PRODUCTO: OVERLAY
   ============================================================ */
.dws-prod-style-overlay {
    position: relative;
}

.dws-prod-style-overlay .dws-prod-overlay {
    position: absolute;
    inset: 0;
    background: var(--dws-overlay-bg);
    transition: opacity var(--dws-transition);
}

.dws-prod-style-overlay .dws-prod-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,.75));
    color: #fff;
    padding: 1.5rem 1rem 1rem;
    transform: translateY(40%);
    transition: transform var(--dws-transition);
}

.dws-prod-style-overlay:hover .dws-prod-info {
    transform: translateY(0);
}

.dws-prod-style-overlay .dws-prod-name a,
.dws-prod-style-overlay .dws-prod-price .woocommerce-Price-amount {
    color: #fff;
}

/* ============================================================
   ESTILO PRODUCTO: MINIMAL
   ============================================================ */
.dws-prod-style-minimal {
    background: transparent;
    box-shadow: none;
    border-bottom: 1px solid #eee;
    border-radius: 0;
}

.dws-prod-style-minimal .dws-prod-image-wrap {
    border-radius: var(--dws-radius);
}

/* ============================================================
   ESTILO PRODUCTO: BORDERED
   ============================================================ */
.dws-prod-style-bordered {
    border: 2px solid #e8e8e8;
}

.dws-prod-style-bordered:hover {
    border-color: var(--dws-primary);
    transform: translateY(-3px);
}

/* ============================================================
   ESTILO PRODUCTO: GLASSMORPHISM
   ============================================================ */
.dws-prod-style-glassmorphism {
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.3);
}

/* ============================================================
   ESTILO PRODUCTO: MAGAZINE
   ============================================================ */
.dws-prod-style-magazine {
    flex-direction: row;
    align-items: center;
    gap: 0;
}

.dws-prod-style-magazine .dws-prod-image-wrap {
    width: 40%;
    flex-shrink: 0;
    aspect-ratio: auto;
    min-height: 140px;
}

.dws-prod-style-magazine .dws-prod-info {
    flex: 1;
    padding: 0.75rem;
}

/* ============================================================
   SIN RESULTADOS
   ============================================================ */
.dws-no-items {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* ============================================================
   MODO TEMA (use_theme_style=yes)
   Hereda estilos nativos de WooCommerce / Divi
   ============================================================ */
.dws-section.dws-use-theme .products {
    /* No se sobreescriben estilos del tema */
}

/* ============================================================
   COMPATIBILIDAD DIVI - Evitar conflictos
   ============================================================ */
.dws-section *,
.dws-section *:before,
.dws-section *:after {
    box-sizing: border-box;
}

.dws-section img {
    max-width: 100%;
}

.dws-section a {
    text-decoration: none;
}

/* Divi a veces fuerza margen cero */
.dws-section h2,
.dws-section h3 {
    line-height: 1.3;
}
