/* ===== Counter widget ===== */

.cws-wishlist-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    line-height: 1;
}

.cws-wishlist-heart {
    width: 24px;
    height: 24px;
    color: inherit;
    fill: currentColor;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    transition: transform 0.15s ease;
}

.cws-wishlist-heart > svg {
    width: 100%;
    height: 100%;
    display: block;
}

.cws-wishlist-icon-wrap:hover .cws-wishlist-heart {
    transform: scale(1.08);
}

.cws-wishlist-count {
    position: absolute;
    top: -6px;
    right: -10px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #e63946;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    box-sizing: border-box;
    display: inline-block;
}

/* ===== Render widget — grid + skeleton ===== */

.cws-wishlist-render {
    width: 100%;
}

.cws-wishlist-grid {
    display: grid;
    grid-template-columns: repeat(var(--cws-wishlist-cols, 4), minmax(0, 1fr));
    gap: 20px;
}

@media (max-width: 1024px) {
    .cws-wishlist-grid { grid-template-columns: repeat(min(var(--cws-wishlist-cols, 4), 3), minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .cws-wishlist-grid { grid-template-columns: repeat(min(var(--cws-wishlist-cols, 4), 2), minmax(0, 1fr)); }
}

@media (max-width: 480px) {
    .cws-wishlist-grid { grid-template-columns: 1fr; }
}

/* ----- List-view modifier ----- */

.cws-wishlist-grid.cws-wishlist-grid--list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cws-wishlist-grid--list .cws-wishlist-card,
.cws-wishlist-grid--list .cws-wishlist-skeleton-card {
    flex-direction: row;
    align-items: center;
    gap: 16px;
}

.cws-wishlist-grid--list .cws-wishlist-card-thumb,
.cws-wishlist-grid--list .cws-skeleton-thumb {
    flex: 0 0 120px;
    width: 120px;
    aspect-ratio: 1 / 1;
}

.cws-wishlist-grid--list .cws-wishlist-card-title { flex: 1 1 auto; }
.cws-wishlist-grid--list .cws-skeleton-line { flex: 1 1 auto; }

.cws-wishlist-grid--list .cws-wishlist-card-cta,
.cws-wishlist-grid--list .cws-skeleton-button {
    margin-left: auto;
    align-self: center;
    flex: 0 0 auto;
    width: auto;
    min-width: 140px;
}

@media (max-width: 480px) {
    .cws-wishlist-grid--list .cws-wishlist-card,
    .cws-wishlist-grid--list .cws-wishlist-skeleton-card {
        flex-direction: column;
        align-items: stretch;
    }
    .cws-wishlist-grid--list .cws-wishlist-card-thumb,
    .cws-wishlist-grid--list .cws-skeleton-thumb {
        flex-basis: auto;
        width: 100%;
    }
    .cws-wishlist-grid--list .cws-wishlist-card-cta { margin-left: 0; width: 100%; }
}

/* ----- Skeleton state ----- */

.cws-wishlist-skeleton-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 6px;
    background: #fff;
}

.cws-skeleton {
    background: linear-gradient(90deg, #ececec 0%, #f7f7f7 50%, #ececec 100%);
    background-size: 200% 100%;
    animation: cws-wishlist-shimmer 1.4s ease-in-out infinite;
    border-radius: 4px;
}

.cws-skeleton-thumb { aspect-ratio: 1 / 1; width: 100%; }
.cws-skeleton-line { height: 14px; width: 100%; }
.cws-skeleton-line-short { width: 60%; }
.cws-skeleton-button { height: 36px; width: 100%; margin-top: 4px; }

@keyframes cws-wishlist-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ----- Hydrated cards ----- */

.cws-wishlist-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 6px;
    background: #fff;
    transition: box-shadow 0.15s ease;
}

.cws-wishlist-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.cws-wishlist-card-thumb {
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 4px;
}

.cws-wishlist-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cws-wishlist-card-title {
    font-size: 15px;
    font-weight: 500;
    color: inherit;
    text-decoration: none;
    line-height: 1.3;
}

.cws-wishlist-card-title:hover {
    text-decoration: underline;
}

.cws-wishlist-card-price {
    font-size: 14px;
    font-weight: 600;
}

.cws-wishlist-card-cta {
    display: inline-block;
    padding: 8px 14px;
    background: #222;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    transition: background 0.15s ease;
}

.cws-wishlist-card-cta:hover {
    background: #444;
}

.cws-wishlist-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: background 0.15s ease;
}

.cws-wishlist-remove:hover {
    background: rgba(0, 0, 0, 0.8);
}

.cws-wishlist-remove-icon {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.cws-wishlist-remove-icon > svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ----- Empty state ----- */

.cws-wishlist-empty-state {
    padding: 40px 16px;
    text-align: center;
    color: #888;
    font-size: 16px;
}

/* ===== Toast ===== */

.cws-wishlist-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #222;
    color: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.cws-wishlist-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Loop heart toggle ===== */

.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
.products .product { position: relative; }

.cws-wishlist-loop-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #555;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.cws-wishlist-loop-toggle:hover {
    transform: scale(1.08);
    color: #e63946;
}

.cws-wishlist-loop-heart {
    width: 18px;
    height: 18px;
    fill: currentColor;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    transition: fill 0.15s ease;
}

.cws-wishlist-loop-heart > svg {
    width: 100%;
    height: 100%;
    display: block;
}

.cws-wishlist-loop-toggle.is-active {
    color: #e63946;
    background: #fff;
}

.cws-wishlist-loop-toggle.is-active .cws-wishlist-loop-heart {
    fill: currentColor;
}

.cws-wishlist-loop-toggle:focus-visible {
    outline: 2px solid #e63946;
    outline-offset: 2px;
}

/* ===== Out-of-stock notice on wishlist cards ===== */

.cws-out-of-stock-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background-color: #f4f4f5;
    color: #1f2937;
    font-size: 13px;
    line-height: 1.4;
}

.cws-out-of-stock-notice-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    line-height: 1;
}

.cws-out-of-stock-notice-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cws-out-of-stock-notice-title {
    font-weight: 600;
}

.cws-wishlist-grid--list .cws-wishlist-card-oos {
    margin-left: auto;
    align-self: center;
    flex: 0 0 auto;
    max-width: 280px;
}
