/* ================================================================
   Canadian Games Shop Tools — shop-tools.css
   Prefijo de clases propias: .cg-
   Scoping WooCommerce:
     :is(body.cg-shop-page, .cg-products-wrap)  → páginas de archivo (tienda, categoría, búsqueda)
     .cg-products-wrap  → shortcode [cg_products] en cualquier página
   ================================================================

   Los overrides de WooCommerce están scoped bajo ambos selectores para
   evitar conflictos con: producto individual, carrito, checkout, mini-cart.
   ================================================================ */

/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
    --cg-primary:       #1a1a2e;
    --cg-accent:        #e94560;
    --cg-accent-hover:  #c73a52;
    --cg-bg:            #f5f5f7;
    --cg-card-bg:       #ffffff;
    --cg-border:        #e2e2e2;
    --cg-text:          #1a1a2e;
    --cg-text-light:    #6b6b7b;
    --cg-radius:        8px;
    --cg-radius-sm:     5px;
    --cg-shadow:        0 2px 8px rgba(0, 0, 0, 0.07);
    --cg-shadow-hover:  0 8px 24px rgba(0, 0, 0, 0.14);
    --cg-transition:    0.2s ease;
    --cg-drawer-width:  300px;
    --cg-font-sm:       0.875rem;
    --cg-font-xs:       0.8125rem;
}

/* ════════════════════════════════════════════════════════════════
   TOOLBAR — Componentes propios (no conflictan con WooCommerce)
   ════════════════════════════════════════════════════════════════ */

.cg-products-toolbar,
.cg-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 0;
    border-bottom: 1px solid var(--cg-border);
    margin-bottom: 28px;
}

/* ── Contador ───────────────────────────────────────────────────────────── */
.cg-result-count {
    font-size: var(--cg-font-sm);
    color: var(--cg-text-light);
    margin: 0;
    flex: 1;
    min-width: 140px;
    line-height: 1.4;
}

/* ── Ordenar por ────────────────────────────────────────────────────────── */
.cg-ordering {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.cg-ordering__label {
    font-size: var(--cg-font-sm);
    color: var(--cg-text-light);
    white-space: nowrap;
    cursor: default;
}

.cg-ordering__select {
    padding: 8px 36px 8px 12px;
    border: 1px solid var(--cg-border);
    border-radius: var(--cg-radius);
    background-color: var(--cg-card-bg);
    color: var(--cg-text);
    font-size: var(--cg-font-sm);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b7b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color var(--cg-transition), box-shadow var(--cg-transition);
    min-width: 160px;
}

.cg-ordering__select:hover {
    border-color: var(--cg-primary);
}

.cg-ordering__select:focus {
    outline: none;
    border-color: var(--cg-accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15);
}

/* ════════════════════════════════════════════════════════════════
   TÍTULOS
   ════════════════════════════════════════════════════════════════ */

.cg-search-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--cg-primary);
    margin: 0 0 10px;
    line-height: 1.2;
}

.cg-search-text {
    font-size: 0.9375rem;
    color: var(--cg-text-light);
    margin: 0 0 20px;
}

.cg-search-text strong {
    color: var(--cg-text);
    font-weight: 600;
}

/* ════════════════════════════════════════════════════════════════
   FILTROS — BOTÓN TOGGLE
   ════════════════════════════════════════════════════════════════ */

.cg-filters {
    position: relative;
    flex-shrink: 0;
}

.cg-filters__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--cg-card-bg);
    border: 1px solid var(--cg-border);
    border-radius: var(--cg-radius);
    font-size: var(--cg-font-sm);
    color: var(--cg-text);
    cursor: pointer;
    transition:
        background var(--cg-transition),
        border-color var(--cg-transition),
        color var(--cg-transition);
    line-height: 1;
}

.cg-filters__toggle:hover,
.cg-filters__toggle[aria-expanded="true"] {
    background: var(--cg-primary);
    border-color: var(--cg-primary);
    color: #fff;
}

.cg-filters__toggle svg {
    flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════════
   FILTROS — PANEL LATERAL (DRAWER)
   ════════════════════════════════════════════════════════════════ */

.cg-filters__panel {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    animation: cgDrawerIn 0.22s ease forwards;
}

.cg-filters__panel[hidden] {
    display: none;
}

@keyframes cgDrawerIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.cg-filters__panel-inner {
    width: var(--cg-drawer-width);
    max-width: 88vw;
    height: 100%;
    background: var(--cg-card-bg);
    overflow-y: auto;
    overscroll-behavior: contain;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    box-shadow: 6px 0 32px rgba(0, 0, 0, 0.18);
    animation: cgSlideIn 0.22s ease forwards;
}

@keyframes cgSlideIn {
    from { transform: translateX(-100%); }
    to   { transform: translateX(0); }
}

.cg-filters__overlay {
    flex: 1;
    background: rgba(0, 0, 0, 0.45);
    cursor: pointer;
}

.cg-filters__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--cg-border);
    font-size: 1rem;
    font-weight: 600;
    color: var(--cg-primary);
    position: sticky;
    top: 0;
    background: var(--cg-card-bg);
    z-index: 1;
}

.cg-filters__close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--cg-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--cg-radius-sm);
    transition: color var(--cg-transition), background var(--cg-transition);
}

.cg-filters__close:hover {
    color: var(--cg-accent);
    background: rgba(233, 69, 96, 0.08);
}

.cg-filters__body {
    padding: 20px;
    flex: 1;
}

/* ════════════════════════════════════════════════════════════════
   FILTROS — LISTA DE CATEGORÍAS
   ════════════════════════════════════════════════════════════════ */

.cg-category-filters__title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--cg-text-light);
    margin: 0 0 14px;
}

.cg-category-filters__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cg-category-filters__item {
    border-bottom: 1px solid var(--cg-border);
}

.cg-category-filters__item:last-child {
    border-bottom: none;
}

.cg-category-filters__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 0;
    color: var(--cg-text);
    text-decoration: none;
    font-size: var(--cg-font-sm);
    transition: color var(--cg-transition), padding-left var(--cg-transition);
    gap: 8px;
}

.cg-category-filters__link:hover {
    color: var(--cg-accent);
    padding-left: 4px;
}

.cg-category-filters__item.is-active .cg-category-filters__link {
    color: var(--cg-accent);
    font-weight: 600;
}

.cg-category-filters__item.is-active .cg-category-filters__name::before {
    content: "• ";
}

.cg-category-filters__name {
    flex: 1;
}

.cg-category-filters__count {
    font-size: 0.75rem;
    color: var(--cg-text-light);
    flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════════
   WRAPPER DEL SHORTCODE [cg_products]
   ════════════════════════════════════════════════════════════════ */

.cg-products-wrap {
    width: 100%;
}

.cg-no-products {
    background: var(--cg-bg);
    border-left: 4px solid var(--cg-accent);
    border-radius: var(--cg-radius);
    color: var(--cg-text-light);
    padding: 32px 24px;
    font-size: var(--cg-font-sm);
    margin: 16px 0;
}

/* ════════════════════════════════════════════════════════════════
   GRID DE PRODUCTOS
   Scoped bajo :is(body.cg-shop-page, .cg-products-wrap) para no afectar a:
     - Productos relacionados en ficha de producto
     - Carrito / checkout
     - Mini-cart
     - Cualquier otra página con widgets de WooCommerce
   ════════════════════════════════════════════════════════════════ */

:is(body.cg-shop-page, .cg-products-wrap) ul.products {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

:is(body.cg-shop-page, .cg-products-wrap) ul.products::after {
    display: none;
}

:is(body.cg-shop-page, .cg-products-wrap) ul.products li.product {
    background: var(--cg-card-bg);
    border: 1px solid var(--cg-border);
    border-radius: var(--cg-radius);
    overflow: hidden;
    transition:
        box-shadow var(--cg-transition),
        transform var(--cg-transition);
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    clear: none;
}

:is(body.cg-shop-page, .cg-products-wrap) ul.products li.product:hover {
    box-shadow: var(--cg-shadow-hover);
    transform: translateY(-3px);
}

/* ── Imagen 1:1 con object-fit: cover ──────────────────────────────────── */

:is(body.cg-shop-page, .cg-products-wrap) ul.products li.product .woocommerce-loop-product__link {
    display: block;
    overflow: hidden;
    line-height: 0;
}

:is(body.cg-shop-page, .cg-products-wrap) ul.products li.product .woocommerce-loop-product__link img,
:is(body.cg-shop-page, .cg-products-wrap) ul.products li.product img.attachment-woocommerce_thumbnail {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    border-radius: 0;
    transition: transform 0.4s ease;
}

:is(body.cg-shop-page, .cg-products-wrap) ul.products li.product:hover .woocommerce-loop-product__link img {
    transform: scale(1.04);
}

/* ── Título del producto ────────────────────────────────────────────────── */

:is(body.cg-shop-page, .cg-products-wrap) ul.products li.product .woocommerce-loop-product__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--cg-primary);
    margin: 12px 14px 6px;
    padding: 0;
    text-align: left;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* ── Precio ─────────────────────────────────────────────────────────────── */

:is(body.cg-shop-page, .cg-products-wrap) ul.products li.product .price {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cg-accent);
    margin: 0 14px 10px;
    padding: 0;
}

:is(body.cg-shop-page, .cg-products-wrap) ul.products li.product .price del {
    color: var(--cg-text-light);
    font-weight: 400;
    font-size: 0.82rem;
    margin-right: 4px;
    opacity: 0.8;
}

:is(body.cg-shop-page, .cg-products-wrap) ul.products li.product .price ins {
    text-decoration: none;
}

/* ── Botón "Añadir al carrito" ──────────────────────────────────────────── */

:is(body.cg-shop-page, .cg-products-wrap) ul.products li.product .button,
:is(body.cg-shop-page, .cg-products-wrap) ul.products li.product a.button {
    display: block;
    width: calc(100% - 28px);
    margin: auto 14px 14px;
    padding: 10px 14px;
    background-color: var(--cg-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--cg-radius-sm);
    font-size: var(--cg-font-xs);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--cg-transition);
    letter-spacing: 0.03em;
    box-sizing: border-box;
}

:is(body.cg-shop-page, .cg-products-wrap) ul.products li.product .button:hover,
:is(body.cg-shop-page, .cg-products-wrap) ul.products li.product a.button:hover {
    background-color: var(--cg-accent);
    color: #ffffff;
}

/* ── Badge oferta ───────────────────────────────────────────────────────── */

:is(body.cg-shop-page, .cg-products-wrap) ul.products li.product .onsale {
    background-color: var(--cg-accent);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: var(--cg-radius-sm);
    padding: 3px 8px;
    top: 10px;
    left: 10px;
    min-height: auto;
    line-height: 1.4;
}

/* ── Sin resultados ─────────────────────────────────────────────────────── */

:is(body.cg-shop-page, .cg-products-wrap) .woocommerce-info {
    background: var(--cg-bg);
    border-top-color: var(--cg-accent);
    border-radius: var(--cg-radius);
    color: var(--cg-text-light);
    padding: 32px 24px;
}

/* ════════════════════════════════════════════════════════════════
   PAGINACIÓN
   Solo afecta en páginas de archivo (scoped via :is(body.cg-shop-page, .cg-products-wrap))
   ════════════════════════════════════════════════════════════════ */

:is(body.cg-shop-page, .cg-products-wrap) nav.woocommerce-pagination {
    margin-top: 48px;
    text-align: center;
}

:is(body.cg-shop-page, .cg-products-wrap) nav.woocommerce-pagination ul {
    display: inline-flex;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
    border: none;
}

:is(body.cg-shop-page, .cg-products-wrap) nav.woocommerce-pagination ul li a,
:is(body.cg-shop-page, .cg-products-wrap) nav.woocommerce-pagination ul li span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--cg-border);
    border-radius: var(--cg-radius);
    font-size: var(--cg-font-sm);
    color: var(--cg-text);
    text-decoration: none;
    transition:
        background var(--cg-transition),
        border-color var(--cg-transition),
        color var(--cg-transition);
    background: var(--cg-card-bg);
}

:is(body.cg-shop-page, .cg-products-wrap) nav.woocommerce-pagination ul li a:hover {
    background: var(--cg-primary);
    border-color: var(--cg-primary);
    color: #fff;
}

:is(body.cg-shop-page, .cg-products-wrap) nav.woocommerce-pagination ul li span.current {
    background: var(--cg-accent);
    border-color: var(--cg-accent);
    color: #fff;
    font-weight: 700;
}

/* ════════════════════════════════════════════════════════════════
   BANNER DE CATEGORÍA — .cg-cat-banner
   Ancho completo, imagen de fondo, overlay de marca y título centrado.
   ════════════════════════════════════════════════════════════════ */

.cg-cat-banner {
    position: relative;
    /* Rompe el contenedor para ocupar todo el ancho disponible */
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    min-height: 360px;
    background-color: var(--cg-primary);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 0;
    margin-bottom: 40px;
}

.cg-cat-banner--no-image {
    min-height: 200px;
    background: linear-gradient(135deg, var(--cg-primary) 0%, #2a0a14 100%);
}

/* Overlay exacto solicitado */
.cg-cat-banner__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.8)   0%,
        rgba(0, 0, 0, 0.6)  40%,
        rgba(180, 0, 40, 0.6) 70%,
        rgba(255, 0, 80, 0.8) 100%
    );
    pointer-events: none;
}

.cg-cat-banner__content {
    position: relative;
    z-index: 1;
    padding: 48px 40px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.cg-cat-banner__title {
    color: #ffffff;
    font-size: clamp(2rem, 5vw, 3.6rem);
    font-weight: 800;
    margin: 0 0 10px;
    line-height: 1.1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cg-cat-banner__description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    line-height: 1.65;
    max-width: 600px;
    margin: 0 auto;
}

.cg-cat-banner__description p {
    margin: 0;
}

/* ════════════════════════════════════════════════════════════════
   GRID DE SUBCATEGORÍAS — .cg-subcats
   Cards cuadradas con imagen de fondo y título superpuesto.
   ════════════════════════════════════════════════════════════════ */

.cg-subcats {
    display: grid;
    grid-template-columns: repeat(var(--cg-subcats-cols, 3), 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

/* Card: cuadrada, imagen ocupa todo, título superpuesto arriba */
.cg-subcats__card {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 12px;
    text-decoration: none;
    color: #ffffff;
    background-color: var(--cg-primary);
    box-shadow: var(--cg-shadow);
    transition:
        transform var(--cg-transition),
        box-shadow var(--cg-transition);
}

.cg-subcats__card:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: var(--cg-shadow-hover);
    color: #ffffff;
    text-decoration: none;
}

/* Imagen: cubre toda la card */
.cg-subcats__img-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.cg-subcats__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.45s ease;
}

.cg-subcats__card:hover .cg-subcats__img {
    transform: scale(1.08);
}

/* Placeholder si no hay imagen */
.cg-subcats__img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2a0a14 0%, var(--cg-primary) 100%);
    color: rgba(255, 255, 255, 0.25);
}

/* Overlay sobre la imagen para legibilidad del título */
.cg-subcats__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.72) 0%,
        rgba(0, 0, 0, 0.15) 45%,
        rgba(0, 0, 0, 0.35) 100%
    );
    z-index: 1;
    pointer-events: none;
    transition: background var(--cg-transition);
}

.cg-subcats__card:hover .cg-subcats__overlay {
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.78) 0%,
        rgba(180, 0, 40, 0.2) 50%,
        rgba(255, 0, 80, 0.45) 100%
    );
}

/* Título: superpuesto arriba, bold, mayúsculas */
.cg-subcats__name {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px 14px 12px;
    z-index: 2;
    font-weight: 800;
    font-size: clamp(0.85rem, 1.8vw, 1.1rem);
    line-height: 1.2;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cg-subcats__count {
    font-size: 0.72rem;
    font-weight: 400;
    opacity: 0.8;
    text-transform: none;
    letter-spacing: 0;
}

/* ── Responsive subcategorías ─────────────────────────────────────────────── */

@media (max-width: 960px) {
    .cg-subcats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .cg-subcats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .cg-subcats__name {
        padding: 10px 10px 8px;
        font-size: 0.78rem;
    }
}

/* ── Responsive banner ────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .cg-cat-banner {
        min-height: 260px;
    }

    .cg-cat-banner__content {
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    .cg-cat-banner {
        min-height: 200px;
    }

    .cg-cat-banner__title {
        font-size: clamp(1.5rem, 6vw, 2rem);
    }
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */

/* 3 columnas — tablets apaisadas */
@media (max-width: 1280px) {
    :is(body.cg-shop-page, .cg-products-wrap) ul.products {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 2 columnas — tablets */
@media (max-width: 768px) {
    :is(body.cg-shop-page, .cg-products-wrap) ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .cg-products-toolbar,
    .cg-toolbar {
        gap: 8px;
    }

    .cg-ordering {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    .cg-ordering__select {
        flex: 1;
        min-width: 0;
    }

    .cg-search-title {
        font-size: 1.4rem;
    }
}

/* 1 columna — móviles pequeños */
@media (max-width: 380px) {
    :is(body.cg-shop-page, .cg-products-wrap) ul.products {
        grid-template-columns: 1fr;
    }
}

/* ════════════════════════════════════════════════════════════════
   UTILIDAD OPCIONAL — Imagen 1:1 para cualquier contenedor
   ════════════════════════════════════════════════════════════════ */

.cg-product-img-square img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

/* ════════════════════════════════════════════════════════════════
   BARRA DE BÚSQUEDA ACTIVA [cg_search_bar]
   Universal — funciona en cualquier página o plantilla de Elementor
   ════════════════════════════════════════════════════════════════ */

.cg-search-bar {
    position: relative;
    width: 100%;
    max-width: 640px;
    font-family: inherit;
}

/* ── Formulario ─────────────────────────────────────────────────────────── */

.cg-search-bar__form {
    position: relative;
}

.cg-search-bar__wrap {
    display: flex;
    align-items: center;
    background: var(--cg-card-bg);
    border: 2px solid var(--cg-border);
    border-radius: 50px;
    overflow: hidden;
    transition: border-color var(--cg-transition), box-shadow var(--cg-transition);
}

.cg-search-bar__wrap:focus-within {
    border-color: var(--cg-accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.12);
}

.cg-search-bar__icon {
    padding: 0 10px 0 18px;
    color: var(--cg-text-light);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    pointer-events: none;
}

.cg-search-bar__input {
    flex: 1;
    border: none;
    outline: none;
    padding: 13px 4px;
    font-size: 0.9375rem;
    color: var(--cg-text);
    background: transparent;
    box-shadow: none;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
}

/* Eliminar el outline/borde negro del navegador al hacer foco */
.cg-search-bar__input:focus,
.cg-search-bar__input:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.cg-search-bar__input::placeholder {
    color: var(--cg-text-light);
}

.cg-search-bar__input::-webkit-search-cancel-button,
.cg-search-bar__input::-webkit-search-decoration {
    display: none;
}

/* Botón Buscar */
.cg-search-bar__submit {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 22px;
    height: 100%;
    min-height: 46px;
    background: var(--cg-accent);
    border: none;
    border-radius: 0 50px 50px 0;
    color: #fff;
    font-size: var(--cg-font-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--cg-transition);
    white-space: nowrap;
}

.cg-search-bar__submit:hover {
    background: var(--cg-accent-hover);
}

/* ── Dropdown de resultados ─────────────────────────────────────────────── */

.cg-search-bar__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--cg-card-bg);
    border: 1px solid var(--cg-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.13);
    z-index: 9999;
    overflow: hidden;
    animation: cgDropIn 0.15s ease forwards;
}

.cg-search-bar__dropdown[hidden] {
    display: none;
}

@keyframes cgDropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Lista de resultados ────────────────────────────────────────────────── */

.cg-search-bar__list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
}

.cg-search-bar__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    cursor: pointer;
    transition: background var(--cg-transition);
    text-decoration: none;
    color: var(--cg-text);
    outline: none;
}

.cg-search-bar__item:hover,
.cg-search-bar__item:focus {
    background: var(--cg-bg);
}

.cg-search-bar__item-img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid var(--cg-border);
}

.cg-search-bar__item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cg-search-bar__item-title {
    font-size: var(--cg-font-sm);
    font-weight: 500;
    color: var(--cg-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Resaltado del texto buscado */
.cg-search-bar__item-title mark {
    background: rgba(233, 69, 96, 0.13);
    color: var(--cg-accent);
    font-weight: 700;
    border-radius: 2px;
    padding: 0 1px;
}

.cg-search-bar__item-cat {
    font-size: 0.75rem;
    color: var(--cg-text-light);
}

.cg-search-bar__item-price {
    font-size: var(--cg-font-sm);
    font-weight: 700;
    color: var(--cg-accent);
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
}

/* Quitar estilos por defecto de WooCommerce dentro del dropdown */
.cg-search-bar__item-price .woocommerce-Price-amount,
.cg-search-bar__item-price bdi {
    color: inherit;
    font-size: inherit;
}

/* ── Enlace "Ver todos" ─────────────────────────────────────────────────── */

.cg-search-bar__see-all {
    display: block;
    padding: 11px 16px;
    font-size: var(--cg-font-xs);
    font-weight: 600;
    color: var(--cg-accent);
    text-decoration: none;
    border-top: 1px solid var(--cg-border);
    text-align: center;
    transition: background var(--cg-transition);
}

.cg-search-bar__see-all:hover {
    background: #fff5f7;
    color: var(--cg-accent-hover);
}

/* ── Estado de carga ────────────────────────────────────────────────────── */

.cg-search-bar__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 22px;
}

.cg-search-bar__loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cg-accent);
    animation: cgBounceDot 1.1s ease-in-out infinite;
}

.cg-search-bar__loading span:nth-child(2) { animation-delay: 0.18s; }
.cg-search-bar__loading span:nth-child(3) { animation-delay: 0.36s; }

@keyframes cgBounceDot {
    0%, 80%, 100% { transform: scale(0.55); opacity: 0.35; }
    40%            { transform: scale(1.0);  opacity: 1; }
}

/* ── Sin resultados ─────────────────────────────────────────────────────── */

.cg-search-bar__no-results {
    padding: 22px 16px 10px;
    text-align: center;
}

.cg-search-bar__no-results-icon {
    font-size: 1.75rem;
    display: block;
    margin-bottom: 10px;
    line-height: 1;
}

.cg-search-bar__no-results p {
    font-size: var(--cg-font-sm);
    color: var(--cg-text-light);
    margin: 0 0 4px;
    line-height: 1.5;
}

.cg-search-bar__no-results strong {
    color: var(--cg-text);
    font-weight: 600;
}

.cg-search-bar__no-results-hint {
    font-size: 0.8rem;
    color: var(--cg-text-light);
    opacity: 0.8;
}

/* ── Sugerencias fuzzy ("¿Quisiste decir?") ─────────────────────────────── */

.cg-search-bar__suggestions {
    border-top: 1px solid var(--cg-border);
    padding-bottom: 4px;
}

.cg-search-bar__suggestions-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--cg-text-light);
    padding: 12px 16px 2px;
    margin: 0;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .cg-search-bar__submit span {
        display: none; /* Solo icono en móvil */
    }

    .cg-search-bar__submit {
        padding: 0 16px;
    }

    .cg-search-bar__item-img {
        width: 42px;
        height: 42px;
    }

    .cg-search-bar__item-price {
        display: none; /* Ahorra espacio en móvil muy pequeño */
    }
}
