/* ==========================================================================
   Marketplace Custom — Compatibilidad estructural Dokan + Betheme
   --------------------------------------------------------------------------
   Arregla el conflicto de layout entre el contenido de Dokan (tienda /store/ y
   panel del vendedor) y el "wrapper" de Betheme. TODO va scoped a
   `body.mktc-dokan-store` para no afectar al resto del sitio.

   Síntomas que corrige (vistos en el DevTools de las capturas):
   - El footer de Betheme (#Footer / #mfn-footer-template) se monta sobre el
     contenido porque el contenedor colapsa (floats sin limpiar / height fija).
   - El header fijo deja un offset raro y tapa la parte de arriba.
   - El #Subheader (barra de breadcrumb) mete padding/espacio sobrante.
   - El contenedor de Betheme estruja el layout sidebar+listado de Dokan.
   - Caja de imagen vacía/rota (banner de la tienda sin src).

   Las reglas usan !important con moderación, solo donde hay que vencer reglas
   por ID del tema (especificidad alta). Son tuneables: si Betheme usa selectores
   extra en tu versión, ajústalos aquí (inspecciona con DevTools como en la captura).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Footer SIEMPRE debajo del contenido (arregla el footer encima)
   El contenedor de la tienda/panel no debe colapsar: limpiamos floats y
   dejamos que el contenido crezca; el footer queda en flujo, por debajo.
   -------------------------------------------------------------------------- */
body.mktc-dokan-store #Content {
    height: auto !important;
    min-height: 1px;
    overflow: visible !important;
    position: relative;
    z-index: 1;
}

body.mktc-dokan-store .dokan-store-wrap,
body.mktc-dokan-store .dokan-dashboard-wrap,
body.mktc-dokan-store .dokan-store-tabs,
body.mktc-dokan-store .seller-listing-wrap {
    overflow: visible;
}

/* Clearfix: evita que el contenedor colapse cuando dentro hay floats. */
body.mktc-dokan-store .dokan-store-wrap::after,
body.mktc-dokan-store .dokan-dashboard-wrap::after,
body.mktc-dokan-store .seller-listing-wrap::after {
    content: "";
    display: table;
    clear: both;
}

body.mktc-dokan-store #Footer,
body.mktc-dokan-store #mfn-footer-template,
body.mktc-dokan-store .mfn-footer {
    position: relative !important;
    z-index: 2;
    clear: both;
    margin-top: 0;
}

/* --------------------------------------------------------------------------
   2. Header fijo: que el contenido no quede tapado ni demasiado pegado.
   No tocamos el padding-top de #Wrapper que calcula Betheme (rompería el
   offset en el resto del sitio); solo aseguramos el orden de apilado.
   -------------------------------------------------------------------------- */
body.mktc-dokan-store #Header_wrapper,
body.mktc-dokan-store #Top_bar {
    z-index: 100;
}

/* --------------------------------------------------------------------------
   3. Subheader (breadcrumb de Betheme): padding sobrio y sin solaparse.
   -------------------------------------------------------------------------- */
body.mktc-dokan-store #Subheader {
    padding: 18px 0 !important;
    position: relative;
    z-index: 1;
}
body.mktc-dokan-store #Subheader .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

/* --------------------------------------------------------------------------
   4. Ancho útil para el layout sidebar + listado de la tienda Dokan.
   El .container de Betheme sigue centrado; aquí damos a las columnas de Dokan
   un reparto flexible para que no se estrujen.
   -------------------------------------------------------------------------- */
body.mktc-dokan-store .dokan-store-wrap.layout-left,
body.mktc-dokan-store .dokan-store-wrap.layout-right {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    flex-wrap: wrap;
}
body.mktc-dokan-store .dokan-store-sidebar {
    width: 280px;
    max-width: 100%;
    flex: 0 0 auto;
}
body.mktc-dokan-store .dokan-store-wrap .dokan-store-products,
body.mktc-dokan-store .dokan-store-wrap > .dokan-store-tabs ~ * {
    flex: 1 1 0;
    min-width: 0;
}

/* En móvil, la barra lateral se apila a ancho completo. */
@media (max-width: 767px) {
    body.mktc-dokan-store .dokan-store-sidebar {
        width: 100%;
    }
}

/* --------------------------------------------------------------------------
   5. Limpieza de imágenes rotas (banner/avatar sin src) que dejan el cuadro
   blanco con el icono de imagen rota.
   -------------------------------------------------------------------------- */
body.mktc-dokan-store img[src=""],
body.mktc-dokan-store img:not([src]) {
    display: none !important;
}

/* Banner de la tienda: fondo de marca como fallback si no hay imagen. */
body.mktc-dokan-store .dokan-store-wrap .profile-frame .profile-info-img,
body.mktc-dokan-store .store-banner {
    background-color: var(--rx-green);
}

/* --------------------------------------------------------------------------
   6. Que el contenido de Dokan no herede anchos/sombras raras del tema.
   -------------------------------------------------------------------------- */
body.mktc-dokan-store #Content .container,
body.mktc-dokan-store #Content .content_wrapper {
    overflow: visible;
}
body.mktc-dokan-store .dokan-store-wrap,
body.mktc-dokan-store .dokan-dashboard {
    box-shadow: none;
}

/* ==========================================================================
   7. TIENDA MINIMALISTA (v2.9.0 / v2.10.0)
   Quita el #Subheader (breadcrumb), las pestañas Productos/Reviews y los botones
   Follow / Get Support / Share. La eliminación "real" de Follow/Support/Report
   la hace la desactivación de módulos de Dokan; estas reglas son el respaldo.
   ========================================================================== */

/* Subheader (breadcrumb "Home >") fuera en la tienda pública. */
body.mktc-dokan-storepage #Subheader {
    display: none !important;
}

/* Pestañas Productos / Reviews fuera (siempre). */
body.mktc-dokan-storepage .dokan-store-tabs {
    display: none !important;
}

/* Buscador/orden nativos de Dokan: SOLO se ocultan si el sidebar Rexor existe
   (`:has`), para no dejar la tienda sin controles si el hook no inyectó el
   sidebar en tu versión de Dokan. El JS (initStoreLayout) hace lo mismo como
   respaldo en navegadores sin `:has`. */
body.mktc-dokan-storepage:has(.mktc-store-filters) .dokan-store-products-filter-area,
body.mktc-dokan-storepage:has(.mktc-store-filters) .dokan-store-products-ordering,
body.mktc-dokan-storepage:has(.mktc-store-filters) .dokan-store-products-search-form,
body.mktc-dokan-storepage:has(.mktc-store-filters) form.dokan-store-products-filter,
body.mktc-dokan-storepage:has(.mktc-store-filters) .seller-items-filter,
body.mktc-dokan-storepage:has(.mktc-store-filters) .woocommerce-ordering {
    display: none !important;
}

/* Botones de la cabecera de la tienda: Follow / Get Support / Share. */
body.mktc-dokan-store .dokan-store-support-btn,
body.mktc-dokan-store .dokan-store-support-btn-product,
body.mktc-dokan-store .dokan-store-follow,
body.mktc-dokan-store .dokan-store-follow-button,
body.mktc-dokan-store .dokan-follow-store-button,
body.mktc-dokan-store .dokan-follow-button,
body.mktc-dokan-store .dokan-share,
body.mktc-dokan-store .dokan-social-share,
body.mktc-dokan-store .dokan-store-share,
body.mktc-dokan-store .store-social-share {
    display: none !important;
}

/* ==========================================================================
   8. TIENDA: ancho normal + SIDEBAR de filtros Rexor + grilla 3 columnas
   El template Betheme viene `layout-full-width`; lo acotamos y montamos un
   layout flex [aside filtros | grilla]. El JS (initStoreLayout) coloca el
   sidebar y mueve la grilla; aquí solo el aspecto. Padding superior de 30px.
   ========================================================================== */

body.mktc-dokan-storepage #Content .container,
body.mktc-dokan-storepage .dokan-store-wrap {
    max-width: 1240px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    float: none !important;
}

/* El sidebar fuente se oculta hasta que el JS lo coloca en el aside (sin flash).
   SOLO en escritorio: en móvil los filtros deben verse aunque el JS no llegue a
   reestructurar (caché móvil aparte, markup distinto, etc.). */
@media (min-width: 1025px) {
    body.mktc-dokan-storepage .mktc-store-filters { display: none; }
    body.mktc-dokan-storepage .mktc-store-aside .mktc-store-filters { display: block; }
}

/* Botón "Filtrar productos" del drawer: oculto en escritorio, lo crea el JS. */
body.mktc-dokan-storepage .mktc-store-filters-toggle { display: none; }

body.mktc-dokan-storepage .mktc-store-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    max-width: 1280px;
    margin: 0 auto;
    /* padding superior + laterales para que las tarjetas/botones no queden
       pegados al borde derecho. */
    padding: 30px 24px 0;
    box-sizing: border-box;
}
body.mktc-dokan-storepage .mktc-store-aside {
    width: 280px;
    flex: 0 0 280px;
    position: sticky;
    top: 110px;
}
body.mktc-dokan-storepage .mktc-store-main {
    flex: 1 1 0;
    min-width: 0;
}

/* Contador de resultados ("N productos"). */
body.mktc-dokan-storepage .mktc-store-count {
    font-family: 'Outfit', system-ui, sans-serif;
    font-weight: 600;
    font-size: 15px;
    color: var(--rx-dark);
    margin: 0 0 12px;
}

/* Chips de filtros activos (con "x" para quitar). */
body.mktc-dokan-storepage .mktc-store-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}
body.mktc-dokan-storepage .mktc-store-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--rx-line);
    background: var(--rx-cream);
    color: var(--rx-green);
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 500;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}
body.mktc-dokan-storepage .mktc-store-chip:hover {
    border-color: var(--rx-gold);
}

/* 4 columnas (las originales de la tarjeta) SOLO en la tienda del vendedor. Los
   selectores extra (`.shenoa-cards` en el body / dentro de `.mktc-store-main`)
   suben la especificidad para igualar la regla de shenoa.css. */
body.mktc-dokan-storepage ul.products,
body.mktc-dokan-storepage.shenoa-cards ul.products,
body.mktc-dokan-storepage .mktc-store-main ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 24px !important;
    margin: 0 !important;
}
body.mktc-dokan-storepage ul.products::before,
body.mktc-dokan-storepage ul.products::after {
    content: none !important;
    display: none !important;
}

/* En la tienda del vendedor sobra el chip de vendedor (avatar + nombre) de cada
   tarjeta: ya estás dentro de su tienda. */
body.mktc-dokan-storepage .shenoa-card__vendor-chip {
    display: none !important;
}
/* `> li` (no solo li.product): tras filtrar por AJAX las tarjetas Shenoa vienen
   en <li> sin la clase product. */
body.mktc-dokan-storepage ul.products > li {
    width: auto !important;
    margin: 0 !important;
    float: none !important;
    clear: none !important;
}

@media (max-width: 1024px) {
    body.mktc-dokan-storepage .mktc-store-layout { flex-wrap: wrap; padding: 16px 16px 0; }
    body.mktc-dokan-storepage .mktc-store-aside { width: 100%; flex-basis: 100%; position: static; }
    body.mktc-dokan-storepage .mktc-store-main { width: 100%; }

    body.mktc-dokan-storepage ul.products,
    body.mktc-dokan-storepage.shenoa-cards ul.products,
    body.mktc-dokan-storepage .mktc-store-main ul.products { grid-template-columns: repeat(3, 1fr) !important; }

    /* Drawer: cuando el JS añadió el toggle, el panel arranca colapsado y se
       abre al pulsar el botón (clase .is-open). Si el JS no corrió, no hay
       .has-toggle → el panel queda visible (respaldo). */
    body.mktc-dokan-storepage .mktc-store-layout.has-toggle .mktc-store-aside { display: none; }
    body.mktc-dokan-storepage .mktc-store-layout.has-toggle .mktc-store-aside.is-open { display: block; }

    body.mktc-dokan-storepage .mktc-store-filters-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        order: -1;
        width: 100%;
        margin: 0 0 16px;
        padding: 13px 18px;
        background: var(--rx-green);
        color: #fff;
        border: 0;
        border-radius: 12px;
        font-family: 'Outfit', system-ui, sans-serif;
        font-weight: 600;
        font-size: 15px;
        cursor: pointer;
    }

}
@media (max-width: 768px) {
    body.mktc-dokan-storepage ul.products,
    body.mktc-dokan-storepage.shenoa-cards ul.products,
    body.mktc-dokan-storepage .mktc-store-main ul.products { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 480px) {
    body.mktc-dokan-storepage ul.products,
    body.mktc-dokan-storepage.shenoa-cards ul.products,
    body.mktc-dokan-storepage .mktc-store-main ul.products { grid-template-columns: 1fr !important; }
}

/* ==========================================================================
   9. FICHA DE PRODUCTO — quitar Get Support / Report Abuse y el corazón de
   BeTheme; estilar la fila de acciones Rexor (favorito + comparar) junto a
   "Comprar".
   ========================================================================== */
body.mktc-dokan-product .dokan-store-support-btn-product,
body.mktc-dokan-product .dokan-store-support-btn,
body.mktc-dokan-product a.dokan-report-abuse-link,
body.mktc-dokan-product .dokan-report-abuse-button,
body.mktc-dokan-product .dokan-report-abuse,
body.mktc-dokan-product .dokan-product-report-abuse,
body.mktc-dokan-product a.mfn-wish-button,
body.mktc-dokan-product .mfn-wish-button {
    display: none !important;
}

/* Fila de acciones Rexor junto al botón "Comprar". */
.mktc-product-actions {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    margin-left: 10px;
    vertical-align: middle;
}
.mktc-product-actions .mktc-wish-btn,
.mktc-product-actions .mktc-compare-btn {
    width: 52px;
    height: 52px;
    min-width: 52px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--rx-line);
    color: var(--rx-green);
    cursor: pointer;
}
.mktc-product-actions .mktc-wish-btn svg,
.mktc-product-actions .mktc-compare-btn svg {
    width: 22px;
    height: 22px;
}
.mktc-product-actions .mktc-compare-btn span {
    display: none; /* icono solo, para que iguale al de favorito */
}
.mktc-product-actions .mktc-wish-btn:hover,
.mktc-product-actions .mktc-compare-btn:hover {
    border-color: var(--rx-gold);
}
.mktc-product-actions .is-active {
    background: var(--rx-green);
    border-color: var(--rx-green);
    color: #fff;
}
