/* ============================================================
   ARCHIVE (tienda, categorías) + SINGLE PRODUCT
   /assets/css/archive.css
   ============================================================ */

/* ── BREADCRUMB ──────────────────────────────────────────────── */

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    align-items: center;
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--text-muted); font-weight: 600; }
.breadcrumb a:hover { color: var(--pink); }
.breadcrumb span:last-child { color: var(--text); font-weight: 600; }

/* ── CABECERA ARCHIVO ────────────────────────────────────────── */

.archive-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}
.archive-header h1 { font-size: 1.8rem; margin-bottom: .5rem; }
.archive-header p  { color: var(--text-muted); font-size: .95rem; }

/* ── TOOLBAR ─────────────────────────────────────────────────── */

.archive-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: .75rem 1.25rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.archive-count { font-size: .85rem; color: var(--text-muted); }
.archive-sort select {
    font-family: var(--font);
    font-size: .85rem;
    font-weight: 600;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .35rem 2rem .35rem .75rem;
    appearance: none;
    background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A7A7A' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right .75rem center;
    cursor: pointer;
}
.archive-sort select:focus { border-color: var(--pink); outline: none; box-shadow: 0 0 0 3px rgba(232,49,120,.12); }

/* ── PAGINACIÓN ──────────────────────────────────────────────── */

.archive-pagination { margin-top: 3rem; display: flex; justify-content: center; }
.archive-pagination .page-numbers {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
    justify-content: center;
}
.archive-pagination .page-numbers a,
.archive-pagination .page-numbers span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 .5rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 700;
    border: 1.5px solid var(--border);
    color: var(--text);
    background: var(--white);
    transition: all .2s;
}
.archive-pagination .page-numbers a:hover { border-color: var(--pink); color: var(--pink); background: var(--pink-pale); }
.archive-pagination .page-numbers .current { background: var(--pink); border-color: var(--pink); color: var(--white); }

/* ── SINGLE PRODUCT ──────────────────────────────────────────── */

/* Layout 50/50 — imagen izquierda, info derecha */
.sp-layout,
article.sp-layout,
.sp-layout.product,
article.product.sp-layout {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 3rem;
    align-items: start;
    margin-bottom: 3rem;
}

/* También anulamos el width que WooCommerce pone en .product */
.sp-layout.product,
article.sp-layout {
    width: 100% !important;
    float: none !important;
    clear: both !important;
}

@media (min-width: 769px) {
    .sp-gallery {
        position: sticky;
        top: calc(var(--header-h) + var(--nav-h) + 1rem);
    }
}

/* ── GALERÍA — ESTRUCTURA REAL DE WOOCOMMERCE ────────────────── */

.sp-gallery .woocommerce-product-gallery {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 1 !important;
}

/* WooCommerce setea width inline con JS — lo sobreescribimos */
.sp-gallery .woocommerce-product-gallery[style*="width"] {
    width: 100% !important;
}

/* Wrapper: primera imagen grande, resto thumbnails abajo */
.sp-gallery .woocommerce-product-gallery__wrapper {
    display: flex !important;
    flex-direction: column !important;
    gap: .75rem !important;
    width: 100% !important;
    margin: 0 !important;
}

/* Primera imagen — grande */
.sp-gallery .woocommerce-product-gallery__image:first-child {
    width: 100% !important;
    float: none !important;
}

.sp-gallery .woocommerce-product-gallery__image:first-child img {
    width: 100% !important;
    height: auto !important;
    max-height: 480px !important;
    object-fit: cover !important;
    border-radius: var(--radius-lg) !important;
    display: block !important;
}

/* Resto de imágenes — fila de thumbnails */
.sp-gallery .woocommerce-product-gallery__wrapper {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: .75rem !important;
}

/* Thumbnail grid debajo de la imagen principal */
.sp-gallery .woocommerce-product-gallery__image:not(:first-child) {
    display: none !important; /* ocultamos las extras, WooCommerce las maneja con JS */
}

/* Trigger de zoom */
.sp-gallery .woocommerce-product-gallery__trigger {
    position: absolute;
    top: .75rem;
    right: .75rem;
    z-index: 10;
    background: rgba(255,255,255,.9);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: opacity .2s;
    text-decoration: none;
}

/* Thumbnails — WooCommerce las genera con JS como ol.flex-control-thumbs
   O como data-thumb en los divs. Forzamos el contenedor visible */
.sp-gallery .flex-viewport {
    width: 100% !important;
    overflow: hidden !important;
    border-radius: var(--radius-lg) !important;
}

.sp-gallery ol.flex-control-nav.flex-control-thumbs,
.sp-gallery ul.flex-control-nav.flex-control-thumbs {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: .5rem !important;
    margin: .75rem 0 0 !important;
    padding: 0 !important;
    list-style: none !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
}

.sp-gallery ol.flex-control-thumbs li,
.sp-gallery ul.flex-control-thumbs li {
    width: calc(20% - .4rem) !important;
    float: none !important;
    margin: 0 !important;
}

.sp-gallery ol.flex-control-thumbs li img,
.sp-gallery ul.flex-control-thumbs li img {
    width: 100% !important;
    aspect-ratio: 1/1 !important;
    object-fit: cover !important;
    border-radius: var(--radius-sm) !important;
    border: 2px solid transparent !important;
    opacity: .65 !important;
    cursor: pointer !important;
    transition: all .2s !important;
    max-height: none !important;
    display: block !important;
}

.sp-gallery ol.flex-control-thumbs li img:hover,
.sp-gallery ul.flex-control-thumbs li img:hover,
.sp-gallery ol.flex-control-thumbs li img.flex-active,
.sp-gallery ul.flex-control-thumbs li img.flex-active {
    border-color: var(--pink) !important;
    opacity: 1 !important;
}

.sp-gallery .flex-direction-nav { display: none !important; }




/* Info del producto */
.sp-info { display: flex; flex-direction: column; gap: 1.25rem; }
.sp-cat { font-size: .75rem; font-weight: 700; color: var(--pink); text-transform: uppercase; letter-spacing: .06em; text-decoration: none; }
.sp-cat:hover { opacity: .75; color: var(--pink); }
.sp-title { font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 800; line-height: 1.2; }
.sp-price .price { font-size: 1.9rem; font-weight: 800; color: var(--pink); }
.sp-price .price del { font-size: 1.15rem; color: var(--text-muted); font-weight: 400; margin-right: .5rem; }
.sp-price .price ins { text-decoration: none; }

.sp-desc { font-size: .95rem; color: var(--text-muted); line-height: 1.7; border-left: 3px solid var(--pink-light); padding-left: 1rem; }
.sp-desc p:last-child { margin-bottom: 0; }

/* Botón principal */
.single_add_to_cart_button,
button.single_add_to_cart_button {
    width: 100%;
    background: var(--pink) !important;
    color: var(--white) !important;
    border: none !important;
    border-radius: var(--radius-full) !important;
    font-family: var(--font) !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    padding: 1rem 2rem !important;
    cursor: pointer;
    transition: all .2s !important;
}
.single_add_to_cart_button:hover { background: var(--pink-hover) !important; transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* Quantity input */
.quantity { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.quantity label { font-weight: 700; font-size: .875rem; min-width: 65px; }
.qty { font-family: var(--font); font-size: 1rem; font-weight: 700; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .75rem; width: 80px; text-align: center; }
.qty:focus { border-color: var(--pink); outline: none; box-shadow: 0 0 0 3px rgba(232,49,120,.12); }

/* Variaciones */
.variations { width: 100%; border: none; margin-bottom: 1rem; }
.variations td, .variations th { padding: .4rem 0; vertical-align: middle; }
.variations label { font-weight: 700; font-size: .875rem; padding-right: 1rem; white-space: nowrap; }
.variations select {
    font-family: var(--font);
    font-size: .875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .5rem 2rem .5rem .75rem;
    width: 100%;
    cursor: pointer;
    appearance: none;
    background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A7A7A' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right .75rem center;
}
.variations select:focus { border-color: var(--pink); outline: none; box-shadow: 0 0 0 3px rgba(232,49,120,.12); }
.reset_variations { font-size: .78rem; color: var(--text-muted); display: block; margin-bottom: .5rem; }

/* Beneficios del producto */
.sp-benefits {
    list-style: none;
    padding: 1rem;
    background: var(--bg-alt);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: .6rem;
}
.sp-benefits li { display: flex; align-items: center; gap: .6rem; font-size: .875rem; }
.sp-benefits li span:first-child { font-size: 1rem; flex-shrink: 0; }

/* WhatsApp en producto */
.sp-wa {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .75rem 1.5rem;
    background: transparent;
    color: #25D366;
    border: 2px solid #25D366;
    border-radius: var(--radius-full);
    font-family: var(--font);
    font-size: .875rem;
    font-weight: 700;
    text-decoration: none;
    transition: all .2s;
}
.sp-wa:hover { background: #25D366; color: var(--white); transform: translateY(-1px); }

/* Meta del producto */
.sp-meta { font-size: .78rem; color: var(--text-muted); padding-top: 1rem; border-top: 1px solid var(--border); }
.sp-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.sp-tag { font-size: .72rem; font-weight: 600; color: var(--text-muted); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-full); padding: .2rem .65rem; text-decoration: none; transition: all .2s; }
.sp-tag:hover { background: var(--pink-pale); border-color: var(--pink); color: var(--pink); }

/* Tabs */
.woocommerce-tabs ul.tabs { list-style: none; display: flex; border-bottom: 2px solid var(--border); margin-bottom: 0; padding: 0; }
.woocommerce-tabs ul.tabs li { margin: 0; padding: 0; border: none; background: none; }
.woocommerce-tabs ul.tabs li a { display: block; padding: .75rem 1.5rem; font-family: var(--font); font-size: .875rem; font-weight: 700; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; text-decoration: none; }
.woocommerce-tabs ul.tabs li.active a { color: var(--pink); border-bottom-color: var(--pink); }
.woocommerce-tabs .panel { padding: 1.5rem 0; font-size: .95rem; line-height: 1.75; }

/* Relacionados */
.sp-related { border-top: 1px solid var(--border); padding-top: 2.5rem; margin-top: 3rem; }
.sp-related h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 1.5rem; }

@media (max-width: 768px) {
    .sp-layout { grid-template-columns: 1fr; gap: 2rem; }
    .archive-toolbar { flex-direction: column; align-items: flex-start; gap: .75rem; }
    .archive-sort select { width: 100%; }
    .flex-control-thumbs li { width: calc(25% - .4rem) !important; }
}
