/*
 * Componentes compartidos.
 * Reúne los estilos que antes estaban dentro de cada página (<style> y
 * style="..."), para que se carguen una vez y se mantengan en un solo lugar.
 * Se carga después de style.css.
 */

/* ---------- Base y accesibilidad ---------- */

[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    top: -60px;
    left: 12px;
    z-index: 2000;
    padding: 10px 16px;
    border-radius: 0 0 12px 12px;
    background: var(--pink, #d63384);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    transition: top .15s ease;
}

.skip-link:focus {
    top: 0;
}

main:focus {
    outline: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--pink, #d63384);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- Encabezado ---------- */

.site-header nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.nav-logout {
    display: inline;
    margin: 0;
}

.nav-logout button {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.nav-logout button:hover {
    text-decoration: underline;
}

.cart-open-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid #e8a4c7;
    border-radius: 999px;
    background: #fff0f7;
    color: #c42679;
    font: inherit;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, transform .2s;
}

.cart-open-button:hover {
    background: #ffe0ef;
    transform: translateY(-1px);
}

.cart-open-button .cart-count {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 999px;
    background: #d92e87;
    color: #fff;
    font-size: .75rem;
    font-weight: 800;
}

@media (max-width: 480px) {
    .cart-open-button {
        padding: 8px 10px;
        font-size: .8rem;
    }
}

/*
 * Celular: logo, "Catálogo" y el botón del pedido en un solo renglón.
 * El logo ya lleva al inicio, y el botón conserva su aria-label.
 */
@media (max-width: 560px) {
    .site-header .nav-home,
    .cart-open-button .cart-label {
        display: none;
    }

    .site-header nav {
        gap: 14px;
    }

    .cart-open-button {
        gap: 6px;
        font-size: 1rem;
    }
}

/* ---------- Tarjeta de producto ---------- */

.product-card {
    position: relative;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.product-card:hover,
.product-card:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px rgba(190, 24, 93, .12);
    border-color: #f3a6cb;
}

/* El enlace del título cubre toda la tarjeta. */
.product-card-link {
    color: inherit;
    text-decoration: none;
}

.product-card-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.product-card-link:focus-visible {
    outline: none;
}

.product-card:focus-within {
    outline: 3px solid var(--pink, #d63384);
    outline-offset: 3px;
}

.product-card.is-soldout .product-image img {
    opacity: .6;
    filter: grayscale(.35);
}

.product-card-hint {
    display: inline-block;
    margin-top: 12px;
    color: #d63384;
    font-size: .88rem;
    font-weight: 600;
}

/* ---------- Precio y ofertas ---------- */

.product-image {
    position: relative;
}

.price-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    margin-top: auto;
    padding-top: 10px;
}

/* El precio ya no empuja hacia abajo: lo hace .price-row. */
.product-info .price-row strong {
    margin-top: 0;
    padding-top: 0;
}

.price-before {
    color: var(--muted, #896d7c);
    font-size: .82rem;
}

.sale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #d92e87;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
    box-shadow: 0 4px 10px rgba(190, 24, 93, .25);
}

.sale-badge-inline {
    position: static;
    align-self: center;
    box-shadow: none;
}

/* En el detalle no debe empujar el contenido hacia abajo. */
.detail-price-row {
    margin-top: 0;
    padding-top: 0;
}

.detail-price-row .price-before {
    font-size: 1rem;
}

/* ---------- Inicio: cómo pedir ---------- */

.how-to-order {
    margin: 0 0 40px;
    padding: clamp(20px, 3vw, 32px);
    border: 1px solid var(--line, #f3dce7);
    border-radius: 22px;
    background: var(--pink-pale, #fff8fb);
}

.how-to-order h2 {
    margin: 0 0 18px;
    text-align: center;
}

.how-to-order ol {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.how-to-order li {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px;
    border-radius: 18px;
    background: #fff;
    text-align: center;
}

.how-to-order .step-icon {
    font-size: 1.8rem;
}

.how-to-order li span:last-child {
    color: var(--muted, #896d7c);
    font-size: .9rem;
    line-height: 1.5;
}

/* Celular: cada paso en un renglón (ícono a la izquierda) para no alejar los productos. */
@media (max-width: 720px) {
    .how-to-order {
        margin-bottom: 28px;
        padding: 16px;
    }

    .how-to-order h2 {
        margin-bottom: 12px;
        font-size: 1.2rem;
    }

    .how-to-order ol {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .how-to-order li {
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: center;
        gap: 0 12px;
        padding: 10px 14px;
        text-align: left;
    }

    .how-to-order .step-icon {
        grid-row: span 2;
        font-size: 1.5rem;
    }

    .how-to-order li span:last-child {
        font-size: .82rem;
        line-height: 1.4;
    }
}

/* ---------- Catálogo ---------- */

.filters-submit {
    white-space: nowrap;
}

.filter-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid #e8cad9;
    border-radius: 10px;
    background: #fff;
    color: var(--ink, #493342);
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

/* .filters input pone width: 100% a todos los campos. */
.filters .filter-check input {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin: 0;
    padding: 0;
    accent-color: #d92e87;
}

#catalog-results {
    scroll-margin-top: 20px;
}

#catalog-results.is-loading {
    opacity: .55;
    pointer-events: none;
    transition: opacity .15s ease;
}

.results-count {
    margin: 0 0 14px;
    color: var(--muted, #896d7c);
    font-size: .9rem;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 32px 0 8px;
}

.pagination a,
.pagination span[aria-current] {
    display: inline-grid;
    place-items: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line, #f3dce7);
    border-radius: 999px;
    background: #fff;
    color: #c42679;
    font-weight: 700;
    text-decoration: none;
}

.pagination a:hover {
    background: #fff0f7;
}

.pagination span[aria-current] {
    border-color: #d92e87;
    background: #d92e87;
    color: #fff;
}

.pagination-gap {
    color: var(--muted, #896d7c);
}

/* ---------- Detalle de producto ---------- */

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 4px 0 22px;
    color: var(--muted, #896d7c);
    font-size: .88rem;
}

.breadcrumbs a {
    color: #c42679;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.product-detail {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: clamp(24px, 4vw, 48px);
    align-items: start;
}

.product-detail-image {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    overflow: hidden;
    border: 1px solid var(--line, #eee);
    border-radius: 22px;
    background: var(--surface, #fff);
}

.product-detail-image img {
    display: block;
    width: 100%;
    max-height: 620px;
    object-fit: contain;
}

.product-detail-placeholder {
    padding: 60px;
    font-size: 5rem;
}

.product-detail-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-detail-info > .pill {
    align-self: flex-start;
}

/* El nombre es lo más importante: misma fuente que los títulos del sitio. */
.product-title {
    margin: 0;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.45rem, 2.5vw, 2rem);
    line-height: 1.25;
    color: #61344d;
}

.product-description h2 {
    margin: 4px 0 8px;
    font-size: 1rem;
}

.product-description {
    padding-top: 14px;
    border-top: 1px solid var(--line, #f3dce7);
}

.product-description p {
    margin: 0;
    font-size: .9rem;
    white-space: pre-line;
}

.variant-fieldset {
    margin: 4px 0 0;
    padding: 0;
    border: 0;
}

.variant-fieldset legend {
    margin-bottom: 12px;
    font-weight: 700;
}

/* Galería: foto grande + miniaturas debajo. */
.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.gallery-thumb {
    display: block;
    width: 68px;
    height: 68px;
    overflow: hidden;
    border: 2px solid var(--line, #f3dce7);
    border-radius: 12px;
    background: #fff;
    transition: border-color .15s ease;
}

.gallery-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumb:hover {
    border-color: #f3a6cb;
}

.gallery-thumb.is-active {
    border-color: #d92e87;
}

/* Los dos botones uno al lado del otro, también en celular. */
.product-actions {
    display: flex;
    gap: 10px;
}

.product-actions > .button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    margin: 0; /* .button-whatsapp trae margin-top y lo dejaba más bajo y más chico. */
    padding: 10px 12px;
    line-height: 1.2;
    white-space: normal;
}

@media (max-width: 480px) {
    .product-actions > .button {
        font-size: .82rem;
        padding: 8px 10px;
    }

    .gallery-thumb {
        width: 58px;
        height: 58px;
    }
}

.girly-add-to-cart:disabled {
    background: #e9dbe2;
    color: #7a6672;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.product-note {
    margin: 0;
    font-size: .85rem;
    opacity: .8;
}

.related-heading {
    margin-top: 56px;
}

.empty-title {
    font-size: 1.4rem;
}

/* Muestras de color (antes en línea en producto.php). */
.variant-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 16px;
    align-items: flex-start;
    margin-top: 6px;
}

.variant-swatch {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 64px;
    cursor: pointer;
    text-align: center;
    font-size: .82rem;
}

.variant-swatch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.swatch-circle {
    display: block;
    width: 46px;
    height: 46px;
    border: 2px solid #fff;
    border-radius: 50%;
    outline: 1px solid #b9aab1;
    outline-offset: 2px;
    background: var(--swatch-color, #d9a0ad);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
    transition: outline .18s ease, transform .18s ease;
}

.variant-swatch:hover .swatch-circle {
    transform: scale(1.06);
}

.variant-swatch.is-selected .swatch-circle,
.variant-swatch input:checked + .swatch-circle,
.variant-swatch:focus-within .swatch-circle {
    outline: 3px solid #d63384;
    outline-offset: 3px;
}

.swatch-name {
    max-width: 90px;
    line-height: 1.25;
    overflow-wrap: anywhere;
    color: var(--ink, #382735);
}

.swatch-price {
    font-size: .75rem;
    color: var(--muted, #766775);
}

.swatch-stock {
    font-size: .7rem;
    color: #b4234d;
}

.variant-swatch.is-soldout {
    opacity: .48;
}

.variant-swatch.is-soldout .swatch-circle {
    position: relative;
}

.variant-swatch.is-soldout .swatch-circle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 1px;
    right: 1px;
    height: 2px;
    background: #8b263e;
    transform: rotate(-42deg);
}

@media (max-width: 480px) {
    .variant-swatches {
        gap: 16px 12px;
    }

    .variant-swatch {
        width: 60px;
    }

    .swatch-circle {
        width: 42px;
        height: 42px;
    }
}

/* ---------- Pie ---------- */

.footer a {
    color: #c42679;
    font-weight: 700;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.footer-small {
    font-size: .78rem;
    opacity: .75;
}
