/* css/tienda-componentes.css
   Componentes comunes a todos los temas (también al diseño base TVirtualShop):
   vista previa de temas, filtros del listado, muestras de color y piezas compartidas de los temas.
   Los colores salen de las variables del tema (--tm-*) con valores de respaldo. */

/* ---------- Vista previa de temas (solo administradores) ---------- */
.tema-preview-banner {
    position: sticky;
    top: 0;
    z-index: 1060;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    padding: .6rem 1.25rem;
    background: #1e4fc2;
    color: #ffffff;
    font-size: .92rem;
}
.tema-preview-acciones { display: flex; flex-wrap: wrap; gap: .5rem; }
body .tema-preview-banner a.btn-outline-light { color: #ffffff; border-color: #ffffff; }
body .tema-preview-banner a.btn-outline-light:hover { color: #1e4fc2; background: #ffffff; }

/* ---------- Listado de productos con filtros ---------- */
.tf-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}
.tf-toggle-movil { display: none; }
.tf-sidebar {
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.tf-sidebar-cabecera { display: flex; justify-content: space-between; align-items: center; }
.tf-sidebar-cabecera h2 { font-size: 1.1rem; margin: 0; }
.tf-limpiar { font-size: .85rem; font-weight: 600; color: var(--tm-primario, #0d6efd); text-decoration: none; }
.tf-grupo { border: 0; border-top: 1px solid #e6e9ed; margin: 0; padding: 1rem 0 0; min-width: 0; }
.tf-grupo legend {
    float: left;
    width: 100%;
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: .6rem;
    padding: 0;
    color: var(--tm-texto, #212529);
}
.tf-grupo legend + * { clear: both; }
.tf-opciones { display: flex; flex-wrap: wrap; gap: .5rem; }
.tf-opciones-lista { display: flex; flex-direction: column; gap: .35rem; }

.tf-chip input,
.tf-color input,
.tf-categoria input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tf-chip > span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-width: 48px;
    min-height: 44px;
    justify-content: center;
    padding: 0 .8rem;
    border: 1px solid #d0d6dd;
    border-radius: 10px;
    background: #ffffff;
    font-weight: 600;
    font-size: .92rem;
    cursor: pointer;
    color: var(--tm-texto, #212529);
}
.tf-chip small, .tf-color small, .tf-categoria small { font-weight: 500; color: #6b747d; font-size: .78rem; }
.tf-chip input:checked + span {
    background: var(--tm-primario, #0d6efd);
    border-color: var(--tm-primario, #0d6efd);
    color: var(--tm-primario-texto, #ffffff);
}
.tf-chip input:checked + span small { color: inherit; }
.tf-chip input:focus-visible + span,
.tf-color input:focus-visible + span,
.tf-categoria input:focus-visible + span { outline: 3px solid var(--tm-primario, #0d6efd); outline-offset: 2px; }
.tf-chip.is-vacio span { opacity: .45; }

.tf-color > span {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-height: 44px;
    padding: 0 .75rem;
    border: 1px solid #e6e9ed;
    border-radius: 10px;
    cursor: pointer;
    font-size: .92rem;
    color: var(--tm-texto, #212529);
    background: #ffffff;
}
.tf-color .tf-muestra { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); flex-shrink: 0; }
.tf-color small { margin-left: auto; }
.tf-color input:checked + span { border: 2px solid var(--tm-primario, #0d6efd); font-weight: 700; }

.tf-categoria > span {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-height: 40px;
    padding: 0 .5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: .92rem;
    color: var(--tm-texto, #212529);
}
.tf-categoria small { margin-left: auto; }
.tf-categoria input:checked + span { background: #eef4fa; font-weight: 700; }

.tf-categoria-enlace { display: flex; align-items: center; min-height: 36px; padding: 0 .6rem; border-radius: 8px; font-size: .92rem; text-decoration: none; color: var(--tm-texto, #212529); }
.tf-sidebar a.tf-categoria-enlace { color: var(--tm-texto, #212529); }
.tf-categoria-enlace:hover { background: #f1f3f5; }
.tf-sidebar a.tf-categoria-enlace.is-activo { background: var(--tm-primario, #0d6efd); color: var(--tm-primario-texto, #ffffff); font-weight: 700; }
.tf-opciones-lista { max-height: 320px; overflow-y: auto; }
.tf-precio { display: flex; gap: .6rem; }
.tf-precio label { flex: 1; display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: #5b646d; }
.tf-precio input { width: 100%; height: 40px; border: 1px solid #d0d6dd; border-radius: 8px; padding: 0 .6rem; font-size: .95rem; }
.tf-check { display: flex; align-items: center; gap: .6rem; font-size: .92rem; font-weight: 600; min-height: 40px; }
.tf-check input { width: 18px; height: 18px; }
.tf-aplicar {
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 10px;
    background: var(--tm-primario, #0d6efd);
    color: var(--tm-primario-texto, #ffffff);
    font-weight: 700;
}

.tf-barra { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.tf-resumen { font-size: .92rem; color: #5b646d; }
.tf-orden { display: flex; align-items: center; gap: .5rem; font-size: .9rem; font-weight: 600; }
.tf-orden select { min-height: 40px; border: 1px solid #d0d6dd; border-radius: 8px; padding: 0 .6rem; background: #ffffff; }
.tf-activos { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.tf-activo {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 36px;
    padding: 0 .8rem;
    border-radius: 999px;
    background: #eef4fa;
    color: #0b4f82;
    font-size: .85rem;
    font-weight: 700;
    text-decoration: none;
}
.tf-activo:hover { background: #dbe9f6; color: #0b4f82; }
.tf-vacio { border: 1px dashed #c9cfd6; border-radius: 12px; padding: 2.5rem 1rem; text-align: center; color: #5b646d; }

@media (max-width: 991.98px) {
    .tf-layout { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .tf-toggle-movil {
        display: inline-flex;
        align-items: center;
        gap: .5rem;
        min-height: 44px;
        padding: 0 1rem;
        border: 1px solid #d0d6dd;
        border-radius: 10px;
        background: #ffffff;
        font-weight: 700;
    }
    .tf-sidebar { position: static; }
    .tf-sidebar[hidden] { display: none; }
}
@media (min-width: 992px) {
    .tf-sidebar[hidden] { display: flex !important; }
}

/* ---------- Ficha de producto: muestras de color y opciones agotadas ---------- */
.variant-swatch-label {
    width: 44px;
    height: 44px;
    padding: 3px !important;
    border-radius: 50% !important;
    border: 1px solid #c9cfd6 !important;
    background: #ffffff !important;
}
.variant-swatch-label .variant-swatch {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,.15);
}
.btn-check:checked + .variant-swatch-label { border: 2px solid var(--tm-texto, #212529) !important; }
.btn-check:focus-visible + .variant-swatch-label { outline: 3px solid var(--tm-primario, #0d6efd); outline-offset: 2px; }
.btn-check.is-agotado + .btn,
.btn-check.is-agotado + .variant-swatch-label {
    opacity: .45;
    text-decoration: line-through;
}
.variant-color-nombre { font-weight: 600; }

/* ---------- Piezas compartidas de los temas ---------- */
.tm-contador {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--tm-primario, #0d6efd);
    color: var(--tm-primario-texto, #ffffff);
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
}
/* Los temas pintan todos los enlaces (body.tema-x a { color }) y eso le ganaba al color de texto
   de Bootstrap en los enlaces con forma de botón (<a class="btn ...">): texto del mismo color que el fondo. */
body[class*="tema-"]:not(.tema-tvirtualshop) a.btn { color: var(--bs-btn-color); }
body[class*="tema-"]:not(.tema-tvirtualshop) a.btn:hover,
body[class*="tema-"]:not(.tema-tvirtualshop) a.btn:focus-visible { color: var(--bs-btn-hover-color); }
body[class*="tema-"]:not(.tema-tvirtualshop) a.btn:active { color: var(--bs-btn-active-color); }

.tm-carrito, .tm-cuenta, .tm-notificaciones { position: relative; }
.tm-cuenta .tm-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: none; vertical-align: middle; }
.tm-notificaciones #notification-list { width: 340px; max-width: 90vw; }

.tm-whatsapp { position: fixed; right: 20px; bottom: 20px; z-index: 1040; display: flex; flex-direction: column; align-items: flex-end; gap: .6rem; }
.tm-whatsapp-boton {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 0;
    background: #1f8f4e;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    box-shadow: 0 6px 18px rgba(0,0,0,.22);
    text-decoration: none;
}
.tm-whatsapp-boton:hover { color: #ffffff; background: #19783f; }
.tm-whatsapp-menu {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0,0,0,.18);
    overflow: hidden;
}
.tm-whatsapp-menu[hidden] { display: none; }
.tm-whatsapp-menu a { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; color: #1b1f24; text-decoration: none; font-weight: 600; font-size: .92rem; }
.tm-whatsapp-menu a:hover { background: #f1f7f3; }

.tm-promo-free { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; }
.tm-promo-free a { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .7rem; border-radius: 999px; background: #1f8f4e; color: #ffffff; text-decoration: none; }

.tm-muestras { display: flex; flex-wrap: wrap; gap: 5px; }
.tm-muestras span { width: 13px; height: 13px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); }

.tm-sin-contenido { text-align: center; padding: 3rem 1rem; color: #5b646d; }
