﻿.gallery-container {
    position: relative;
}

.product-favorite-button {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 8;
    width: 46px;
    height: 46px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dfe5ec;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    color: #475569;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

    .product-favorite-button:hover,
    .product-favorite-button:focus-visible,
    .product-favorite-button.is-active {
        border-color: #ef4056;
        color: #ef4056;
    }

    .product-favorite-button:hover {
        transform: translateY(-2px);
    }

    .product-favorite-button:focus-visible {
        outline: 3px solid rgba(239, 64, 86, 0.18);
        outline-offset: 2px;
    }

    .product-favorite-button.is-active {
        background: #fff1f3;
    }

    .product-favorite-button:disabled {
        cursor: wait;
        opacity: 0.65;
    }

    .product-favorite-button.is-loading i {
        animation: favorite-heart-pulse 0.75s ease infinite alternate;
    }

    .product-favorite-button .favorite-button-text {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

@keyframes favorite-heart-pulse {
    to {
        transform: scale(1.2);
    }
}

.favorite-toast[hidden] {
    display: none !important;
}

.favorite-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 50000;
    max-width: min(360px, calc(100vw - 32px));
    padding: 12px 17px;
    border-radius: 11px;
    background: #16794b;
    color: #ffffff;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.22);
    font-size: 0.84rem;
    font-weight: 700;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

    .favorite-toast.is-error {
        background: #b42318;
    }

    .favorite-toast.is-visible {
        opacity: 1;
        transform: translateY(0);
    }

body.dark-mode .product-favorite-button {
    border-color: #475569;
    background: rgba(30, 41, 59, 0.96);
    color: #cbd5e1;
}

    body.dark-mode
    .product-favorite-button.is-active {
        border-color: #fb7185;
        background: #4c1d2a;
        color: #fb7185;
    }

@media (max-width: 767px) {
    .product-favorite-button {
        top: 10px;
        left: 10px;
        width: 42px;
        height: 42px;
    }

    .favorite-toast {
        right: 16px;
        bottom: 82px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .product-favorite-button,
    .favorite-toast {
        transition: none !important;
    }

        .product-favorite-button.is-loading i {
            animation: none !important;
        }
}

/* =========================================
   صفحه علاقه‌مندی‌ها
   ========================================= */

.favorite-list-card {
    overflow: hidden;
}

.favorite-list-header {
    min-height: 82px;
}

    .favorite-list-header > div {
        min-width: 0;
    }

    .favorite-list-header p {
        margin: 6px 0 0;
        color: var(--account-muted, #64748b);
        font-size: 0.84rem;
    }

.favorite-products-link {
    min-width: 144px;
    min-height: 42px;
    padding: 8px 14px;
}

.favorite-empty-state {
    min-height: 370px;
    padding: 46px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

    .favorite-empty-state.is-hidden,
    .favorite-product-grid.is-hidden {
        display: none !important;
    }

.favorite-empty-icon {
    width: 82px;
    height: 82px;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff1f3;
    color: #ef4056;
    font-size: 2.15rem;
}

.favorite-empty-state h2 {
    margin: 0;
    color: var(--account-text, #1e293b);
    font-size: 1.05rem;
    font-weight: 800;
}

.favorite-empty-state p {
    margin: 10px 0 22px;
    color: var(--account-muted, #64748b);
    font-size: 0.88rem;
}

.favorite-product-grid {
    padding: 22px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    border-top: 1px solid var(--account-border, #e1e6ec);
}

.favorite-product-card {
    min-width: 0;
    padding: 14px;
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 16px;
    border: 1px solid var(--account-border, #e1e6ec);
    border-radius: 16px;
    background: var(--account-card-bg, #ffffff);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

    .favorite-product-card:hover {
        border-color: #cbd5e1;
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
        transform: translateY(-2px);
    }

.favorite-product-image {
    min-height: 174px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #f8fafc;
    overflow: hidden;
}

    .favorite-product-image img {
        width: 100%;
        height: 174px;
        display: block;
        object-fit: contain;
    }

.favorite-product-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.favorite-product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

    .favorite-product-meta span {
        padding: 3px 8px;
        border-radius: 999px;
        background: #eef3fb;
        color: #224173;
        font-size: 0.68rem;
        font-weight: 700;
    }

.favorite-product-content h2 {
    margin: 10px 0 8px;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.85;
}

    .favorite-product-content h2 a {
        color: var(--account-text, #1e293b);
        text-decoration: none;
    }

        .favorite-product-content h2 a:hover {
            color: var(--account-primary, #224173);
        }

.favorite-product-stock {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
}

    .favorite-product-stock.is-available {
        color: #16794b;
    }

    .favorite-product-stock.is-unavailable {
        color: #b42318;
    }

.favorite-product-price {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.favorite-old-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .favorite-old-price-row del {
        color: #94a3b8;
        font-size: 0.72rem;
    }

    .favorite-old-price-row span {
        padding: 2px 6px;
        border-radius: 999px;
        background: #ef4056;
        color: #ffffff;
        font-size: 0.68rem;
        font-weight: 800;
    }

.favorite-product-price strong {
    margin-top: 3px;
    color: var(--account-text, #1e293b);
    font-size: 0.9rem;
}

.favorite-product-actions {
    margin-top: 12px;
    padding-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid #edf0f4;
}

.favorite-view-product,
.favorite-remove-button {
    min-height: 36px;
    padding: 7px 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 9px;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    text-decoration: none;
}

.favorite-view-product {
    background: #eef3fb;
    color: #224173;
}

    .favorite-view-product:hover {
        background: #224173;
        color: #ffffff;
    }

.favorite-remove-button {
    border: 1px solid #fecdd3;
    background: #fff1f3;
    color: #be123c;
    cursor: pointer;
}

    .favorite-remove-button:hover,
    .favorite-remove-button:focus-visible {
        border-color: #ef4056;
        background: #ef4056;
        color: #ffffff;
        outline: 0;
    }

    .favorite-remove-button:disabled {
        cursor: wait;
        opacity: 0.65;
    }

    .favorite-remove-button.is-loading i {
        animation: favorite-heart-pulse 0.75s ease infinite alternate;
    }

/* دارک مود */

body.dark-mode .favorite-product-card {
    border-color: #334155;
    background: #1e293b;
}

body.dark-mode .favorite-product-image {
    background: #0f172a;
}

body.dark-mode .favorite-product-content h2 a,
body.dark-mode .favorite-product-price strong,
body.dark-mode .favorite-empty-state h2 {
    color: #f8fafc;
}

body.dark-mode .favorite-product-actions {
    border-color: #334155;
}

body.dark-mode .favorite-product-meta span,
body.dark-mode .favorite-view-product {
    background: #334155;
    color: #bfdbfe;
}

/* تبلت */

@media (max-width: 1199px) {
    .favorite-product-grid {
        grid-template-columns: 1fr;
    }
}

/* موبایل */

@media (max-width: 767px) {
    .favorite-list-header {
        align-items: flex-start;
        gap: 14px;
    }

    .favorite-products-link {
        min-width: 0;
    }

    .favorite-product-grid {
        padding: 14px;
    }

    .favorite-product-card {
        grid-template-columns: 116px minmax(0, 1fr);
        gap: 12px;
        padding: 11px;
    }

    .favorite-product-image {
        min-height: 145px;
    }

        .favorite-product-image img {
            height: 145px;
        }

    .favorite-product-content h2 {
        margin-top: 7px;
        font-size: 0.82rem;
    }

    .favorite-product-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .favorite-view-product,
    .favorite-remove-button {
        width: 100%;
    }
}

@media (max-width: 460px) {
    .favorite-list-header {
        flex-direction: column;
    }

    .favorite-products-link {
        width: 100%;
    }

    .favorite-product-card {
        grid-template-columns: 96px minmax(0, 1fr);
    }

    .favorite-product-image,
    .favorite-product-image img {
        min-height: 125px;
        height: 125px;
    }

    .favorite-product-meta span:nth-child(n + 2) {
        display: none;
    }
}