/* =========================================================
   BPRShop Favorites - Header heart button + dropdown panel.
   Mirrors compare-header-btn.css; teal accent (#5bc0de) to match cart/compare.
   ========================================================= */

/* =========================================================
   HEADER FAVORITES BUTTON - borderless icon-only, mirrors cart
   ========================================================= */
#bpr-fav-header-btn {
    display: none; /* shown only once JS moves it into .sale-basket (avoids a flash at page bottom) */
    align-items: center;
    justify-content: center;
    gap: 0;
    background: transparent !important;
    background-color: transparent !important;
    color: #1f2937 !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0;
    margin: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none !important;
    direction: rtl;
    vertical-align: middle;
    line-height: 1;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
    position: relative;
    z-index: 5;
}
/* Shown only when the favorites list has 1+ items (JS adds .visible) */
#bpr-fav-header-btn.visible { display: inline-flex; }
#bpr-fav-header-btn:hover,
#bpr-fav-header-btn:focus {
    background: rgba(15, 23, 42, 0.08) !important;
    color: #0f1c2e !important;
    text-decoration: none !important;
    outline: none;
}
#bpr-fav-header-btn:active { transform: scale(0.94); }
#bpr-fav-header-btn svg.bpr-fav-icon {
    width: 22px;
    height: 22px;
    fill: none;                 /* outline heart, not a solid black fill */
    stroke: currentColor;
    stroke-width: 2px;
    stroke-linejoin: round;
    stroke-linecap: round;
    vertical-align: -0.125em;
}
/* Floating count - RED Persian digit at the top corner (matches cart/compare) */
#bpr-fav-header-btn .bpr-fav-badge {
    position: absolute;
    top: -2px;
    left: -2px;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
    min-width: 0;
    width: auto;
    height: auto;
    border-radius: 0;
    color: #dc2626;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
    text-align: left;
    display: inline-block;
    text-shadow: 0 0 2px rgba(255, 255, 255, 1), 0 0 4px rgba(255, 255, 255, 0.85), 0 0 6px rgba(255, 255, 255, 0.6);
    direction: ltr;
    z-index: 2;
}

/* =========================================================
   DROPDOWN PANEL (desktop dropdown + mobile bottom-sheet)
   ========================================================= */
#bpr-fav-panel,
#bpr-fav-panel * {
    font-family: byekan, iranyekan, BYekan1, Tahoma, sans-serif;
}
#bpr-fav-panel {
    display: none;
    position: fixed;
    width: 340px;
    max-width: calc(100vw - 16px);
    background: #ffffff;
    color: #1f2937;
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22), 0 4px 14px rgba(15, 23, 42, 0.08);
    z-index: 99999;
    direction: rtl;
    text-align: right;
    overflow: hidden;
}
#bpr-fav-panel.open { display: block !important; animation: bprFavDrop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes bprFavDrop {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Header bar */
.bpr-fav-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: linear-gradient(135deg, #f8fbff 0%, #eef7fc 100%);
    border-bottom: 1px solid #e6eef5;
}
.bpr-fav-panel-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #334155;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.bpr-fav-panel-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    margin-left: 4px;
    border-radius: 12px;
    background: #5bc0de;
    color: #fff;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1;
}

/* Items list */
.bpr-fav-panel-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 6px 0;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.bpr-fav-panel-list::-webkit-scrollbar { width: 6px; }
.bpr-fav-panel-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.bpr-fav-panel-list::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.bpr-fav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #f3f5f8;
    transition: background 0.15s;
    animation: bprFavItemIn 0.22s ease-out both;
}
@keyframes bprFavItemIn {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: translateX(0); }
}
.bpr-fav-item:last-child { border-bottom: none; }
.bpr-fav-item:hover { background: #f7fafc; }

.bpr-fav-item-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none !important;
    color: #1f2937 !important;
    min-width: 0;
}
.bpr-fav-item-link img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #eef1f5;
    padding: 3px;
    flex-shrink: 0;
    transition: transform 0.18s, border-color 0.18s;
}
.bpr-fav-item-link:hover img {
    transform: scale(1.05);
    border-color: #5bc0de;
}
.bpr-fav-item-name {
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.5;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    transition: color 0.15s;
}
.bpr-fav-item-link:hover .bpr-fav-item-name { color: #0fa89f !important; }

.bpr-fav-item-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f3f5f8;
    border: 0;
    color: #94a3b8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, transform 0.2s;
}
.bpr-fav-item-remove:hover {
    background: #fee2e2;
    color: #dc2626;
    transform: rotate(90deg) scale(1.05);
}

/* Empty state */
.bpr-fav-empty {
    text-align: center;
    padding: 36px 18px 30px;
    color: #94a3b8;
}
.bpr-fav-empty svg.bpr-fav-icon {
    width: 44px;
    height: 44px;
    color: #cbd5e1;
    margin-bottom: 12px;
}
.bpr-fav-empty p {
    margin: 0 0 4px;
    font-size: 13.5px;
    font-weight: 700;
    color: #475569;
}
.bpr-fav-empty span { font-size: 11.5px; color: #94a3b8; }

/* Footer / CTA */
.bpr-fav-panel-footer {
    padding: 12px 14px;
    border-top: 1px solid #eef1f5;
    background: #fafbfd;
}
.bpr-fav-go {
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px 14px;
    background: linear-gradient(135deg, #5bc0de 0%, #31b0d5 100%);
    color: #fff !important;
    border: 0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none !important;
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(91, 192, 222, 0.30);
}
.bpr-fav-go:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(91, 192, 222, 0.45);
    color: #fff !important;
}

/* =========================================================
   MOBILE - smaller circle + bottom-sheet panel
   ========================================================= */
@media (max-width: 640px) {
    /* Keep the heart hidden on mobile until the list has 1+ items */
    #bpr-fav-header-btn:not(.visible) { display: none !important; }

    .sale-basket-panel-control,
    #bpr-fav-header-btn {
        width: 36px !important;
        height: 36px !important;
    }
    #bpr-fav-header-btn svg.bpr-fav-icon {
        width: 20px !important;
        height: 20px !important;
    }
    #bpr-fav-panel {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -14px 36px rgba(15, 23, 42, 0.25);
        z-index: 99999;
        padding-top: 12px;
    }
    #bpr-fav-panel::before {
        content: "";
        display: block;
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 42px;
        height: 4px;
        border-radius: 2px;
        background: #d8dee6;
    }
    body.bpr-fav-open::after {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 99998;
    }

    /* Temporarily fade out the Goftino chat widget (#goftino_w iframe, z-index ~2e9)
       while the favorites / compare / basket bottom-sheet is open, so it doesn't overlap them. */
    body.bpr-fav-open #goftino_w,
    body.bpr-cmp-open #goftino_w,
    body.bpr-bsk-open #goftino_w,
    body.bpr-fav-open .box-widget-icon,
    body.bpr-cmp-open .box-widget-icon,
    body.bpr-bsk-open .box-widget-icon {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }
}
