@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

body {
    font-family: 'Poppins', sans-serif;
}

model-viewer { display: block; }

/* Cursor de huella solo donde existe mouse; no afecta pantallas táctiles. */

/* En móvil el encabezado fluye con la página y nunca cubre el producto. */
#shared-header { min-height: 0; }

/* En pantallas grandes queda siempre disponible, sin invadir el contenido. */
@media (min-width: 768px) {
    #shared-header { min-height: 5.25rem; }
    .site-header { position: fixed; top: 0; right: 0; left: 0; }
}

.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    animation: pulse 2s infinite;
}
.whatsapp-default-button {
    display: flex;
    width: 64px;
    height: 64px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #22c55e;
    color: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .2);
    font-size: 2rem;
    transition: background .2s ease, transform .2s ease;
}
.whatsapp-float:hover .whatsapp-default-button { background: #16a34a; transform: translateY(-2px); }

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.product-card {
    transition: all 0.3s ease;
}

.halloween-product-card {
    border: 2px solid #c8793f;
    background: linear-gradient(145deg, #fff 68%, #faf8f4 100%);
    box-shadow: 0 8px 20px rgba(53, 42, 31, .09), 0 0 0 2px rgba(200, 121, 63, .1);
}

.halloween-product-card:hover {
    border-color: #a85524;
    box-shadow: 0 13px 26px rgba(53, 42, 31, .13), 0 0 0 3px rgba(200, 121, 63, .15);
}

.halloween-product-badge,
.halloween-inline-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    border: 1px solid #e8d3b4;
    border-radius: 9px;
    background: #3c332b;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    line-height: 1.2;
    box-shadow: 0 2px 5px rgba(35, 28, 22, .16);
}

.halloween-product-badge { padding: .38rem .58rem; }
.halloween-inline-badge { padding: .28rem .5rem; white-space: nowrap; }
.halloween-product-badge::before, .halloween-inline-badge::before { width: .42rem; height: .42rem; flex: 0 0 auto; border-radius: 50%; background: #d99561; content: ''; }

.halloween-cart-item {
    border: 1px solid #e7c99e;
    border-radius: 12px;
    background: linear-gradient(110deg, #fff 62%, #fbf5ed 100%);
}

.cart-product-row { min-width: 0; }

@media (max-width: 767px) {
    .cart-product-row {
        align-items: stretch !important;
        gap: .75rem !important;
        padding: 1rem !important;
    }
    .cart-product-row > img {
        align-self: flex-start;
        width: 4.5rem;
        height: 4.5rem;
    }
    .cart-product-row > div:nth-child(2) { min-width: 0; }
    .cart-product-row > div:nth-child(3) { width: 100%; text-align: left !important; }
    .cart-product-row > div:nth-child(2) > div:last-child { flex-wrap: wrap; gap: .65rem; }
}

.halloween-admin-toggle {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1rem;
    border: 1px solid #fed7aa;
    border-radius: 14px;
    background: linear-gradient(110deg, #fff 45%, #fff7ed 100%);
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.halloween-admin-toggle:has(input:checked) {
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, .12);
}
.halloween-admin-toggle > input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}
.halloween-admin-toggle__icon {
    display: grid;
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
    background: #f3e8ff;
    font-size: 1.35rem;
}
.halloween-admin-toggle__copy { display: grid; flex: 1; gap: .2rem; }
.halloween-admin-toggle__copy strong { color: #31204d; font-size: .9rem; }
.halloween-admin-toggle__copy small { color: #6b7280; font-size: .75rem; line-height: 1.4; }
.halloween-admin-toggle__switch {
    position: relative;
    width: 2.6rem;
    height: 1.5rem;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #d1d5db;
    transition: background .2s ease;
}
.halloween-admin-toggle__switch::after {
    position: absolute;
    top: .2rem;
    left: .2rem;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: #fff;
    content: '';
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    transition: transform .2s ease;
}
.halloween-admin-toggle:has(input:checked) .halloween-admin-toggle__switch { background: #7c3aed; }
.halloween-admin-toggle:has(input:checked) .halloween-admin-toggle__switch::after { transform: translateX(1.1rem); }
.halloween-admin-toggle:focus-within { outline: 3px solid rgba(124, 58, 237, .3); outline-offset: 2px; }

.store-theme-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem 1.5rem;
    padding: 1.1rem 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(15, 23, 42, .06);
}
.store-theme-panel { scroll-margin-top: 7rem; border-color: #ddd6fe; box-shadow: 0 7px 20px rgba(76, 29, 149, .08); }
.store-theme-panel__intro { display: flex; align-items: center; gap: .8rem; }
.store-theme-panel__icon { display: grid; width: 2.65rem; height: 2.65rem; flex: 0 0 auto; place-items: center; border-radius: 12px; background: #f3f4f6; font-size: 1.25rem; }
.store-theme-panel__intro h2 { margin: 0; color: #1f2937; font-size: 1rem; font-weight: 700; }
.store-theme-panel__intro p { margin: .15rem 0 0; color: #6b7280; font-size: .8rem; }
.store-theme-options { display: flex; gap: .45rem; }
.store-theme-option { display: flex; align-items: center; gap: .45rem; padding: .55rem .75rem; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; color: #374151; font-size: .8rem; transition: .18s ease; }
.store-theme-option:hover { border-color: #9ca3af; background: #f9fafb; }
.store-theme-option.is-selected { border-color: #6d28d9; background: #f5f3ff; color: #4c1d95; box-shadow: 0 0 0 2px rgba(109, 40, 217, .1); }
.store-theme-option:disabled { cursor: wait; opacity: .65; }
.store-theme-option span { font-size: 1rem; }
.store-theme-status { grid-column: 1 / -1; min-height: 1rem; margin: -.45rem 0 0; color: #6b7280; font-size: .75rem; }

.store-season-banner { display: none !important; }
.site-theme-halloween { background-color: #faf8f5; background-image: radial-gradient(ellipse at 4% 8%, rgba(188, 130, 70, .1), transparent 28rem), radial-gradient(ellipse at 95% 82%, rgba(38, 31, 27, .035), transparent 30rem); }
.site-theme-christmas { background-color: #f7faf8; background-image: radial-gradient(ellipse at 95% 4%, rgba(38, 105, 76, .08), transparent 30rem); }
.site-theme-halloween .site-header { border-bottom: 2px solid #c28a52; box-shadow: 0 4px 15px rgba(48, 35, 25, .1); }
.site-theme-christmas .site-header { border-bottom: 2px solid #b9954e; }
.site-theme-halloween .product-card, .site-theme-halloween #cart-container > div, .site-theme-halloween #cart-summary > div { border-color: #e8d7c3; }
.site-theme-christmas .product-card, .site-theme-christmas #cart-container > div, .site-theme-christmas #cart-summary > div { border-color: #d3e3d9; }
.site-theme-halloween .product-card:hover { box-shadow: 0 12px 28px rgba(84, 55, 35, .14); }
.site-theme-christmas .product-card:hover { box-shadow: 0 12px 28px rgba(29, 76, 55, .13); }
.site-theme-halloween a:not(.halloween-inline-badge):hover { text-decoration-color: #a65e2e; }
.site-theme-christmas a:not(.halloween-inline-badge):hover { text-decoration-color: #28724f; }
.site-theme-halloween footer, .site-theme-halloween #shared-footer > * { border-top-color: #d9c5ac; }
.site-theme-christmas footer, .site-theme-christmas #shared-footer > * { border-top-color: #c7dbce; }
.site-theme-halloween h1, .site-theme-halloween h2, .site-theme-halloween h3 { text-decoration-color: #bd7138; text-underline-offset: .22em; }
.site-theme-halloween .halloween-product-card { border: 2px solid #c8793f; background: linear-gradient(145deg, #fff 68%, #faf8f4 100%); box-shadow: 0 8px 20px rgba(53, 42, 31, .09), 0 0 0 2px rgba(200, 121, 63, .1); }
.site-theme-halloween .halloween-product-badge, .site-theme-halloween .halloween-inline-badge { border-color: #b8a58e; background: #302a25; box-shadow: 0 2px 5px rgba(35, 28, 22, .12); }
.site-theme-halloween input:focus, .site-theme-halloween select:focus, .site-theme-halloween textarea:focus { border-color: #bd7138 !important; box-shadow: 0 0 0 3px rgba(189, 113, 56, .15); outline: none; }

.whatsapp-halloween-image { display: none; }
.season-cobweb-decoration { position: fixed; z-index: 0; left: -2px; bottom: -2px; width: clamp(150px, 22vw, 310px); height: auto; opacity: .62; pointer-events: none; user-select: none; }
.site-theme-halloween .whatsapp-float { right: 18px; bottom: 18px; width: 90px; height: 90px; animation: none; }
.site-theme-halloween .whatsapp-default-button { display: none !important; }
.site-theme-halloween .whatsapp-halloween-image { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 5px 9px rgba(40, 28, 19, .2)); transition: transform .2s ease; }
.site-theme-halloween .whatsapp-float:hover .whatsapp-halloween-image { transform: translateY(-3px) scale(1.04); }

@media (max-width: 767px) {
    .store-theme-panel { grid-template-columns: 1fr; gap: .85rem; padding: 1rem; }
    .store-theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .store-theme-option { justify-content: center; gap: .3rem; padding: .6rem .35rem; font-size: .72rem; }
    .store-theme-status { margin: -.35rem 0 0; }
    .site-theme-halloween .whatsapp-float { right: 8px; bottom: 10px; width: 76px; height: 76px; }
    .season-cobweb-decoration { width: clamp(135px, 38vw, 190px); opacity: .48; }
}
@media (prefers-reduced-motion: reduce) { .site-theme-halloween .whatsapp-halloween-image { transition: none; } }

.product-frame-enabled {
    position: relative;
    isolation: isolate;
    overflow: visible;
}

.product-frame-enabled::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    background-image: var(--product-frame-image);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

.product-frame-enabled .absolute {
    z-index: 20;
}

/* Las tarjetas entran suavemente al recorrer el catálogo. */
.product-card-reveal {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
    transition: opacity 0.22s ease var(--reveal-delay, 0ms), transform 0.28s cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay, 0ms), box-shadow 0.2s ease;
    will-change: opacity, transform;
}

.product-card-reveal.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.home-product-grid {
    min-height: 14rem;
}

.product-skeleton {
    overflow: hidden;
    border-radius: 0.5rem;
    background: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.07);
}

.product-skeleton-image,
.product-skeleton-content span {
    background: linear-gradient(100deg, #f1f1f1 25%, #fafafa 45%, #f1f1f1 65%);
    background-size: 200% 100%;
    animation: catalog-shimmer 1.35s ease-in-out infinite;
}

.product-skeleton-image { height: 16rem; }
.product-skeleton-content { padding: 1rem; display: grid; gap: 0.75rem; }
.product-skeleton-content span { height: 0.85rem; border-radius: 999px; }
.product-skeleton-content span:nth-child(2) { width: 62%; }
.product-skeleton-content span:nth-child(3) { width: 38%; height: 1.35rem; }

@keyframes catalog-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .product-card-reveal { opacity: 1; transform: none; transition: none; }
    .product-skeleton-image,
    .product-skeleton-content span { animation: none; }
}

.original-price {
    text-decoration: line-through;
    color: #9ca3af;
    font-size: 1rem;
}

.discount-price {
    color: #dc2626;
    font-weight: bold;
}

.header-actions a,
.header-actions button {
    min-width: 42px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.header-actions #order-tracking-trigger {
    position: relative;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #374151;
}

.header-actions #order-tracking-trigger:hover {
    background: #fff1f5;
    color: #db2777;
}

.header-actions #order-tracking-trigger > i {
    font-size: 1.45rem;
    line-height: 1;
}

.header-actions #order-tracking-trigger .order-tracking-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #db2777;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
}

.header-actions #order-tracking-trigger .order-tracking-badge.hidden {
    display: none;
}

#order-tracking-modal .tracking-close {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #fff;
    line-height: 1;
    transition: color .15s ease, transform .15s ease;
}

#order-tracking-modal .tracking-close:hover {
    background: transparent;
    color: #ddd6fe;
    transform: rotate(90deg);
}

#order-tracking-modal .tracking-close:focus-visible {
    outline: 2px solid #ddd6fe;
    outline-offset: 2px;
}

.auth-dialog {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.admin-color-swatch {
    width: 2rem;
    height: 2rem;
    display: inline-block;
    border: 2px solid #d1d5db;
    border-radius: 9999px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .65), 0 1px 3px rgba(0, 0, 0, .12);
}
/* Las fotos de producto siempre se muestran completas; el fondo llena el espacio sobrante. */
.product-card .relative > img,
.product-image-frame > img {
    object-fit: contain;
    background: #fff;
}

.product-image-thumbnails {
    display: flex;
    gap: .75rem;
    overflow-x: auto;
    padding: .125rem;
    scrollbar-width: thin;
}

.product-image-thumbnail {
    flex: 0 0 6.5rem;
    height: 6.5rem;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: .5rem;
    background: #fff;
    cursor: pointer;
}

.product-image-thumbnail.is-active {
    border-color: #ec4899;
}

.product-image-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-gallery-arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, .94);
    color: #1f2937;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .14);
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity .2s ease, background .2s ease;
}

.product-image-frame:hover .product-gallery-arrow,
.product-gallery-arrow:focus-visible {
    opacity: 1;
}

.product-gallery-arrow:hover { background: #fff; }
.product-gallery-prev { left: .75rem; }
.product-gallery-next { right: .75rem; }

@media (max-width: 767px) {
    .home-page .site-header {
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        z-index: 50;
        transform: translateY(0);
        transition: transform .42s cubic-bezier(.22, 1, .36, 1), box-shadow .25s ease;
        will-change: transform;
    }

    .home-page .site-header.mobile-header-hidden {
        transform: translateY(-110%);
        box-shadow: none;
    }

    .home-product-grid .product-card .relative {
        height: 10.5rem;
    }

    .home-product-grid .product-card .relative > img {
        padding: .35rem;
    }

    .home-product-grid .product-card > .p-4 {
        padding: .75rem;
    }

    .home-product-grid .product-card h3 {
        margin-bottom: .4rem;
        font-size: .95rem;
        line-height: 1.3;
    }

    .home-product-grid .product-card .text-2xl {
        font-size: 1.15rem;
        line-height: 1.45;
    }

    .home-product-grid .product-card .original-price {
        font-size: .72rem;
    }

    .home-product-grid .product-card .mt-2 {
        margin-top: .45rem;
    }

    .header-main-row {
        flex-wrap: wrap;
        gap: 8px 14px;
    }

    .header-logo-link img {
        height: 3.25rem;
    }

    .header-actions {
        gap: 8px;
        margin-left: auto;
    }

    .header-search {
        order: 3;
        flex-basis: 100%;
        max-width: none;
        padding-bottom: 4px;
    }

    .header-actions a,
    .header-actions button {
        min-width: 46px;
        min-height: 46px;
    }

    .header-actions #order-tracking-trigger {
        flex-basis: 40px;
        width: 40px;
        min-width: 40px;
        height: 46px;
        min-height: 46px;
    }

    .auth-dialog {
        max-height: 94vh;
    }

    .auth-dialog > div {
        min-height: auto;
    }

    .auth-dialog .p-8 {
        padding: 1.25rem;
    }

    .product-image-frame {
        height: min(72vw, 24rem);
    }

    /* El gesto táctil no activa el zoom ni recorta accidentalmente la foto. */
    .product-image-frame #product-main-image {
        transform: none !important;
    }

    .product-gallery-arrow {
        opacity: 1;
        width: 2.5rem;
        height: 2.5rem;
    }

    .product-image-thumbnail {
        flex-basis: 5rem;
        height: 5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-page .site-header { transition: none; }
}
