/**
 * ==========================================================================
 * FAVORITES PAGE — Premium SaaS Design (2025)
 * ==========================================================================
 * 
 * Style: Stripe/Linear/Framer inspired
 * Features: Subtle gradients, glass morphism (no blur), premium shadows,
 *           clean typography, smooth animations
 * 
 * Structure:
 * 1. Layout Container
 * 2. Header with Stats
 * 3. Empty State
 * 4. Products Grid
 * 5. Loading State
 * 6. Responsive
 */

/* ==========================================================================
   1. LAYOUT CONTAINER
   ========================================================================== */
.fav-page {
    min-height: calc(100vh - 200px);
    padding: 48px 0 80px;
    background: linear-gradient(180deg, 
        #fafbfc 0%, 
        #f8f9fb 50%, 
        #f5f7fa 100%
    );
    position: relative;
}

.fav-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 400px;
    background: radial-gradient(circle at 50% 0%, 
        rgba(212, 168, 83, 0.03) 0%, 
        transparent 70%
    );
    pointer-events: none;
}

.fav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   2. HEADER WITH STATS
   ========================================================================== */
.fav-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.fav-header__content {
    flex: 1;
}

.fav-header__title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.fav-header__title {
    font-family: var(--font-display, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin: 0;
    line-height: 1.1;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.fav-header__count {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    background: linear-gradient(135deg, 
        rgba(212, 168, 83, 0.15) 0%, 
        rgba(212, 168, 83, 0.08) 100%
    );
    border: 1px solid rgba(212, 168, 83, 0.2);
    border-radius: 12px;
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.fav-header__subtitle {
    font-size: 15px;
    font-weight: 500;
    color: #64748b;
    margin: 0;
    letter-spacing: -0.01em;
}

.fav-header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fav-header__btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.fav-header__btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.fav-header__btn--primary {
    color: #0f172a;
    background: linear-gradient(135deg, 
        rgba(212, 168, 83, 0.9) 0%, 
        rgba(212, 168, 83, 1) 100%
    );
    box-shadow: 
        0 2px 8px rgba(212, 168, 83, 0.25),
        0 1px 3px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.fav-header__btn--primary:hover {
    background: linear-gradient(135deg, 
        rgba(212, 168, 83, 1) 0%, 
        rgba(232, 195, 109, 1) 100%
    );
    box-shadow: 
        0 4px 12px rgba(212, 168, 83, 0.3),
        0 2px 6px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    transform: translateY(-1px);
}

.fav-header__btn--outline {
    color: #64748b;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.fav-header__btn--outline:hover {
    color: #dc2626;
    background: rgba(255, 255, 255, 1);
    border-color: rgba(220, 38, 38, 0.2);
    box-shadow: 
        0 2px 8px rgba(220, 38, 38, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

/* ==========================================================================
   3. EMPTY STATE — Elegant & Centered
   ========================================================================== */
.fav-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    padding: 60px 24px;
}

.fav-empty__card {
    max-width: 520px;
    text-align: center;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.9) 0%, 
        rgba(255, 255, 255, 0.7) 100%
    );
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.04),
        0 1px 3px rgba(0, 0, 0, 0.02),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.fav-empty__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, 
        rgba(212, 168, 83, 0.08) 0%, 
        rgba(212, 168, 83, 0.04) 100%
    );
    border: 1px solid rgba(212, 168, 83, 0.15);
    border-radius: 20px;
    box-shadow: 
        0 4px 12px rgba(212, 168, 83, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.fav-empty__icon svg {
    width: 40px;
    height: 40px;
    color: #d4a853;
    stroke-width: 1.5;
}

.fav-empty__title {
    font-family: var(--font-display, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin: 0 0 12px 0;
    line-height: 1.2;
}

.fav-empty__text {
    font-size: 16px;
    font-weight: 500;
    color: #64748b;
    line-height: 1.5;
    margin: 0 0 32px 0;
}

.fav-empty__features {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
    text-align: left;
}

.fav-empty__feature {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.fav-empty__feature:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(212, 168, 83, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.fav-empty__feature svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #d4a853;
    margin-top: 2px;
}

.fav-empty__feature span {
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    line-height: 1.5;
}

.fav-empty__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
    background: linear-gradient(135deg, 
        rgba(212, 168, 83, 0.9) 0%, 
        rgba(212, 168, 83, 1) 100%
    );
    border-radius: 12px;
    box-shadow: 
        0 4px 12px rgba(212, 168, 83, 0.25),
        0 2px 6px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.fav-empty__btn svg {
    width: 18px;
    height: 18px;
}

.fav-empty__btn:hover {
    background: linear-gradient(135deg, 
        rgba(212, 168, 83, 1) 0%, 
        rgba(232, 195, 109, 1) 100%
    );
    box-shadow: 
        0 6px 20px rgba(212, 168, 83, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    transform: translateY(-2px);
}

/* ==========================================================================
   4. PRODUCTS GRID — Clean & Spacious
   ========================================================================== */
.fav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* Premium card integration with fav page */
.fav-grid .cc {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(255, 255, 255, 0.9) 100%
    );
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.03),
        0 1px 3px rgba(0, 0, 0, 0.02),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.fav-grid .cc:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(212, 168, 83, 0.2);
    box-shadow: 
        0 8px 24px rgba(212, 168, 83, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    transform: translateY(-4px);
}

.fav-grid .cc::after {
    background: linear-gradient(135deg, 
        rgba(212, 168, 83, 0.6) 0%, 
        rgba(232, 195, 109, 0.5) 50%, 
        rgba(212, 168, 83, 0.4) 100%
    );
}

/* Smooth entry animation for cards */
.fav-grid .cc {
    animation: favCardFadeIn 0.4s ease-out backwards;
}

.fav-grid .cc:nth-child(1) { animation-delay: 0.05s; }
.fav-grid .cc:nth-child(2) { animation-delay: 0.1s; }
.fav-grid .cc:nth-child(3) { animation-delay: 0.15s; }
.fav-grid .cc:nth-child(4) { animation-delay: 0.2s; }
.fav-grid .cc:nth-child(5) { animation-delay: 0.25s; }
.fav-grid .cc:nth-child(6) { animation-delay: 0.3s; }
.fav-grid .cc:nth-child(n+7) { animation-delay: 0.35s; }

@keyframes favCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Error state inside grid */
.fav-error {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 24px;
    text-align: center;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.8) 0%, 
        rgba(248, 250, 252, 0.6) 100%
    );
    border: 1px solid rgba(220, 38, 38, 0.15);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.08);
}

.fav-error svg {
    width: 48px;
    height: 48px;
    color: #dc2626;
}

.fav-error p {
    font-size: 15px;
    font-weight: 500;
    color: #64748b;
    margin: 0;
    max-width: 400px;
}

/* ==========================================================================
   5. LOADING STATE
   ========================================================================== */
.fav-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 24px;
}

.fav-loading__spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(212, 168, 83, 0.2);
    border-top-color: #d4a853;
    border-radius: 50%;
    animation: favSpin 0.8s linear infinite;
}

@keyframes favSpin {
    to { transform: rotate(360deg); }
}

.fav-loading__text {
    font-size: 15px;
    font-weight: 500;
    color: #64748b;
    margin: 0;
}

/* ==========================================================================
   6. RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
    .fav-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .fav-page {
        padding: 32px 0 60px;
    }
    
    .fav-container {
        padding: 0 16px;
    }
    
    .fav-header {
        flex-direction: column;
        gap: 20px;
        margin-bottom: 32px;
        padding-bottom: 24px;
    }
    
    .fav-header__title {
        font-size: 28px;
    }
    
    .fav-header__count {
        min-width: 28px;
        height: 28px;
        font-size: 13px;
    }
    
    .fav-header__actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .fav-header__btn {
        flex: 1;
        justify-content: center;
        min-width: calc(50% - 6px);
    }
    
    .fav-empty {
        min-height: 400px;
        padding: 40px 16px;
    }
    
    .fav-empty__card {
        padding: 36px 24px;
    }
    
    .fav-empty__icon {
        width: 64px;
        height: 64px;
        margin-bottom: 20px;
    }
    
    .fav-empty__icon svg {
        width: 32px;
        height: 32px;
    }
    
    .fav-empty__title {
        font-size: 24px;
    }
    
    .fav-empty__text {
        font-size: 15px;
    }
    
    .fav-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .fav-header__title {
        font-size: 24px;
    }
    
    .fav-header__subtitle {
        font-size: 14px;
    }
    
    .fav-header__btn {
        font-size: 13px;
        padding: 8px 16px;
    }
    
    .fav-header__btn svg {
        width: 16px;
        height: 16px;
    }
    
    .fav-empty__card {
        padding: 32px 20px;
        border-radius: 20px;
    }
    
    .fav-empty__title {
        font-size: 22px;
    }
    
    .fav-empty__text {
        font-size: 14px;
    }
    
    .fav-empty__feature {
        padding: 12px;
    }
    
    .fav-empty__feature span {
        font-size: 13px;
    }
    
    .fav-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   7. REDUCED MOTION
   ========================================================================== */
/* ==========================================================================
   7. REMOVE BUTTON FOR FAVORITES
   ========================================================================== */
.fav-grid .cc {
    position: relative;
}

.fav-grid .cc-remove-btn,
.cc-remove-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.fav-grid .cc-remove-btn:hover,
.cc-remove-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    transform: scale(1.1);
}

.fav-grid .cc-remove-btn svg,
.cc-remove-btn svg {
    width: 16px;
    height: 16px;
    stroke: #6b7280;
    transition: stroke 0.2s ease;
}

.fav-grid .cc-remove-btn:hover svg,
.cc-remove-btn:hover svg {
    stroke: #dc2626;
}

/* ==========================================================================
   8. REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .fav-header__btn,
    .fav-empty__btn,
    .fav-empty__feature,
    .fav-grid .cc {
        transition: none;
        animation: none;
    }
    
    .fav-loading__spinner {
        animation: none;
        border-top-color: transparent;
    }
    
    .fav-grid .cc:hover {
        transform: none;
    }
}
