/* ==========================================
   PHASES 7-15: ADVANCED FEATURES
   ========================================== */

/* ==========================================
   PHASE 7: WISHLIST & COMPARE
   ========================================== */

/* Heart Icon on Product Cards */
.product-card .wishlist-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-card .wishlist-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.product-card .wishlist-btn i {
    font-size: 18px;
    color: #666;
    transition: all 0.3s ease;
}

.product-card .wishlist-btn.active i {
    color: #ef4444;
    animation: heartBeat 0.5s ease;
}

@keyframes heartBeat {

    0%,
    100% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.3);
    }

    50% {
        transform: scale(1.1);
    }

    75% {
        transform: scale(1.2);
    }
}

/* Wishlist Page Grid */
.wishlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
    padding: 20px 0;
}

.wishlist-item {
    position: relative;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.wishlist-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.wishlist-item-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    color: #ef4444;
    font-size: 16px;
    transition: all 0.2s ease;
}

.wishlist-item-remove:hover {
    background: #ef4444;
    color: white;
}

/* Compare Feature */
.compare-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid #3b82f6;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #3b82f6;
    cursor: pointer;
    transition: all 0.2s ease;
}

.compare-btn:hover {
    background: #3b82f6;
    color: white;
}

.compare-btn.active {
    background: #3b82f6;
    color: white;
}

.compare-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    padding: 16px 24px;
    z-index: 1020;
    display: none;
    align-items: center;
    justify-content: space-between;
}

.compare-bar.show {
    display: flex;
}

.compare-items {
    display: flex;
    gap: 12px;
}

.compare-item-thumb {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
}

/* ==========================================
   PHASE 8: ADVANCED FILTERING
   ========================================== */

/* Sidebar Filters */
.filters-sidebar {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.filter-group {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.filter-group:last-child {
    border-bottom: none;
}

.filter-title {
    font-size: 16px;
    font-weight: 700;
    color: #111;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    cursor: pointer;
}

.filter-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.filter-option-label {
    flex: 1;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

.filter-option-count {
    font-size: 13px;
    color: #9ca3af;
}

/* Price Range Slider */
.price-range-slider {
    padding: 20px 10px;
}

.price-range-inputs {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.price-range-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
}

/* Active Filters Display */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--amazon-blue);
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.active-filter-remove {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    width: 16px;
    height: 16px;
}

/* Sort Dropdown */
.sort-dropdown {
    position: relative;
    display: inline-block;
}

.sort-button {
    padding: 10px 16px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    margin-top: 4px;
    display: none;
    z-index: 100;
}

.sort-menu.show {
    display: block;
}

.sort-option {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
}

.sort-option:hover {
    background: #f9fafb;
}

.sort-option.active {
    background: rgba(20, 110, 180, 0.1);
    color: var(--amazon-blue);
    font-weight: 600;
}

/* Color/Size Swatches */
.filter-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.filter-swatch:hover {
    transform: scale(1.1);
}

.filter-swatch.active {
    border-color: var(--amazon-blue);
    box-shadow: 0 0 0 2px rgba(20, 110, 180, 0.2);
}

.filter-swatch.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: 700;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

/* ==========================================
   PHASE 9: PERFORMANCE OPTIMIZATIONS
   ========================================== */

/* Skeleton Loaders */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmerEffect 1.5s infinite;
}

@keyframes shimmerEffect {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    border-radius: 8px;
    overflow: hidden;
}

.skeleton-image {
    width: 100%;
    height: 200px;
}

.skeleton-text {
    height: 16px;
    margin: 12px 0;
    border-radius: 4px;
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--amazon-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Load More Button */
.load-more-btn {
    display: block;
    margin: 40px auto;
    padding: 14px 40px;
    background: var(--amazon-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.load-more-btn:hover {
    background: #0f5a8f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(20, 110, 180, 0.3);
}

/* ==========================================
   PHASE 10: MOBILE-FIRST ENHANCEMENTS
   ========================================== */

/* Swipeable Product Gallery */
.mobile-gallery {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}

.mobile-gallery-track {
    display: flex;
    transition: transform 0.3s ease;
}

.mobile-gallery-indicators {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
}

.mobile-gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    transition: all 0.3s ease;
}

.mobile-gallery-dot.active {
    background: var(--amazon-blue);
    width: 24px;
    border-radius: 4px;
}

/* Bottom Sheet Modal */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 9999;
    max-height: 80vh;
    overflow-y: auto;
}

.bottom-sheet.show {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 0 auto 20px;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--amazon-orange);
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.fab i {
    font-size: 24px;
    color: white;
}

/* Pull to Refresh */
.pull-to-refresh {
    text-align: center;
    padding: 20px;
    color: var(--amazon-blue);
    display: none;
}

.pull-to-refresh.active {
    display: block;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .filters-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        width: 80%;
        max-width: 320px;
        transition: left 0.3s ease;
        z-index: 9999;
        overflow-y: auto;
    }

    .filters-sidebar.show {
        left: 0;
    }

    .wishlist-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}