/* ==========================================================
   WISHLIST - Drawer, Animation, Page
   ========================================================== */

/* מניעת גלילה כשה-drawer פתוח */
body.tp-no-scroll { overflow: hidden; }

/* ---------- Badge ---------- */
.wishlist-count-badge.is-empty {
    opacity: 0;
    visibility: hidden;
    transform: scale(0);
}
.wishlist-count-badge {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
}
.wishlist-count-badge.pulse {
    animation: wishlistBadgePulse 0.6s ease;
}
@keyframes wishlistBadgePulse {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.5); background: var(--color-gold); }
    100% { transform: scale(1); }
}

/* ---------- Heart Button - Active State ---------- */
.js-wishlist-toggle {
    transition: all 0.2s ease;
}
.js-wishlist-toggle.active svg {
    fill: var(--color-rose-deep);
    stroke: var(--color-rose-deep);
    animation: heartBurst 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* גלריה - הלב הגדול בעמוד מוצר */
.gallery-wishlist.active {
    background: linear-gradient(135deg, var(--color-rose) 0%, var(--color-rose-deep) 100%) !important;
    color: white !important;
}
.gallery-wishlist.active svg {
    fill: currentColor;
    stroke: currentColor;
    animation: heartBurst 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes heartBurst {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* ---------- Flying Heart ---------- */
.wishlist-flyer {
    position: fixed;
    width: 28px;
    height: 28px;
    color: var(--color-rose-deep);
    z-index: 10000;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 1;
    transition: top 0.8s cubic-bezier(0.55, -0.1, 0.4, 1),
                left 0.8s cubic-bezier(0.55, -0.1, 0.4, 1),
                transform 0.8s cubic-bezier(0.55, -0.1, 0.4, 1),
                opacity 0.7s ease-in;
    filter: drop-shadow(0 2px 8px rgba(196, 139, 139, 0.5));
}
.wishlist-flyer svg { width: 100%; height: 100%; }

/* ==========================================================
   DRAWER
   ========================================================== */
.wishlist-overlay {
    position: fixed;
    inset: 0;
    background: rgba(61, 79, 57, 0.4);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
    backdrop-filter: blur(3px);
}
.wishlist-overlay.open { opacity: 1; visibility: visible; }

.wishlist-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    background: var(--color-cream);
    box-shadow: -10px 0 40px rgba(61, 79, 57, 0.15);
    z-index: 1000;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                visibility 0s linear 0.35s;
    display: flex;
    flex-direction: column;
    will-change: transform;
}
.wishlist-drawer.open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                visibility 0s linear 0s;
}

.wishlist-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(61, 79, 57, 0.08);
    background: white;
}
.wishlist-drawer-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--color-forest);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.wishlist-drawer-title svg { width: 22px; height: 22px; color: var(--color-rose-deep); }
.wishlist-drawer-close {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--color-cream);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-forest);
    transition: all 0.2s;
}
.wishlist-drawer-close:hover { background: var(--color-sage); color: white; transform: rotate(90deg); }
.wishlist-drawer-close svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

.wishlist-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Empty state */
.wishlist-drawer-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--color-forest);
}
.wishlist-drawer-empty svg {
    width: 80px; height: 80px;
    color: var(--color-rose-light);
    margin: 0 auto 1rem;
    display: block;
}
.wishlist-drawer-empty h4 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin: 0 0 0.5rem;
    color: var(--color-forest);
}
.wishlist-drawer-empty p {
    font-size: 0.9rem;
    color: var(--color-sage);
    margin: 0 0 1.5rem;
    line-height: 1.6;
}

.wishlist-drawer-loading {
    text-align: center;
    padding: 3rem;
    color: var(--color-sage);
}

/* Items list */
.wishlist-drawer-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.wishlist-drawer-item {
    display: flex;
    gap: 1rem;
    background: white;
    border-radius: 16px;
    padding: 0.8rem;
    box-shadow: 0 2px 10px rgba(61, 79, 57, 0.04);
    transition: all 0.3s ease;
    align-items: center;
}
.wishlist-drawer-item:hover {
    box-shadow: 0 6px 20px rgba(61, 79, 57, 0.08);
    transform: translateY(-2px);
}
.wishlist-item-img-link { flex-shrink: 0; }
.wishlist-item-img {
    width: 70px;
    height: 70px;
    border-radius: 12px;
    object-fit: cover;
    display: block;
}
.wishlist-item-info { flex: 1; min-width: 0; }
.wishlist-item-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-forest);
    text-decoration: none;
    margin-bottom: 0.3rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wishlist-item-name:hover { color: var(--color-sage); }
.wishlist-item-price {
    font-family: var(--font-price);
    font-size: 0.95rem;
    color: var(--color-sage-dark);
    font-weight: 600;
}
.wishlist-item-price del { opacity: 0.5; font-weight: 400; margin-right: 0.3rem; font-size: 0.8rem; }
.wishlist-item-price ins { background: none; text-decoration: none; color: var(--color-rose-deep); font-weight: 700; }

.wishlist-item-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-shrink: 0;
}
.wishlist-item-cart, .wishlist-item-remove {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
}
.wishlist-item-cart {
    background: var(--color-sage);
    color: white;
}
.wishlist-item-cart:hover { background: var(--color-sage-dark); transform: scale(1.1); }
.wishlist-item-cart.loading { opacity: 0.6; pointer-events: none; }
.wishlist-item-cart.added { background: var(--color-gold); }
.wishlist-item-cart svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.5; }

.wishlist-item-remove {
    background: transparent;
    color: var(--color-sage);
}
.wishlist-item-remove:hover { background: rgba(196, 139, 139, 0.1); color: var(--color-rose-deep); transform: scale(1.1); }
.wishlist-item-remove svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* Footer */
.wishlist-drawer-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(61, 79, 57, 0.08);
}
.wishlist-view-all {
    display: block;
    text-align: center;
    width: 100%;
    background: var(--color-forest);
    color: white;
    border-radius: 30px;
    padding: 0.85rem 1.5rem;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}
.wishlist-view-all:hover {
    background: var(--color-sage-dark);
    color: white;
    transform: translateY(-2px);
}

/* ==========================================================
   WISHLIST PAGE (shortcode)
   ========================================================== */
.tp-wishlist-page {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.wishlist-loading-state {
    text-align: center;
    padding: 3rem;
    color: var(--color-sage);
}

.wishlist-empty-page {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 20px;
    max-width: 600px;
    margin: 2rem auto;
}
.wishlist-empty-page svg {
    width: 100px; height: 100px;
    color: var(--color-rose-light);
    margin: 0 auto 1.5rem;
    display: block;
}
.wishlist-empty-page h3 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--color-forest);
    margin: 0 0 0.8rem;
}
.wishlist-empty-page p {
    color: var(--color-sage);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 2rem;
}

.wishlist-products-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    padding: 0;
    margin: 0;
}
.wishlist-products-grid .wishlist-item {
    position: relative;
    margin: 0;
    list-style: none;
}

/* כפתור הסרה בפינה של הכרטיס (על עמוד המועדפים) */
.wishlist-remove-card {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    z-index: 8;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    color: var(--color-forest);
    transition: all 0.2s;
}
.wishlist-remove-card:hover {
    background: var(--color-rose-deep);
    color: white;
    transform: rotate(90deg) scale(1.1);
}
.wishlist-remove-card svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

@media (max-width: 1024px) {
    .wishlist-products-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
}
@media (max-width: 768px) {
    .wishlist-drawer { width: 100vw; }
    .wishlist-products-grid { grid-template-columns: 1fr; max-width: 380px; margin: 0 auto; }
    .wishlist-drawer-item { padding: 0.6rem; gap: 0.8rem; }
    .wishlist-item-img { width: 60px; height: 60px; }
}
