/* =========================================================================
   Catálogo público (usa los tokens de app.css)
   ========================================================================= */
.store { display: flex; flex-direction: column; min-height: 100vh; }
.store-container { width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 768px) { .store-container { padding: 0 1.5rem; } }

.store-header {
    position: sticky; top: 0; z-index: 1020;
    background: color-mix(in srgb, var(--app-surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--app-border);
}
.store-header-inner { display: flex; align-items: center; gap: 1rem; height: 64px; }
.store-header-search { flex: 1; max-width: 520px; margin: 0 auto; }
.store-main { flex: 1; padding-top: 1.25rem; padding-bottom: 3rem; }
.store-footer { border-top: 1px solid var(--app-border); background: var(--app-surface); padding: 1.5rem 0 calc(1.5rem + env(safe-area-inset-bottom)); }

.store-hero { margin-bottom: 1.25rem; }
.store-hero h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
@media (min-width: 768px) { .store-hero h1 { font-size: 2rem; } }

.store-filters { position: sticky; top: 64px; z-index: 10; background: var(--app-bg); padding: .75rem 0; margin-bottom: .5rem; }
.store-filters .search-input .form-control { min-height: 44px; border-radius: 999px; }
.store-sort { min-height: 44px; border-radius: 999px; flex: 1; }
@media (min-width: 768px) { .store-sort { width: 220px; flex: 0 0 auto; } }
.store-select-toggle { min-height: 44px; border-radius: 999px; white-space: nowrap; }
.store-select-toggle[aria-pressed="true"] { background: var(--app-primary-soft); color: var(--app-primary); border-color: transparent; }

/* Grilla de productos */
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 576px) { .product-grid { gap: 1rem; } }
@media (min-width: 768px) { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; } }
@media (min-width: 1400px) { .product-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.product-card {
    position: relative; display: flex; flex-direction: column;
    background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius-lg);
    overflow: hidden; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--app-shadow-lg); border-color: var(--app-border-strong); }
.product-media { position: relative; aspect-ratio: 1 / 1; background: var(--app-surface-hover); overflow: hidden; }
.product-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.product-card:hover .product-media img { transform: scale(1.04); }
.product-badge {
    position: absolute; top: .5rem; left: .5rem;
    background: rgba(17, 24, 39, .72); color: #fff; font-size: .7rem; font-weight: 600;
    padding: .2rem .55rem; border-radius: 999px; backdrop-filter: blur(4px);
}
.product-body { display: flex; flex-direction: column; gap: .25rem; padding: .75rem .875rem .875rem; flex: 1; }
.product-cat { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--app-muted); }
.product-name { font-size: .9rem; font-weight: 600; line-height: 1.3; color: var(--app-text); margin: 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.product-name a { color: inherit; }
.product-name a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.product-price { font-size: 1.125rem; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin-top: auto; padding-top: .25rem; }
.product-actions { position: relative; z-index: 2; display: flex; gap: .375rem; margin-top: .5rem; }
.product-actions .btn { flex: 1; }
.product-actions .btn-icon { flex: 0 0 auto; --size: 38px; border: 1px solid var(--app-border-strong); }
/* Etiqueta de precio sobre la foto (no forma parte de la imagen; al compartir se elige si se dibuja) */
.price-tag {
    position: absolute; right: .5rem; bottom: .5rem; pointer-events: none;
    background: rgba(251, 247, 242, .95); color: #3B2F2A; border: 1.5px solid #C9A86A;
    font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
    padding: .35rem .65rem; border-radius: 999px; box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.price-tag.lg { right: 1rem; bottom: 1rem; font-size: 1.25rem; padding: .5rem 1rem; border-width: 2px; }

/* Modo selección (compartir varios) */
.product-check {
    position: absolute; top: .5rem; right: .5rem; z-index: 3; display: none;
    width: 28px; height: 28px; border-radius: 50%; align-items: center; justify-content: center;
    border: 2px solid #fff; background: rgba(17, 24, 39, .35); color: #fff; font-size: .8rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.product-check i { opacity: 0; }
.is-selecting .product-check { display: flex; }
.is-selecting .product-card { cursor: pointer; -webkit-user-select: none; user-select: none; }
.is-selecting .product-card:hover { transform: none; }
.is-selecting .product-card:hover .product-media img { transform: none; }
.is-selecting .product-actions { opacity: .35; pointer-events: none; }
.product-card.is-selected { border-color: var(--app-primary); box-shadow: 0 0 0 2px var(--app-primary); }
.product-card.is-selected .product-check { background: var(--app-primary); border-color: var(--app-primary); }
.product-card.is-selected .product-check i { opacity: 1; }
.is-selecting .product-grid { padding-bottom: 5rem; }

.select-bar {
    position: fixed; z-index: 1030; left: 50%; transform: translateX(-50%);
    bottom: calc(1rem + env(safe-area-inset-bottom)); width: calc(100% - 2rem); max-width: 480px;
    display: flex; align-items: center; gap: .5rem; padding: .5rem .5rem .5rem 1rem;
    background: var(--app-surface); border: 1px solid var(--app-border-strong); border-radius: 999px;
    box-shadow: var(--app-shadow-lg);
}
.select-bar[hidden] { display: none; }
.select-bar-count { flex: 1; font-weight: 600; font-size: .875rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.select-bar .btn { border-radius: 999px; }

/* Ventana de compartir */
.share-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.share-single .share-items { grid-template-columns: minmax(0, 300px); justify-content: center; }
.share-thumb { position: relative; aspect-ratio: 1 / 1; border-radius: var(--app-radius); overflow: hidden; background: var(--app-surface-hover); border: 1px solid var(--app-border); }
.share-thumb img { width: 100%; height: 100%; object-fit: contain; transition: opacity .2s ease; }
.share-thumb .spinner-border { position: absolute; inset: 0; margin: auto; display: none; color: var(--app-muted); }
.share-thumb.is-loading img { opacity: .45; }
.share-thumb.is-loading .spinner-border { display: block; }
.share-thumb.is-error { border-color: var(--app-danger); }
.share-num, .share-sent {
    position: absolute; top: .3rem; width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700;
}
.share-num { left: .3rem; background: rgba(17, 24, 39, .7); color: #fff; }
.share-sent { right: .3rem; background: var(--app-success); color: #fff; display: none; }
.share-item.is-sent .share-sent { display: flex; }
.share-item.is-sent .share-thumb img { opacity: .55; }
.share-mode { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: 1rem; }
.share-mode[hidden], .share-message[hidden] { display: none; }
.share-mode-opt {
    display: flex; flex-direction: column; gap: .15rem; padding: .6rem .75rem; cursor: pointer;
    border: 1px solid var(--app-border-strong); border-radius: var(--app-radius); font-size: .875rem;
}
.share-mode-opt span { font-size: .75rem; color: var(--app-muted); }
.btn-check:checked + .share-mode-opt { border-color: var(--app-primary); background: var(--app-primary-soft); box-shadow: 0 0 0 1px var(--app-primary); }
.btn-check:focus-visible + .share-mode-opt { outline: 2px solid var(--app-primary); outline-offset: 2px; }
.share-switches { display: grid; gap: .25rem; margin-bottom: .75rem; }
.share-switches[hidden] { display: none; }
.share-switches .form-check-label { margin-left: .5rem; }
.share-item-name { font-size: .75rem; font-weight: 600; margin-top: .35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-item-actions { display: flex; gap: .25rem; margin-top: .25rem; }
.share-item-actions .btn-icon { --size: 32px; border: 1px solid var(--app-border); font-size: .8rem; }
.share-text { font-size: .875rem; }
.share-hint { font-size: .75rem; color: var(--app-muted); margin: .5rem 0 0; }
.share-modal .modal-footer { gap: .5rem; flex-wrap: wrap; }
.share-modal .modal-footer > * { margin: 0; }
@media (max-width: 575.98px) {
    .share-modal .modal-footer .btn { flex: 1 1 auto; }
}

@media (max-width: 575.98px) {
    .product-body { padding: .625rem .625rem .75rem; }
    .price-tag { right: .375rem; bottom: .375rem; font-size: .7rem; padding: .3rem .5rem; }
    .product-check { top: .375rem; right: .375rem; }
    .product-name { font-size: .8125rem; }
    .product-price { font-size: 1rem; }
    .product-actions .btn { font-size: .75rem; --bs-btn-padding-x: .5rem; }
}

/* Página de producto */
.pdp { display: grid; gap: 1.5rem; }
@media (min-width: 992px) { .pdp { grid-template-columns: 1.1fr 1fr; gap: 3rem; align-items: start; } }
.pdp-media { border-radius: var(--app-radius-lg); overflow: hidden; background: var(--app-surface-hover); border: 1px solid var(--app-border); aspect-ratio: 1 / 1; }
.pdp-media img { width: 100%; height: 100%; object-fit: cover; }
.pdp-info h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
@media (min-width: 768px) { .pdp-info h1 { font-size: 2rem; } }
.pdp-price { font-size: 2rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pdp-cta { display: grid; gap: .5rem; }
@media (max-width: 991.98px) {
    .pdp-cta {
        position: sticky; bottom: 0; z-index: 5; margin: 0 -1rem; padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
        background: color-mix(in srgb, var(--app-surface) 94%, transparent); border-top: 1px solid var(--app-border);
        -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
        grid-template-columns: 1fr auto;
    }
}
