/* ============================================================
   instagram-grid.css  — Estilo Instagram para ofertas y productos
   ============================================================ */

/* ── SECCIÓN OFERTAS ─────────────────────────────────────────── */
.offers-section {
    padding: 40px 0 20px;
    background: transparent;
}

/* EXACTAMENTE igual al grid de productos */
.offers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 12px;
}

@media (min-width: 600px) {
    .offers-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
        padding: 0 16px;
    }
}

@media (min-width: 900px) {
    .offers-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
        padding: 0 20px;
    }
}

@media (min-width: 1200px) {
    .offers-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 18px;
        padding: 0 20px;
    }
}

/* Tarjeta de oferta — idéntica a .product-card-ig */
.offer-card-ig {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #111;
    border: 1px solid rgba(255,255,255,0.07);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.offer-card-ig:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.5);
    border-color: rgba(255,204,0,0.4);
}

/* Área de imagen — cuadrada, igual que .media-area en productos */
.offer-card-ig .media-area {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #1a1a1a;
}

/* El carrusel dentro de la oferta ocupa todo el área */
.offer-card-ig .media-area .media-carousel {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.offer-card-ig .media-area .media-slide {
    min-width: 100%;
    height: 100%;
    flex-shrink: 0;
}

/* Compatibilidad con .media-wrapper viejo */
.offer-card-ig .media-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #1a1a1a;
}

/* Imágenes dentro del carrusel de ofertas */
.offer-card-ig .media-wrapper img,
.offer-card-ig .media-area img,
.offer-card-ig .media-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    display: block;
}

.offer-card-ig:hover .media-slide img,
.offer-card-ig:hover .media-wrapper img {
    transform: scale(1.04);
}

/* Badge de descuento — esquina superior izquierda, siempre visible */
.offer-discount-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #e74c3c;
    color: #fff;
    font-weight: 900;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    z-index: 4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    white-space: nowrap;
}

/* Badge OFERTA — forma starburst, esquina superior derecha */
.offer-label-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 4;

    /* Starburst más grande */
    width: 82px;
    height: 82px;
    background: #ffcc00;
    clip-path: polygon(
        50% 0%,   61% 20%,  85% 10%,  75% 32%,
        100% 35%, 82% 52%,  95% 72%,  72% 68%,
        65% 95%,  50% 78%,  35% 95%,  28% 68%,
        5%  72%,  18% 52%,  0%  35%,  25% 32%,
        15% 10%,  39% 20%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.6));
    gap: 1px;
}

.offer-label-badge .badge-word {
    font-size: 0.58rem;
    font-weight: 900;
    color: #c00;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

.offer-label-badge .badge-price {
    font-size: 0.72rem;
    font-weight: 900;
    color: #c00;
    line-height: 1;
}

/* Info de la oferta — igual que .product-info-ig */
.offer-card-ig .offer-info {
    padding: 10px 10px 4px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.offer-card-ig .offer-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.offer-card-ig .offer-prices {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.offer-card-ig .offer-price-original {
    text-decoration: line-through;
    color: #666;
    font-size: 0.72rem;
}

.offer-card-ig .offer-price-final {
    color: var(--primary-color);
    font-weight: 800;
    font-size: 0.95rem;
}

.offer-card-ig .offer-expires {
    font-size: 0.68rem;
    color: #22c55e;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

/* Botón comprar en oferta — igual que .add-to-cart-ig */
.offer-card-ig .offer-add-btn {
    margin: 0 10px 10px;
    padding: 9px 10px;
    background: var(--primary-color);
    color: #000;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-decoration: none;
    white-space: nowrap;
}

.offer-card-ig .offer-add-btn:hover {
    background: #e6b800;
    transform: scale(1.02);
}

.offer-card-ig .offer-add-btn:disabled {
    background: #2a2a2a;
    color: #555;
    cursor: not-allowed;
    transform: none;
}

.offer-card-ig .offer-login-btn {
    background: rgba(255,204,0,0.12);
    color: var(--primary-color);
    border: 1px solid rgba(255,204,0,0.35);
}

.offer-card-ig .offer-login-btn:hover {
    background: rgba(255,204,0,0.22);
}


/* ── SECCIÓN PRODUCTOS ───────────────────────────────────────── */
.menu-section {
    padding: 60px 20px 80px;
    max-width: 1400px;
    margin: 0 auto;
    background: transparent;
}

/* Grid Instagram: 2 col móvil, 3 tablet, 4 desktop */
.products-grid-ig {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 12px;
}

@media (min-width: 600px) {
    .products-grid-ig { grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 0 16px; }
}

@media (min-width: 900px) {
    .products-grid-ig { grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 0 20px; }
}

@media (min-width: 1200px) {
    .products-grid-ig { grid-template-columns: repeat(5, 1fr); gap: 18px; padding: 0 20px; }
}

/* Tarjeta de producto */
.product-card-ig {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #111;
    border: 1px solid rgba(255,255,255,0.07);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.product-card-ig:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.5);
    border-color: rgba(255,204,0,0.4);
}

/* Área de media — cuadrada con carrusel */
.product-card-ig .media-area {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #1a1a1a;
}

/* Carrusel de imágenes/videos */
.media-carousel {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.media-slide {
    min-width: 100%;
    height: 100%;
    flex-shrink: 0;
    position: relative;
}

.media-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.product-card-ig:hover .media-slide:first-child img {
    transform: scale(1.04);
}

/* Video embed dentro del carrusel */
.media-slide .video-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
}

.media-slide .video-wrapper iframe,
.media-slide .video-wrapper video {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Indicadores de slides (puntitos) */
.carousel-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 3;
}

.carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    transition: background 0.2s, transform 0.2s;
    cursor: pointer;
}

.carousel-dot.active {
    background: #fff;
    transform: scale(1.3);
}

/* Flechas de navegación del carrusel */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.75rem;
    cursor: pointer;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    backdrop-filter: blur(4px);
}

.product-card-ig:hover .carousel-arrow,
.offer-card-ig:hover .carousel-arrow {
    opacity: 1;
}

.carousel-arrow.prev { left: 6px; }
.carousel-arrow.next { right: 6px; }

/* Siempre visible en móvil */
@media (max-width: 768px) {
    .carousel-arrow { opacity: 0.7; width: 24px; height: 24px; font-size: 0.65rem; }
}

/* Contador de media (ej: 1/3) */
.media-counter {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    z-index: 3;
    backdrop-filter: blur(4px);
    display: none; /* solo visible si hay más de 1 */
}

.media-counter.visible { display: block; }

/* Ícono de video sobre el thumbnail */
.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    pointer-events: none;
    z-index: 2;
    backdrop-filter: blur(4px);
}

/* Badge de precio sobre la imagen */
.product-price-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.85);
    color: var(--primary-color);
    font-weight: 800;
    font-size: 0.9rem;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1.5px solid var(--primary-color);
    z-index: 3;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* Badge sin stock */
.out-of-stock-badge {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    border-radius: 14px 14px 0 0;
}

.out-of-stock-badge span {
    background: #e74c3c;
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 6px 14px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Info del producto */
.product-card-ig .product-info-ig {
    padding: 10px 10px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-card-ig .product-name-ig {
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    margin: 0;
    /* Limitar a 2 líneas */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-ig .product-desc-ig {
    font-size: 0.72rem;
    color: #888;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Botón agregar al carrito — siempre visible */
.product-card-ig .add-to-cart-ig {
    margin: 0 10px 10px;
    padding: 9px 10px;
    background: var(--primary-color);
    color: #000;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
}

/* En móvil (2 col): solo ícono para que no se corte */
@media (max-width: 599px) {
    .product-card-ig .add-to-cart-ig .btn-text,
    .offer-card-ig .offer-add-btn .btn-text {
        display: none;
    }
    .product-card-ig .add-to-cart-ig,
    .offer-card-ig .offer-add-btn {
        font-size: 1rem;
        padding: 10px;
    }
}

/* En tablet y desktop: mostrar texto completo */
@media (min-width: 600px) {
    .product-card-ig .add-to-cart-ig .btn-text,
    .offer-card-ig .offer-add-btn .btn-text {
        display: inline;
    }
}

.product-card-ig .add-to-cart-ig:hover {
    background: #e6b800;
    transform: scale(1.02);
}

.product-card-ig .add-to-cart-ig:disabled {
    background: #2a2a2a;
    color: #555;
    cursor: not-allowed;
    transform: none;
    border: 1px solid #333;
}

.product-card-ig .add-to-cart-ig.login-btn {
    background: rgba(255,204,0,0.12);
    color: var(--primary-color);
    border: 1px solid rgba(255,204,0,0.35);
}

.product-card-ig .add-to-cart-ig.login-btn:hover {
    background: rgba(255,204,0,0.22);
}

/* Feedback visual al agregar */
.product-card-ig .add-to-cart-ig.added {
    background: #2ecc71;
    color: #fff;
}

/* ── LIGHTBOX / MODAL DE PRODUCTO ────────────────────────────── */
.product-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(8px);
}

.product-lightbox.active {
    display: flex;
}

.product-lightbox-inner {
    background: #111;
    border-radius: 20px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid rgba(255,255,255,0.1);
    animation: lbFadeIn 0.3s ease;
    position: relative;
}

@keyframes lbFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

@media (max-width: 640px) {
    .product-lightbox-inner {
        grid-template-columns: 1fr;
        max-height: 95vh;
    }
}

.lb-media-col {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #000;
    border-radius: 20px 0 0 20px;
    overflow: hidden;
}

@media (max-width: 640px) {
    .lb-media-col { border-radius: 20px 20px 0 0; aspect-ratio: 4/3; }
}

.lb-media-carousel {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.lb-media-slide {
    min-width: 100%;
    height: 100%;
    flex-shrink: 0;
}

.lb-media-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.lb-media-slide .video-wrapper {
    width: 100%;
    height: 100%;
    background: #000;
}

.lb-media-slide .video-wrapper iframe,
.lb-media-slide .video-wrapper video {
    width: 100%;
    height: 100%;
    border: none;
}

.lb-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 3;
}

.lb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.lb-dot.active {
    background: #fff;
    transform: scale(1.3);
}

.lb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 0.9rem;
    cursor: pointer;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}

.lb-arrow:hover { background: rgba(0,0,0,0.85); }
.lb-arrow.prev { left: 10px; }
.lb-arrow.next { right: 10px; }

/* Thumbnails en el lightbox */
.lb-thumbs {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    overflow-x: auto;
    scrollbar-width: none;
}

.lb-thumbs::-webkit-scrollbar { display: none; }

.lb-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-thumb.active { border-color: var(--primary-color); }

.lb-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lb-thumb .video-thumb-icon {
    color: #fff;
    font-size: 1.2rem;
}

/* Columna de info en el lightbox */
.lb-info-col {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}

.lb-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}

.lb-close:hover { background: rgba(200,0,0,0.7); }

.lb-product-name {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
    line-height: 1.2;
}

.lb-product-price {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--primary-color);
    margin: 0;
}

.lb-product-desc {
    font-size: 0.88rem;
    color: #aaa;
    line-height: 1.6;
    margin: 0;
}

.lb-product-stock {
    font-size: 0.78rem;
    color: #666;
}

.lb-add-btn {
    padding: 14px;
    background: var(--primary-color);
    color: #000;
    border: none;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
}

.lb-add-btn:hover { background: #e6b800; transform: scale(1.02); }
.lb-add-btn:disabled { background: #333; color: #555; cursor: not-allowed; transform: none; }

.lb-add-btn.login-btn {
    background: rgba(255,204,0,0.12);
    color: var(--primary-color);
    border: 1px solid rgba(255,204,0,0.35);
}

/* ── RESPONSIVE AJUSTES GENERALES ────────────────────────────── */
@media (max-width: 480px) {
    .offers-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 8px 12px 16px;
    }

    .offer-card-ig .offer-info { padding: 10px 10px 12px; }
    .offer-card-ig .offer-name { font-size: 0.82rem; }
    .offer-card-ig .offer-price-final { font-size: 0.95rem; }
    .offer-card-ig .offer-add-btn { font-size: 0.78rem; padding: 9px; }

    .products-grid-ig { gap: 8px; padding: 0 10px; }
    .product-card-ig .product-name-ig { font-size: 0.75rem; }
    .product-card-ig .add-to-cart-ig { font-size: 0.72rem; padding: 8px; }
}

/* ── ANIMACIÓN DE ENTRADA ────────────────────────────────────── */
@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.product-card-ig, .offer-card-ig {
    animation: cardFadeIn 0.4s ease both;
}

/* Delay escalonado para los primeros 12 items */
.product-card-ig:nth-child(1)  { animation-delay: 0.03s; }
.product-card-ig:nth-child(2)  { animation-delay: 0.06s; }
.product-card-ig:nth-child(3)  { animation-delay: 0.09s; }
.product-card-ig:nth-child(4)  { animation-delay: 0.12s; }
.product-card-ig:nth-child(5)  { animation-delay: 0.15s; }
.product-card-ig:nth-child(6)  { animation-delay: 0.18s; }
.product-card-ig:nth-child(7)  { animation-delay: 0.21s; }
.product-card-ig:nth-child(8)  { animation-delay: 0.24s; }
.product-card-ig:nth-child(9)  { animation-delay: 0.27s; }
.product-card-ig:nth-child(10) { animation-delay: 0.30s; }
.product-card-ig:nth-child(11) { animation-delay: 0.33s; }
.product-card-ig:nth-child(12) { animation-delay: 0.36s; }
