﻿*,
*::before,
*::after {
    box-sizing: border-box;
}
:root {
    --accent: linear-gradient(135deg,#0ea5e9,#2563eb);
    --accent-solid: #2563eb;
    --bg: #eef2f7;
    --surface: #ffffff;
    --border: rgba(15,23,42,0.08);
    --radius: 18px;
    --shadow: 0 10px 30px rgba(2,132,199,0.08), 0 4px 12px rgba(0,0,0,0.05);
}

/* BASE */

body {
    font-family: Segoe UI, Roboto, Arial, sans-serif;
    margin: 0;
    padding: 1rem;
    min-height: 100vh;
    background: linear-gradient(180deg,#f8fafc 0%,#e2e8f0 100%);
    color: #0f172a;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* TITULO */

.titulo {
    font-weight: 600;
    letter-spacing: -0.03em;
}

/* HEADER */

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

    .header-bar .titulo {
        margin: 0;
    }

/* SEARCH */

.search-box {
    position: relative;
    width: 100%;
    max-width: 420px;
}

.search {
    padding: .85rem 1.1rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    width: 100%;
    font-size: .95rem;
    padding-right: 36px;
}

    .search:focus {
        outline: none;
        border-color: #0ea5a4;
        box-shadow: 0 0 0 4px rgba(14,165,164,.15);
    }

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    color: #64748b;
}

    .search-clear:hover {
        color: #ef4444;
    }

/* TOOLBAR */

.toolbar {
    display: flex;
    flex-direction: column;
    gap: .7rem;
}

/* MENU PRINCIPAL */

.menu {
    display: flex;
    gap: .6rem;
    overflow-x: auto;
    padding: .5rem;
    background: linear-gradient(180deg,#ffffff 0%,#f1f5f9 100%);
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.06);
}

.menu-item {
    flex: 0 0 auto;
    padding: .6rem 1.2rem;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.08);
    background: white;
    font-size: .9rem;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    transition: all .25s ease;
}

    .menu-item:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 24px rgba(0,0,0,0.08);
    }

    .menu-item.active {
        background: var(--accent);
        color: white;
        border: none;
    }

/* SUBMENU */

.submenu {
    overflow-x: auto;
    overflow-y: hidden;
    max-height: 0;
    transform: translateX(-12px);
    opacity: 0;
    transition: all .25s ease;
    pointer-events: none;
    /* mantener el contenedor con borde redondeado para cuando se abra */
    border-radius: 12px;
}

/* Submenu abierto: fondo más oscuro, borde y sombra */
    .submenu.open {
        max-height: 220px;
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
        background: linear-gradient(180deg, #e9f7f8 0%, #d1eef0 60%, #b8e4e6 100%); /* petrol suave */
        border: 1px solid rgba(2, 40, 44, 0.06);
        box-shadow: 0 6px 18px rgba(2, 40, 44, 0.08);
        padding: .35rem;
    }

.submenu-inner {
    display: flex;
    gap: .6rem;
    padding: .4rem;
}

/* TARJETAS SUBMENU */

.submenu-card {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 90px;
    padding: 8px 10px;
    border: none;
    border-radius: 12px;
    background: #ffffff; /* sin transparencia */
    cursor: pointer;
    transition: all .2s ease;
}

    .submenu-card:hover {
        background: #f3f4f6;
        transform: translateY(-2px);
    }

    .submenu-card.active {
        background: #e8f2ff;
        box-shadow: 0 2px 6px rgba(0,0,0,.08);
    }

.submenu-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.submenu-text {
    font-size: 13px;
    text-align: center;
    line-height: 1.1;
    word-break: break-word;
    color: #0f172a;
}

/* GRID PRODUCTOS */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.4rem;
    padding-bottom: 110px;
}
@keyframes floatPulse {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }

    100% {
        transform: translateY(0);
    }
}

/* CARD */

.card {
    background: white;
    border-radius: 22px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    transition: transform .3s ease, box-shadow .3s ease;
}

    .card:hover {
        transform: translateY(-6px);
        box-shadow: 0 18px 36px rgba(0,0,0,.08);
    }

/* MEDIA */

.card-media {
    aspect-ratio: 1/1;
    overflow: hidden;
    background: #f1f5f9;
    position: relative;
}

    .card-media img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

/* BADGE */

.badge-oferta {
    position: absolute;
    top: 14px;
    left: 14px;
    background: linear-gradient(135deg,#ef4444,#dc2626);
    color: white;
    padding: .35rem .85rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
}

/* CARD BODY */

.card-body {
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.descripcion {
    font-size: .9rem;
    color: #64748b;
}

.precio {
    font-weight: 700;
    font-size: 1.2rem;
    background: var(--accent);
    -webkit-text-fill-color: transparent;
}

/* MODAL */

.product-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    z-index: 9999;
}

.product-modal {
    background: white;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: 22px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

    .product-modal .media {
        height: 250px;
        background: #f1f5f9;
        display: flex;
        justify-content: center;
        align-items: center;
    }

        .product-modal .media img {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
        }

    .product-modal .body {
        padding: 1.5rem;
        overflow-y: auto;
    }

/* MOBILE */

@media (max-width: 640px) {

    body {
        padding: .7rem;
    }

    .header-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-grid {
        grid-template-columns: repeat(2,1fr);
        gap: .8rem;
    }
}

/* Botones flotantes: diseño común más elegante */
.floating-btn {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    color: #ffffff;
    cursor: pointer;
    z-index: 10000;
    transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
    box-shadow: 0 8px 22px rgba(2,6,23,0.12);
    border: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    outline: none;
}

    /* Tooltip (usa attribute data-tooltip) */
    .floating-btn::after {
        content: attr(data-tooltip);
        position: absolute;
        left: 50%;
        transform: translateX(-50%) translateY(8px);
        bottom: calc(100% + 10px);
        background: rgba(15,23,42,0.9);
        color: #fff;
        padding: 6px 9px;
        border-radius: 6px;
        font-size: 12px;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity .12s ease, transform .12s ease;
        box-shadow: 0 6px 18px rgba(2,6,23,0.18);
    }

    /* Mostrar tooltip en hover/focus */
    .floating-btn:hover::after,
    .floating-btn:focus::after {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    /* Scroll top specific */
    .floating-btn.scroll-top {
        right: 18px;
        bottom: 18px;
        background: var(--accent);
        background-color: var(--accent-solid);
        display: inline-flex;
    }

        .floating-btn.scroll-top svg {
            color: #fff;
        }
.floating-card {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    border-radius: 16px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 30px rgba(0,0,0,.12);
    border: 1px solid rgba(0,0,0,.06);
    z-index: 10000;
}

    /* WhatsApp specific */
    .floating-btn.whatsapp {
        animation: floatPulse 2.5s infinite ease-in-out;    
        right: 18px;
        bottom: 18px;
        background: linear-gradient(135deg,#25D366,#128C7E);
        box-shadow: 0 10px 30px rgba(18,140,126,0.18);
        text-decoration: none;
        transition: bottom .25s ease, transform .16s ease, box-shadow .16s ease;
    }
        .floating-btn.whatsapp::before {
            content: "";
            position: absolute;
            inset: -6px;
            border-radius: 999px;
            background: rgba(37,211,102,0.35);
            filter: blur(10px);
            z-index: -1;
        }
        .floating-btn.whatsapp svg {
            color: #fff;
        }


/* Ajustes para pantallas pequeñas */
@media (max-width:640px) {

    .floating-btn {
        width: 48px;
        height: 48px;
        right: 12px;
    }

        /* botón subir */
        .floating-btn.scroll-top {
            bottom: 14px;
        }

        /* WhatsApp siempre arriba */
        .floating-btn.whatsapp {
            bottom: 74px;
        }
}
/* Estado inicial oculto */
.floating-btn.scroll-top {
    right: 18px;
    bottom: 18px;
    background: var(--accent);
    background-color: var(--accent-solid);
    display: inline-flex;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

    /* Cuando hay scroll */
    .floating-btn.scroll-top.visible {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }
        /* Cuando aparece el botón subir, mover WhatsApp hacia arriba */
        .floating-btn.scroll-top.visible + .floating-btn.whatsapp {
            bottom: 96px;
        }
/* SUB CARD PRECIO */

.price-box{
    display:flex;
    flex-direction:column;
    gap:6px;
    margin-top:auto;
}


/* precio normal */

.price-main {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: .3px;
}

/* oferta */

.price-offer {
    font-size: 1.35rem;
    font-weight: 800;
    color: #16a34a;
}

/* precio anterior */

.price-old {
    font-size: .85rem;
    text-decoration: line-through;
    color: #64748b;
}

/* etiqueta oferta */

.price-label {
    font-size: .65rem;
    font-weight: 600;
    letter-spacing: .6px;
    color: #fff;
    background: linear-gradient(135deg,#ef4444,#dc2626);
    padding: 2px 6px;
    border-radius: 6px;
}
.price-type {
    font-size: .70rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.price-box {
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
    background: linear-gradient(135deg,#f8fafc,#eef2f7);
    border: 1px solid rgba(15,23,42,0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* CONTENEDOR GENERAL */

.price-box {
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
    background: linear-gradient(135deg,#f8fafc,#eef2f7);
    border: 1px solid rgba(15,23,42,0.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
}


/* =========================
   PRECIO PROMO
   ========================= */
.price-promo {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px 12px;
    border-radius: 12px;
    /* verde metálico */
    background: linear-gradient( 145deg, #34d399 0%, #22c55e 40%, #16a34a 50%, #22c55e 65%, #4ade80 100% );
    color: #ffffff;
    border: 1px solid rgba(255,255,255,.35);
    box-shadow: inset 0 2px 4px rgba(255,255,255,.35), inset 0 -2px 6px rgba(0,0,0,.15), 0 4px 12px rgba(22,163,74,0.35);
    overflow: hidden;
}

.card:hover .price-promo::after {
    animation: promoShine 1.2s ease;
}

@keyframes promoShine {
    from {
        left: -60%;
    }

    to {
        left: 120%;
    }
}
/* texto superior */

.promo-label {
    font-size: .75rem;
    font-weight: 600;
    opacity: .9;
}

/* precio grande */

.promo-value {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.1;
}
/* etiqueta ahorro */

.promo-discount {
    font-size: .70rem;
    font-weight: 600;
    color: #065f46;
    background: linear-gradient(180deg,#ecfdf5,#d1fae5);
    border: 1px solid rgba(16,185,129,.25);
    padding: 3px 8px;
    border-radius: 999px;
    display: inline-block;
}


/* =========================
   PRECIO POR UNIDAD
   ========================= */

.price-unit-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: linear-gradient(180deg,#ffffff,#f8fafc);
    border: 1px solid rgba(15,23,42,0.06);
    white-space: nowrap;
}

/* texto izquierda */

.unit-label {
    font-size: .72rem;
    color: #64748b;
}

/* precio normal */

.unit-price {
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
}

/* precio anterior */

.unit-old {
    font-size: .8rem;
    text-decoration: line-through;
    color: #94a3b8;
    margin-right: 6px;
}
.product-title {
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.25;
    color: #0f172a;
    margin: 2px 0 6px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* máximo 2 líneas */
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: .01em; /* mejora lectura */
}
.submenu.open {
    margin-bottom: 16px;
}
@media (max-width: 640px) {

    .price-unit-card {
        flex-wrap: wrap;
        gap: 4px;
    }

    .unit-label {
        width: 100%;
    }
}
@media (max-width:640px) {

    .promo-discount {
        display: block;
        width: 100%;
        text-align: center;
        padding: 6px 8px;
        font-size: .72rem;
    }
}
@media (max-width:640px) {

    .promo-discount {
        display: block;
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        white-space: normal;
        word-break: break-word;
        line-height: 1.2;
        padding: 5px 8px;
        font-size: .68rem;
    }
}
/* SKELETON LOADING */

.skeleton {
    background: linear-gradient( 90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75% );
    background-size: 200% 100%;
    animation: skeleton-loading 1.2s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    border-radius: 22px;
    border: 1px solid var(--border);
    overflow: hidden;
    background: white;
}

.skeleton-media {
    aspect-ratio: 1/1;
}

.skeleton-body {
    padding: 1rem;
}

.skeleton-line {
    height: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
}

    .skeleton-line.short {
        width: 60%;
    }

.skeleton-price {
    height: 18px;
    width: 40%;
    border-radius: 6px;
}
.floating-btn.scroll-top::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 999px;
    background: rgba(37,99,235,0.35); /* azul acorde al botón */
    filter: blur(10px);
    z-index: -1;
    animation: scrollGlow 2.5s infinite ease-in-out;
}
@keyframes scrollGlow {
    0% {
        transform: scale(1);
        opacity: .7;
    }

    50% {
        transform: scale(1.15);
        opacity: .4;
    }

    100% {
        transform: scale(1);
        opacity: .7;
    }
}

