/* ===================================
   Favorites Page Styles
   =================================== */

.favorites-page {
    background: var(--color-bg-alt);
    min-height: 100vh;
}

/* Hero Section */
.favorites-hero {
    text-align: center;
    padding: 60px 0 40px;
}

.favorites-hero h1 {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 16px;
    color: var(--color-text);
}

.favorites-count-text {
    font-size: 1.1rem;
    color: var(--color-text-light);
}

.favorites-count-text span {
    font-weight: 700;
    color: var(--color-primary);
}

/* Empty State */
.favorites-empty {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: var(--radius-lg);
    max-width: 500px;
    margin: 0 auto;
    box-shadow: var(--shadow-sm);
}

@keyframes pulseHeart {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 0.5;
    }
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 24px;
    opacity: 0.5;
    display: inline-block;
    animation: pulseHeart 3s ease-in-out infinite;
}

.favorites-empty h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--color-text);
}

.favorites-empty p {
    color: var(--color-text-light);
    margin-bottom: 32px;
    line-height: 1.6;
}

/* Loading State */
.favorites-loading {
    text-align: center;
    padding: 80px 20px;
}

.favorites-loading .spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.favorites-loading p {
    color: var(--color-text-light);
    font-size: 1rem;
}

/* Products Grid */
.favorites-page .products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-top: 40px;
    margin-bottom: 80px;
}

@media (max-width: 1024px) {
    .favorites-page .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 600px) {
    .favorites-page .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .favorites-page .products-grid {
        gap: 8px;
    }
}

@media (max-width: 360px) {
    .favorites-page .products-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Remove Button */
.remove-favorite {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    font-size: 18px;
    color: var(--color-text-muted);
    transition: all 0.2s;
}

.remove-favorite:hover {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
    transform: scale(1.1);
}

/* Favorites Counter Badge in Header */
.favorites-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--color-primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Button Styles */
.btn-deal-action {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: var(--color-primary);
    color: white;
    text-align: center;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-deal-action:hover {
    background: var(--color-primary-dark);
}

/* Deal Prices */
.deal-prices {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.deal-savings {
    font-size: 0.85rem;
    font-weight: 600;
    color: #27ae60;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.deal-savings::before {
    content: '💰';
    font-size: 1rem;
}

/* Stats Cards */
.favorites-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 32px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--color-text-light);
    font-weight: 500;
}

/* Empty State Actions */
.empty-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.empty-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Toolbar */
.favorites-toolbar {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    flex: 1;
}

.toolbar-right {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
}

.toolbar-select {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 0.9rem;
    color: var(--color-text);
    cursor: pointer;
    transition: border-color 0.2s;
    min-width: 150px;
}

.toolbar-select:hover {
    border-color: var(--color-primary);
}

.toolbar-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--color-text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: var(--color-bg-alt);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.toolbar-btn-danger {
    color: #e74c3c;
}

.toolbar-btn-danger:hover {
    background: #e74c3c;
    border-color: #e74c3c;
    color: white;
}

.toolbar-btn svg {
    flex-shrink: 0;
}

/* No Results */
.favorites-no-results {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 24px;
    opacity: 0.5;
}

.favorites-no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--color-text);
}

.favorites-no-results p {
    color: var(--color-text-light);
    margin-bottom: 24px;
}

/* Share Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-light);
    transition: color 0.2s;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--color-text);
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    margin-bottom: 16px;
    color: var(--color-text);
}

.share-link-container {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.share-link-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--color-bg-alt);
}

.share-info {
    padding: 12px;
    background: var(--color-bg-alt);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-bottom: 0 !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .favorites-hero {
        padding: 40px 0 30px;
    }

    .favorites-hero h1 {
        font-size: 2rem;
    }

    .favorites-empty {
        padding: 60px 20px;
    }

    .favorites-page .products-grid {
        gap: 12px;
    }

    .favorites-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-icon {
        font-size: 2rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
    }

    .toolbar-select {
        min-width: 120px;
        flex: 1;
    }

    .toolbar-btn .btn-text {
        display: none;
    }

    .toolbar-right {
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .favorites-page .products-grid {
        gap: 8px;
    }

    .remove-favorite {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    .empty-actions {
        flex-direction: column;
        width: 100%;
    }

    .empty-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .toolbar-group {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-select {
        width: 100%;
    }
}