/* productos.css - Componentes de las tarjetas de producto */

/* ========== GRID DE PRODUCTOS ========== */
.productos-container, #productos {
    margin-top: 30px;
    margin-bottom: 80px;
}
@media (min-width: 768px) {
    .productos-container, #productos {
        content-visibility: auto;
        contain-intrinsic-size: 1px 5000px;
    }
}

/* ========== TARJETA GIRATORIA ========== */
.card-giratoria {
    perspective: 1000px;
    height: 500px;
    width: 100% !important;
    overflow: hidden;
    background: #00000085 !important;
}
@media (max-width: 768px) {
    .card-giratoria {
        height: 540px;
    }
}
.card-contenedor {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}
.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    padding: 15px;
    box-shadow: 0 8px 20px rgb(234 234 234 / 30%);
}
.card-front:hover, .card-back:hover {
    box-shadow: 0 12px 25px rgba(0,0,0,0.4);
}
.card-front .card-body {
    margin-top: 0.75rem;  
}
.card-front {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;  
    gap: 0;                        
}
.card-back {
    transform: rotateY(180deg);
    display: flex;
    z-index: 10;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}
.card-girada {
    transform: rotateY(180deg);
}
.card-giratoria.flipping {
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.8s ease !important;
    pointer-events: none;
}
.btn-girar, .btn-reversa {
    position: absolute;
    right: 10px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(255,255,255,0);
    border: none;
    color: white;
    font-size: 26px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}
.btn-girar:hover, .btn-reversa:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.1);
}
.btn-reversa {
    pointer-events: auto;
    z-index: 20 !important;
    top: 10px;
}
.descripcion-area {
    flex: 1;
    margin-top: 30px;
    padding: 10px 80px 80px 80px;
    overflow-y: auto;
    text-align: center;
    scrollbar-width: none;
    -ms-overflow-style: none;
    overflow-x: hidden;
    word-wrap: break-word;
}
.descripcion-area::-webkit-scrollbar {
    display: none;
}

/* ========== FOTOS ADICIONALES ========== */
.fotos-adicionales-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, auto));
    gap: 5px;
    margin-top: 10px;
}
@media (max-width: 767px) {
    .fotos-adicionales-grid {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        width: 100% !important;
        gap: 8px;
        padding: 4px 0 12px 0;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }
    .foto-adicional-thumb {
        flex: 0 0 80px !important;
        width: 80px !important;
        height: 80px !important;
        scroll-snap-align: start;
        object-fit: cover;
        border-radius: 8px;
    }
}
.foto-adicional-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 3px;
    cursor: pointer;
}
.card-back .fotos-adicionales {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    justify-content: center;
    padding-bottom: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.card-back .fotos-adicionales::-webkit-scrollbar {
    display: none;
}
.card-back .fotos-adicionales img {
    flex-shrink: 0;
    scroll-snap-align: start;
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
}

/* ========== PRECIOS Y OFERTAS ========== */
.precio-actual {
    font-size: 1.4rem;
    font-weight: bold;
    display: inline;
}
.precio-anterior-tachado {
    text-decoration: line-through;
    color: #999;
    font-size: 0.9rem;
    margin-right: 5px;
}
.precio-anterior-visible {
    display: inline !important;
}
.precio-anterior-oculto {
    display: none;
}
.precio-oferta {
    color: #ff4757;
    font-weight: bold;
}
.oferta-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ff4757;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 20px;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    animation: pulseOferta 1.5s infinite;
}
.oferta-badge-visible {
    display: block !important;
}
.oferta-badge-oculto {
    display: none;
}
.cuotas-info {
    display: inline-block;
    font-size: 0.9rem;
    color: white;
}
.precio-wrapper {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 8px;
}
.ahorro-oculto {
    display: none;
}
@keyframes pulseOferta {
    0%, 100% { transform: scale(1); box-shadow: 0 2px 5px rgba(0,0,0,0.3); }
    50% { transform: scale(1.05); box-shadow: 0 4px 10px rgba(255,71,87,0.5); }
}

/* ========== TÍTULO E IMAGEN DEL PRODUCTO ========== */
.card-title {
    font-weight: 600;
    background-clip: text;
    margin-bottom: 1rem !important;
}
.producto-img {
    margin-top: 10px;
    width: 100%;
    height: 180px;
    object-fit: contain;
    border-radius: 4px;
    cursor: pointer;
    opacity: 1;
}
.lazy-image {
    transition: opacity 0.3s ease !important;
}
.lazy-image.loaded {
    opacity: 1;
}
.img-lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}
.img-lazy.loaded {
    opacity: 1;
}
.btn-secondary.btn-sm {
    background: linear-gradient(90deg, #007fff, #1e2a36);
    border: none;
    border-radius: 40px;
    padding: 8px 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}
.btn-secondary.btn-sm:hover {
    background: linear-gradient(90deg, #3e5a6c, #2c3e50);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -8px black;
}
.btn-sin-stock {
    opacity: 0.5;
}
.producto-cantidad {
    width: 70px !important;
}
.selector-ancho {
    min-width: 100px;
}
.form-select-sm {
    font-size: 0.8rem !important;
    cursor: pointer;
}
.form-select-sm option {
    background-color: #1e1e2f;
    color: white;
}

/* ========== COLORES Y TALLES EN LA CARTA ========== */
.colores-info, .talles-info {
    display: none;
}
.info-visible {
    display: block;
}
.info-hidden {
    display: none;
}

/* ========== VENDEDOR INFO ========== */
.vendor-info {
    font-size: 0.7rem;
    color: #ccc !important;
    text-align: center;
    margin-top: 50px !important;
}
@media (min-width: 768px) {
    .card-front .card-body {
        margin-left: 15px;
    }
}
/* ========== TICKER (también se ve en index y puede ir en productos) ========== */
.ticker-container {
    color: #dca335;
    overflow: hidden;
    white-space: nowrap;
    padding: 10px 0;
    font-weight: bold;
    position: relative;
    width: 100%;
}
.ticker-text {
    margin-top: 20px;
    display: inline-block;
    animation: tickerMove 20s linear infinite;
    padding-left: 100%;
    font-size: 1.1rem;
}
.ticker-container:hover .ticker-text {
    animation-play-state: paused;
}
@keyframes tickerMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* ========== SELECTOR DE ORDEN ========== */
.orden-precio-select {
    min-width: 210px;
}

/* ========== SKELETON REUTILIZABLE ========== */
.skeleton-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 30px;
}
@media (min-width: 768px) {
    .skeleton-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.skeleton-card {
    height: 560px;
    background: linear-gradient(145deg, #1e1e2f 0, #2a2a3a 100%);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    animation: 1.5s ease-in-out infinite skeleton-pulse;
}
.skeleton-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 150%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent);
    animation: 1.2s infinite skeleton-shimmer;
}
@keyframes skeleton-pulse {
    0%, 100% { opacity: .6; }
    50% { opacity: 1; }
}
@keyframes skeleton-shimmer {
    0% { transform: translateX(0); }
    100% { transform: translateX(200%); }
}

@media (max-width: 767px) {
    #productos.row {
        --bs-gutter-x: 0.5rem;  
    }

    .card-producto {
        width: 50% !important;
        flex: 0 0 50%;
        max-width: 50% !important;
    }
}
