/**
 * Wishlist System CSS
 * Styling for the marketplace wishlist and save-for-later functionality
 */

/* Wishlist Button */
.wishlist-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
}

.wishlist-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.wishlist-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.wishlist-btn.add-to-wishlist:hover {
    background: #f1f5f9 !important;
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
}

.wishlist-btn.remove-from-wishlist:hover {
    background: #fef2f2 !important;
    border-color: #dc2626 !important;
    color: #dc2626 !important;
}

/* Wishlist Navigation */
.wishlist-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: opacity 0.2s;
}

.wishlist-nav-link:hover {
    opacity: 0.8;
}

#wishlist-count-badge {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* User Wishlist Page */
.user-wishlist {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.wishlist-header {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 20px;
}

.wishlist-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

#clear-wishlist-btn:hover {
    background: #dc2626 !important;
    color: white !important;
    transform: translateY(-1px);
}

/* Wishlist Items Grid */
.wishlist-items-grid {
    gap: 25px;
}

@media (max-width: 768px) {
    .wishlist-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .wishlist-items-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Wishlist Item Cards */
.wishlist-item {
    position: relative;
    overflow: hidden;
}

.wishlist-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.wishlist-item .item-image {
    position: relative;
    overflow: hidden;
}

.wishlist-item .item-image img {
    transition: transform 0.3s ease;
}

.wishlist-item:hover .item-image img {
    transform: scale(1.05);
}

/* Remove Button */
.remove-from-wishlist-btn {
    opacity: 0;
    transition: all 0.2s ease;
}

.wishlist-item:hover .remove-from-wishlist-btn {
    opacity: 1;
}

.remove-from-wishlist-btn:hover {
    background: rgba(220, 38, 38, 0.9) !important;
    transform: scale(1.1);
}

/* Action Buttons */
.move-to-cart-btn:hover {
    background: #059669 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.wishlist-item .item-actions a:hover {
    background: #2563eb !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

/* Empty Wishlist */
.empty-wishlist {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.empty-wishlist a:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.empty-wishlist a:nth-child(2):hover {
    background: #3b82f6 !important;
    color: white !important;
}

/* Login Required */
.wishlist-login-required {
    max-width: 400px;
    margin: 40px auto;
}

.wishlist-login-required a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
}

.wishlist-login-required a:hover {
    text-decoration: underline;
}

/* Load More Button */
#load-more-wishlist:hover {
    background: #4b5563 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(107, 114, 128, 0.3);
}

/* Item Rating */
.item-rating {
    font-size: 0;
}

.item-rating .star {
    font-size: 14px;
    color: #fbbf24;
}

/* Price Highlighting */
.item-price {
    position: relative;
}

.item-price::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    border-radius: 1px;
}

/* Wishlist Badge for Marketplace Items */
.wishlist-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(59, 130, 246, 0.9);
    color: white;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
    z-index: 2;
}

/* Loading States */
.wishlist-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Success/Error Messages */
.wishlist-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out;
}

.wishlist-message.success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.wishlist-message.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Wishlist Counter Animation */
.wishlist-count-updated {
    animation: bounce 0.6s ease-out;
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .user-wishlist {
        padding: 0 15px;
    }
    
    .wishlist-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .wishlist-header h2 {
        font-size: 1.5rem;
    }
    
    .wishlist-item .item-content {
        padding: 15px;
    }
    
    .wishlist-item .item-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .wishlist-item .item-actions a,
    .wishlist-item .item-actions button {
        text-align: center;
        flex: none;
    }
    
    .wishlist-message {
        top: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .empty-wishlist {
        padding: 40px 15px;
    }
    
    .empty-wishlist div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .empty-wishlist a {
        padding: 12px 20px !important;
        display: block;
        text-align: center;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .wishlist-btn,
    .wishlist-item,
    .remove-from-wishlist-btn,
    .move-to-cart-btn,
    #load-more-wishlist,
    .wishlist-message,
    .wishlist-item img {
        transition: none;
        animation: none;
        transform: none !important;
    }
    
    #wishlist-count-badge {
        animation: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .wishlist-btn {
        border-width: 2px;
    }
    
    .wishlist-item {
        border: 2px solid #000;
    }
    
    .remove-from-wishlist-btn {
        border: 2px solid #fff;
    }
}

/* Print Styles */
@media print {
    .wishlist-btn,
    .remove-from-wishlist-btn,
    .move-to-cart-btn,
    #load-more-wishlist,
    .wishlist-actions {
        display: none;
    }
    
    .wishlist-item {
        break-inside: avoid;
        border: 1px solid #000;
        margin-bottom: 15px;
    }
}