/* ============================================
   ANIMACIONES PARA SISTEMA DE FAVORITOS
   ============================================ */

/* Botón de Favoritos en Product Detail */
.favorite-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 12px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    white-space: nowrap;
}

.favorite-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.favorite-btn.active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: #dc2626;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.favorite-btn.active i {
    animation: heartPulse 0.6s ease-in-out;
}

/* Animación de pulso del corazón */
@keyframes heartPulse {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.3);
    }
    50% {
        transform: scale(1.1);
    }
    75% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Animación alternativa: bounce del corazón */
@keyframes heartBounce {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.4);
    }
    100% {
        transform: scale(1);
    }
}

/* Animación de entrada suave */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Aplicar animación a tarjetas de productos favoritos */
.recommendation-card {
    animation: slideIn 0.3s ease-in-out;
}

/* Animación para el botón de eliminar favoritos */
.rec-remove-btn {
    transition: all 0.3s ease;
}

.rec-remove-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}

.rec-remove-btn:active {
    animation: removeHeartShake 0.4s ease-in-out;
}

/* Animación al eliminar (shake) */
@keyframes removeHeartShake {
    0% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-4px) rotate(-5deg); }
    50% { transform: translateX(4px) rotate(5deg); }
    75% { transform: translateX(-4px) rotate(-5deg); }
    100% { transform: translateX(0) rotate(0deg); }
}

/* Grid de favoritos con efecto hover */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.products-grid .recommendation-card {
    transition: all 0.3s ease;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.products-grid .recommendation-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* Animación del ícono del corazón en cards */
.recommendation-card i.fa-heart {
    transition: all 0.3s ease;
}

.recommendation-card:hover i.fa-heart {
    animation: heartGlow 0.6s ease-in-out infinite;
}

@keyframes heartGlow {
    0% {
        text-shadow: 0 0 0px rgba(239, 68, 68, 0);
        transform: scale(1);
    }
    50% {
        text-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
        transform: scale(1.1);
    }
    100% {
        text-shadow: 0 0 0px rgba(239, 68, 68, 0);
        transform: scale(1);
    }
}

/* Botón agregar al carrito desde favoritos */
.rec-add-btn {
    transition: all 0.3s ease;
}

.rec-add-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.rec-add-btn:active {
    animation: buttonPress 0.2s ease-in-out;
}

@keyframes buttonPress {
    0% { transform: scale(1.05); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* Efecto ripple al clickear favoritos */
.favorite-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.2);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.favorite-btn.active::after {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* Animación para vacío de favoritos */
.empty-state {
    animation: fadeInScale 0.4s ease-in-out;
}

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

/* Loading spinner mejorado */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

/* Tab de favoritos animado */
.tab-content {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Efecto cuando se agrega/elimina de favoritos */
.favorite-action-toast {
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animación de transición suave para cards de órdenes */
.order-item {
    animation: slideIn 0.3s ease-in-out;
    transition: all 0.3s ease;
}

.order-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Estado badge animado */
.order-status {
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* Botón de cancelar orden con hover */
.btn-cancel-order {
    transition: all 0.3s ease;
}

.btn-cancel-order:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.btn-cancel-order:active {
    animation: buttonPress 0.2s ease-in-out;
}

/* Responsivo - ajustar animaciones en mobile */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .products-grid .recommendation-card:hover {
        transform: translateY(-4px);
    }
    
    .favorite-btn {
        padding: 0.65rem 1.2rem;
        font-size: 0.85rem;
    }
    
    @keyframes heartPulse {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.2); }
    }
}

/* Modo oscuro (opcional) */
@media (prefers-color-scheme: dark) {
    .favorite-btn {
        border-color: #374151;
        background: #1f2937;
        color: #d1d5db;
    }
    
    .favorite-btn:hover {
        border-color: #ef4444;
        color: #fca5a5;
    }
    
    .favorite-btn.active {
        background: linear-gradient(135deg, #dc2626, #991b1b);
    }
    
    .products-grid .recommendation-card {
        background: #1f2937;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    }
}

/* Reducir movimiento para usuarios que prefieren menos animación */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
