/**
 * Favorites CSS - Sistema de Favoritos Shineray Sinop
 */

/* Botão de favorito */
.favorite-btn {
    position: relative;
    cursor: pointer;
}

.favorite-btn:hover {
    border-color: #dc2626 !important;
    color: #dc2626 !important;
}

.favorite-btn.favorited {
    background: #fef2f2 !important;
    border-color: #dc2626 !important;
    color: #dc2626 !important;
}

.favorite-btn.favorited:hover {
    background: #fecaca !important;
}

/* Animação do coração */
.favorite-btn i {
    transition: all 0.2s ease;
    transform-origin: center;
}

.favorite-btn:active i {
    transform: scale(1.2);
}

.favorite-btn.favorited i {
    animation: heartBeat 0.6s ease-in-out;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    25% { transform: scale(1.3); }
    40% { transform: scale(1.1); }
    60% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* Counter badge */
.favorites-counter {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc2626;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
    animation: fadeInScale 0.3s ease;
}

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

/* Floating favorites button */
.favorites-floating {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
    cursor: pointer;
}

.favorites-floating:hover {
    background: #b91c1c;
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(220, 38, 38, 0.4);
}

.favorites-floating.hidden {
    transform: translateY(100px);
    opacity: 0;
    pointer-events: none;
}

/* Favorites page header */
.favorites-header {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.favorites-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.favorites-stat {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.favorites-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #dc2626;
    margin-bottom: 0.5rem;
}

.favorites-stat-label {
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Favorites grid */
.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.favorite-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: relative;
}

.favorite-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.favorite-card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.favorite-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.favorite-card:hover .favorite-card-image img {
    transform: scale(1.05);
}

.favorite-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dc2626;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.favorite-remove:hover {
    background: #dc2626;
    color: white;
    transform: scale(1.1);
}

.favorite-card-content {
    padding: 1.5rem;
}

.favorite-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
}

.favorite-card-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.favorite-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.favorite-card-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #dc2626;
    margin-bottom: 1rem;
}

.favorite-card-actions {
    display: flex;
    gap: 0.75rem;
}

.favorite-card-actions .btn {
    flex: 1;
    padding: 0.75rem 0.75rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.btn-primary {
    background: #dc2626;
    color: white;
}

.btn-primary:hover {
    background: #b91c1c;
}

.btn-secondary {
    background: #10b981;
    color: white;
}

.btn-secondary:hover {
    background: #059669;
}

/* Empty state */
.favorites-empty {
    text-align: center;
    padding: 4rem 2rem;
}

.favorites-empty-icon {
    width: 80px;
    height: 80px;
    background: #f3f4f6;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    color: #9ca3af;
}

.favorites-empty h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
}

.favorites-empty p {
    color: #6b7280;
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Comparison mode */
.favorites-compare-mode {
    background: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
}

.favorites-compare-active .favorite-card {
    cursor: pointer;
    border: 2px solid transparent;
}

.favorites-compare-active .favorite-card.selected {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.compare-selection-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #dc2626;
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.favorite-card.selected .compare-selection-indicator {
    opacity: 1;
}

/* Favorites toolbar */
.favorites-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.favorites-toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.favorites-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.favorites-view-toggle {
    display: flex;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 2px;
}

.favorites-view-toggle button {
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.favorites-view-toggle button.active {
    background: white;
    color: #dc2626;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .favorites-floating {
        bottom: 80px; /* Evitar conflito com PWA banner */
    }
    
    .favorites-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .favorites-toolbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .favorites-toolbar-left,
    .favorites-toolbar-right {
        width: 100%;
        justify-content: center;
    }

    .favorites-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .favorites-stats {
        grid-template-columns: 1fr;
    }
    
    .favorite-card-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .favorites-floating {
        width: 48px;
        height: 48px;
        font-size: 18px;
        bottom: 16px;
        left: 16px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .favorite-btn {
        background: #374151;
        border-color: #4b5563;
        color: #d1d5db;
    }
    
    .favorite-btn:hover {
        border-color: #dc2626;
        color: #dc2626;
    }
    
    .favorite-card {
        background: #1f2937;
    }
    
    .favorite-card-title {
        color: #f9fafb;
    }
    
    .favorite-card-meta {
        color: #9ca3af;
    }
    
    .favorites-toolbar {
        background: #1f2937;
    }
}

/* Loading states */
.favorites-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4rem;
}

.favorites-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #dc2626;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animations */
.favorite-card-enter {
    animation: slideInUp 0.3s ease-out;
}

.favorite-card-exit {
    animation: slideOutDown 0.3s ease-in forwards;
}

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

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

/* Micro-interactions */
.favorite-btn:focus {
    outline: 2px solid #dc2626;
    outline-offset: 2px;
}

.favorite-card:focus-within {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Print styles */
@media print {
    .favorites-floating,
    .favorite-remove,
    .favorites-toolbar {
        display: none !important;
    }
    
    .favorite-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}