/**
 * MakhiMarket Favorites Side Panel - Complete Redesign
 * Premium glassmorphism drawer with pill tabs, gradient header, and micro-interactions
 * Follows MakhiMarket Visionary Architect design system
 */

/* ============================================
   OVERLAY
   ============================================ */
.favorites-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.favorites-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================
   DRAWER CONTAINER
   ============================================ */
.favorites-sidebar {
    position: fixed;
    top: 0;
    right: -440px;
    width: 420px;
    height: 100vh;
    background: linear-gradient(165deg,
        rgba(255, 255, 255, 0.97) 0%,
        rgba(249, 250, 251, 0.98) 30%,
        rgba(243, 244, 246, 0.97) 100%);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    z-index: 1001;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        -4px 0 32px rgba(0, 0, 0, 0.1),
        -1px 0 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.6);
}

.favorites-sidebar.active {
    right: 0;
}

/* Top shimmer accent bar */
.favorites-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        var(--brand-primary, #0066cc) 0%,
        var(--brand-secondary, #00d4ff) 25%,
        var(--accent-purple, #6366f1) 50%,
        var(--brand-secondary, #00d4ff) 75%,
        var(--brand-primary, #0066cc) 100%);
    background-size: 200% 100%;
    animation: favoritesBorderShimmer 4s ease-in-out infinite;
    z-index: 3;
}

/* ============================================
   HEADER
   ============================================ */
.favorites-header {
    background: linear-gradient(135deg,
        var(--brand-primary, #0066cc) 0%,
        var(--brand-primary-dark, #0052a3) 50%,
        var(--brand-secondary-dark, #00b8e6) 100%);
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

/* Hex pattern overlay on header */
.favorites-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="hex" width="20" height="20" patternUnits="userSpaceOnUse"><polygon points="10,1 18,6 18,14 10,19 2,14 2,6" fill="none" stroke="rgba(255,255,255,0.12)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23hex)"/></svg>');
    opacity: 0.5;
    animation: favoritesPatternFloat 20s ease-in-out infinite;
    z-index: 0;
}

.favorites-header > * {
    position: relative;
    z-index: 1;
}

.favorites-header-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    letter-spacing: -0.02em;
}

.favorites-header-title .header-heart-icon {
    font-size: 1.25rem;
    animation: favoritesHeartGlow 2s ease-in-out infinite;
}

.favorites-header-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.125rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.favorites-header-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* ============================================
   TAB NAVIGATION - PILL STYLE
   ============================================ */
.favorites-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.favorites-tab {
    flex: 1;
    padding: 0.625rem 0.5rem;
    border-radius: 12px;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, #404349);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.favorites-tab:hover:not(.active) {
    background: rgba(0, 102, 204, 0.08);
    color: var(--brand-primary, #0066cc);
}

.favorites-tab.active {
    background: linear-gradient(135deg,
        var(--brand-primary, #0066cc),
        var(--brand-primary-dark, #0052a3));
    color: #fff;
    box-shadow: 0 4px 14px var(--shadow-brand, rgba(0, 102, 204, 0.3));
}

/* ============================================
   CONTENT AREA
   ============================================ */
.favorites-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.favorites-content::-webkit-scrollbar {
    width: 4px;
}

.favorites-content::-webkit-scrollbar-track {
    background: transparent;
}

.favorites-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.favorites-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ============================================
   ITEM CARDS - GLASSMORPHISM BASE
   ============================================ */
.favorites-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    margin: 0.375rem 1rem;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.favorites-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 102, 204, 0.15);
}

/* Slide-out animation when removing */
.favorites-item.removing {
    animation: favoritesItemSlideOut 0.35s ease forwards;
}

/* ---- Product Card ---- */
.favorites-item-image {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-tertiary, #f3f4f6);
}

.favorites-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.favorites-item-details {
    flex: 1;
    min-width: 0;
}

.favorites-item-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    margin: 0 0 0.25rem 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.favorites-item-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand-primary, #0066cc);
    margin-bottom: 0.375rem;
}

.favorites-item-price .price-sale {
    color: var(--danger, #dc2626);
}

.favorites-item-price .price-regular {
    color: var(--text-muted, #9ca3af);
    text-decoration: line-through;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.favorites-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.favorites-btn-add-cart {
    padding: 0.4rem 0.875rem;
    background: linear-gradient(135deg,
        var(--brand-primary, #0066cc),
        var(--brand-primary-dark, #0052a3));
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px var(--shadow-brand, rgba(0, 102, 204, 0.25));
    position: relative;
    overflow: hidden;
}

.favorites-btn-add-cart::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.favorites-btn-add-cart:hover::before {
    left: 100%;
}

.favorites-btn-add-cart:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px var(--shadow-brand, rgba(0, 102, 204, 0.35));
}

/* ---- Store Card ---- */
.favorites-item-avatar {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border-secondary, #e5e7eb);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.favorites-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.favorites-store-stars {
    display: flex;
    gap: 2px;
    margin-bottom: 0.25rem;
}

.favorites-store-stars i {
    font-size: 0.75rem;
    color: var(--star-gold, #f59e0b);
    filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.3));
}

.favorites-store-stars i.far {
    color: rgba(0, 0, 0, 0.12);
    filter: none;
}

.favorites-store-meta {
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
    font-weight: 500;
}

/* Follow/unfollow toggle */
.favorites-btn-follow {
    padding: 0.35rem 0.75rem;
    border: 2px solid var(--brand-primary, #0066cc);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    color: var(--brand-primary, #0066cc);
}

.favorites-btn-follow:hover {
    background: linear-gradient(135deg,
        var(--brand-primary, #0066cc),
        var(--brand-primary-dark, #0052a3));
    color: #fff;
    transform: scale(1.05);
}

.favorites-btn-follow.following {
    background: linear-gradient(135deg,
        var(--brand-primary, #0066cc),
        var(--brand-primary-dark, #0052a3));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px var(--shadow-brand, rgba(0, 102, 204, 0.25));
}

/* ---- Article Card ---- */
.favorites-item-thumb {
    width: 70px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-tertiary, #f3f4f6);
}

.favorites-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.favorites-article-category {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    background: rgba(0, 102, 204, 0.08);
    color: var(--brand-primary, #0066cc);
    margin-bottom: 0.375rem;
}

.favorites-item-excerpt {
    font-size: 0.75rem;
    color: var(--text-secondary, #404349);
    line-height: 1.4;
    margin: 0.25rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.favorites-item-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.6875rem;
    color: var(--text-muted, #9ca3af);
    margin-top: 0.25rem;
}

.favorites-item-meta i {
    margin-right: 0.25rem;
}

/* ---- Remove Button ---- */
.favorites-btn-remove {
    background: transparent;
    border: none;
    color: var(--text-muted, #9ca3af);
    font-size: 1.125rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorites-btn-remove:hover {
    color: var(--danger, #dc2626);
    background: rgba(220, 38, 38, 0.08);
    transform: scale(1.15);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.favorites-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    animation: favoritesFadeInUp 0.5s ease;
}

.favorites-empty-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    animation: favoritesHeartPulse 2s ease-in-out infinite;
}

.favorites-empty-icon.products { color: var(--brand-primary, #0066cc); }
.favorites-empty-icon.stores { color: var(--accent-purple, #6366f1); }
.favorites-empty-icon.articles { color: var(--brand-secondary, #00d4ff); }

.favorites-empty-message {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    margin-bottom: 0.375rem;
}

.favorites-empty-sub {
    font-size: 0.8125rem;
    color: var(--text-muted, #9ca3af);
    margin-bottom: 1.25rem;
}

.favorites-btn-cta {
    padding: 0.625rem 1.5rem;
    border: 2px solid var(--brand-primary, #0066cc);
    border-radius: 12px;
    background: transparent;
    color: var(--brand-primary, #0066cc);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.favorites-btn-cta:hover {
    background: linear-gradient(135deg,
        var(--brand-primary, #0066cc),
        var(--brand-primary-dark, #0052a3));
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px var(--shadow-brand, rgba(0, 102, 204, 0.3));
}

/* ============================================
   LOADING STATE
   ============================================ */
.favorites-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.favorites-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 102, 204, 0.12);
    border-top-color: var(--brand-primary, #0066cc);
    border-radius: 50%;
    animation: favoritesSpin 0.8s linear infinite;
    margin-bottom: 1rem;
}

.favorites-loading .loading-text {
    font-size: 0.875rem;
    color: var(--text-muted, #9ca3af);
    font-weight: 500;
}

/* ============================================
   KEYFRAMES
   ============================================ */
@keyframes favoritesBorderShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes favoritesPatternFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-4px) scale(1.02); }
}

@keyframes favoritesHeartGlow {
    0%, 100% {
        text-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
    }
    50% {
        text-shadow: 0 0 16px rgba(255, 255, 255, 0.8), 0 0 24px rgba(0, 212, 255, 0.5);
    }
}

@keyframes favoritesItemSlideOut {
    to {
        opacity: 0;
        transform: translateX(60px);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-top: 0;
        margin-bottom: 0;
        border-width: 0;
    }
}

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

@keyframes favoritesHeartPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.85; }
}

@keyframes favoritesSpin {
    to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
    .favorites-sidebar {
        width: 100vw;
        right: -100vw;
    }

    .favorites-sidebar.active {
        right: 0;
    }

    .favorites-header {
        padding: 1rem 1.25rem;
    }

    .favorites-header-title {
        font-size: 1rem;
    }

    .favorites-tabs {
        padding: 0.75rem 1rem;
        gap: 0.375rem;
    }

    .favorites-tab {
        font-size: 0.75rem;
        padding: 0.5rem 0.375rem;
    }

    .favorites-item {
        padding: 0.875rem 1rem;
        margin: 0.25rem 0.75rem;
    }

    .favorites-item-image {
        width: 60px;
        height: 60px;
    }

    .favorites-item-avatar {
        width: 44px;
        height: 44px;
    }

    .favorites-item-thumb {
        width: 56px;
        height: 48px;
    }

    .favorites-item-title {
        font-size: 0.8125rem;
    }

    .favorites-item-price {
        font-size: 0.9375rem;
    }
}
