/* ─── Categoría de producto / Tienda (WooCommerce) — UI propia ─────────────────
 * Maqueta de Claude adaptada al markup NATIVO de WooCommerce 11
 * (archive-product.php → loop/header.php + content-product.php).
 *
 * SCOPE: body.tr-archive-products — clase que agrega body_class cuando es
 * categoría de producto (is_product_category) O tienda (is_shop: /tienda/ y
 * /shop/ — la EN funciona vía el filtro woocommerce_get_shop_page_id).
 * TRAMPA: .woocommerce está EN el body → usar la cadena de mismo elemento
 * (body.X.woocommerce …), nunca body .woocommerce como descendiente.
 *
 * Las CARDS del loop (grid, li, thumb, título, precio, botón) viven en el
 * archivo COMPARTIDO assets/css/product-cards.css (misma maqueta que las
 * mini cards de "Productos relacionados" del single).
 *
 * Dos wrappers NO existen en WC y los aporta functions.php via hooks nativos
 * (update-safe): div.shop-toolbar (resultado + orden) y div.product-thumb.
 */

/* Tokens locales (no se filtran al resto del sitio) */
body.tr-archive-products {
    --tr-blue: #0a63f5;
    --tr-blue-dark: #0850cc;
    --tr-blue-soft: #e8f1fd;
    --tr-ink: #0f1b3d;
    --tr-text: #334155;
    --tr-muted: #64748b;
    --tr-border: #e3e9f2;
    --tr-bg: #f6f8fd;
    --tr-card: #ffffff;
    --tr-radius: 22px;
    --tr-shadow: 0 24px 50px -28px rgba(15, 27, 61, .22), 0 4px 14px -6px rgba(15, 27, 61, .06);
    --tr-font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

    background: var(--tr-bg);
}

/* ================= CONTENEDOR ================= */
body.tr-archive-products .site-main {
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px 20px 80px;
    font-family: var(--tr-font);
    color: var(--tr-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ================= BREADCRUMB ================= */
body.tr-archive-products.woocommerce .woocommerce-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: .85rem;
    color: var(--tr-muted);
    margin: 0 0 22px;
    padding: 0;
}

body.tr-archive-products.woocommerce .woocommerce-breadcrumb a {
    text-decoration: none;
    color: var(--tr-muted);
    transition: color .2s;
}

body.tr-archive-products.woocommerce .woocommerce-breadcrumb a:hover {
    color: var(--tr-blue);
}

body.tr-archive-products.woocommerce .woocommerce-breadcrumb .sep {
    opacity: .5;
}

body.tr-archive-products.woocommerce .woocommerce-breadcrumb .current {
    color: var(--tr-ink);
    font-weight: 600;
}

/* ================= TÍTULO ================= */
body.tr-archive-products.woocommerce .woocommerce-products-header {
    margin-bottom: 26px;
}

body.tr-archive-products.woocommerce .woocommerce-products-header__title {
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.1;
    color: var(--tr-ink);
    margin: 0;
}

body.tr-archive-products.woocommerce .woocommerce-products-header__title::after {
    content: "";
    display: block;
    width: 56px;
    height: 4px;
    margin-top: 14px;
    border-radius: 99px;
    background: linear-gradient(90deg, #22c55e, #38bdf8);
}

/* ================= BARRA: RESULTADOS + ORDEN (wrapper de functions.php) ====== */
body.tr-archive-products.woocommerce .shop-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px 20px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}

body.tr-archive-products.woocommerce .woocommerce-result-count {
    font-size: .92rem;
    color: var(--tr-muted);
    margin: 0;
}

body.tr-archive-products.woocommerce .woocommerce-ordering {
    position: relative;
    margin: 0;
}

body.tr-archive-products.woocommerce .woocommerce-ordering select {
    appearance: none;
    -webkit-appearance: none;
    height: 46px;
    min-width: 230px;
    padding: 0 46px 0 20px;
    border: 1.5px solid var(--tr-border);
    border-radius: 999px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f1b3d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 16px center / 16px;
    font: inherit;
    font-size: .92rem;
    font-weight: 500;
    color: var(--tr-ink);
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
}

body.tr-archive-products.woocommerce .woocommerce-ordering select:hover {
    border-color: #c9d4e4;
}

body.tr-archive-products.woocommerce .woocommerce-ordering select:focus {
    outline: none;
    border-color: var(--tr-blue);
    box-shadow: 0 0 0 4px rgba(10, 99, 245, .12);
}

/* ================= RESPONSIVE ================= */
@media (max-width: 640px) {
    body.tr-archive-products .site-main {
        padding: 20px 14px 56px;
    }

    body.tr-archive-products.woocommerce .shop-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    body.tr-archive-products.woocommerce .woocommerce-ordering select {
        width: 100%;
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.tr-archive-products * {
        transition: none !important;
    }
}