/* WooCommerce Product Reels - TikTok Style */

/* Reset y base */
.woo-reels-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.woo-reels-container *,
.woo-reels-container *::before,
.woo-reels-container *::after {
    box-sizing: border-box;
}

/* Contenedor principal */
.woo-reels-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Grid Layout (Estilo TikTok) */
.reels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    justify-content: center;
}

/* Reel Item */
.reel-item {
    position: relative;
    width: 100%;
    height: 500px;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    background: #1a1a1a;
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

.reel-item:nth-child(1) { animation-delay: 0.1s; }
.reel-item:nth-child(2) { animation-delay: 0.2s; }
.reel-item:nth-child(3) { animation-delay: 0.3s; }
.reel-item:nth-child(4) { animation-delay: 0.4s; }
.reel-item:nth-child(n+5) { animation-delay: 0.5s; }

.reel-item:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

/* Video */
.reel-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
    transition: transform 0.3s ease;
}

.reel-item:hover .reel-video {
    transform: scale(1.05);
}

/* Video Placeholder con gradientes */
.video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.video-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.3) 100%);
    z-index: 1;
}

.placeholder-icon {
    font-size: 64px;
    z-index: 2;
    position: relative;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

/* Estilos de gradientes */
.gradient-style1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-style2 {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.gradient-style3 {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.gradient-style4 {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.gradient-style5 {
    background: linear-gradient(135deg, #ffa726 0%, #ffcc02 100%);
}

/* Play Indicator */
.play-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #333;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.reel-item:hover .play-indicator {
    transform: translate(-50%, -50%) scale(1.15);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.play-indicator.playing {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.8);
}

/* Product Overlay */
.product-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    padding: 40px 20px 20px;
    color: white;
    z-index: 5;
}

/* Product Badge */
.product-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.15);
    padding: 10px 14px;
    border-radius: 50px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: fit-content;
    transition: all 0.3s ease;
}

.reel-item:hover .product-badge {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Product Image */
.product-image {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    overflow: hidden;
    flex-shrink: 0;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

/* Product Info */
.product-info {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.95);
}

.product-price {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.product-price .woocommerce-Price-amount {
    color: inherit;
}

/* Add to Cart Button */
.add-to-cart-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.add-to-cart-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.add-to-cart-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}

.add-to-cart-btn:hover::before {
    left: 100%;
}

.add-to-cart-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Estados del botón */
.add-to-cart-btn.loading {
    background: rgba(255, 255, 255, 0.7);
    cursor: not-allowed;
    transform: none;
}

.add-to-cart-btn.success {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    transform: translateY(-2px);
}

.add-to-cart-btn.error {
    background: linear-gradient(135deg, #f44336 0%, #da190b 100%);
    color: white;
}

.add-to-cart-btn.loading::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notificación */
.woo-reels-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    z-index: 9999;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 350px;
    backdrop-filter: blur(10px);
}

.woo-reels-notification.show {
    transform: translateX(0);
}

.woo-reels-notification.error {
    background: linear-gradient(135deg, #f44336 0%, #da190b 100%);
}

.notification-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.notification-text {
    flex: 1;
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Efecto de brillo en hover */
.reel-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
    pointer-events: none;
    border-radius: 16px;
}

.reel-item:hover::before {
    opacity: 1;
}

/* Layout Vertical (compatibilidad) */
.reels-vertical {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 400px;
    margin: 0 auto;
}

.reels-vertical .reel-item {
    width: 100%;
    max-width: 400px;
    height: 600px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .reels-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 10px;
    }
    
    .reel-item {
        height: 450px;
    }
}

@media (max-width: 768px) {
    .woo-reels-container {
        padding: 10px;
    }
    
    .reels-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 8px;
    }
    
    .reel-item {
        height: 400px;
        border-radius: 12px;
    }
    
    .product-overlay {
        padding: 30px 15px 15px;
    }
    
    .product-badge {
        padding: 8px 12px;
    }
    
    .product-image {
        width: 38px;
        height: 38px;
    }
    
    .product-name {
        font-size: 13px;
    }
    
    .product-price {
        font-size: 15px;
    }
    
    .add-to-cart-btn {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .play-indicator {
        width: 60px;
        height: 60px;
        font-size: 20px;
    }
    
    .placeholder-icon {
        font-size: 48px;
    }
    
    .woo-reels-notification {
        max-width: 300px;
        padding: 14px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .reels-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .reel-item {
        width: 100%;
        max-width: 320px;
        height: 500px;
        margin: 0 auto;
    }
    
    .product-overlay {
        padding: 25px 12px 12px;
    }
    
    .product-badge {
        gap: 10px;
        padding: 6px 10px;
    }
    
    .product-image {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .product-name {
        font-size: 12px;
    }
    
    .product-price {
        font-size: 14px;
    }
    
    .add-to-cart-btn {
        padding: 10px 14px;
        font-size: 12px;
        border-radius: 10px;
    }
    
    .woo-reels-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        padding: 12px 16px;
    }
}

/* Estados especiales */
.woo-reels-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
}

.woo-reels-empty p {
    margin: 0;
    opacity: 0.8;
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
    .reel-item {
        animation: none;
        opacity: 1;
        transform: none;
    }
    
    .reel-item,
    .add-to-cart-btn,
    .play-indicator,
    .product-badge {
        transition: none;
    }
}

/* Modo oscuro automático */
@media (prefers-color-scheme: dark) {
    .woo-reels-container {
        color: #ffffff;
    }
    
    .woo-reels-empty {
        color: #cccccc;
    }
}

/* Optimizaciones de rendimiento */
.reel-item {
    will-change: transform, box-shadow;
    backface-visibility: hidden;
    perspective: 1000px;
}

.reel-video {
    will-change: transform;
    backface-visibility: hidden;
}

.play-indicator {
    will-change: transform, opacity;
    backface-visibility: hidden;
}

/* Estados de carga */
.reel-item.loading .video-placeholder::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 1.5s infinite;
    z-index: 3;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Hover mejorado para desktop */
@media (hover: hover) and (pointer: fine) {
    .reel-item:hover .product-overlay {
        background: linear-gradient(transparent, rgba(0,0,0,0.9));
    }
    
    .reel-item:hover .add-to-cart-btn {
        box-shadow: 0 12px 35px rgba(0,0,0,0.3);
    }
}

/* Focus states para accesibilidad */
.reel-item:focus,
.add-to-cart-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.play-indicator:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.add-to-cart-btn {
    background-color: #000;
    color: #fff;
    padding: 10px 20px;
    border: none;
    font-weight: bold;
    cursor: pointer;
}

.add-to-cart-btn.loading {
    opacity: 0.6;
    pointer-events: none;
}
