/* ===== 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;
    justify-content: space-between;
}

.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;
}

/* kit-armour-ignore: this is a <span> in the wishlist widget (JS :135), which
   the kit's button rule cannot match. It is only ever a <button> in My Account
   (woomyaccount.php:2690), where it always also carries .acc-wish-remove, and
   that class pins background-color with !important. The defence is real but
   lives on the other class of the same element, which a per-class audit cannot
   see. */
.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;
}

/* The bundled heart SVG hard-codes stroke="#000000" and fill="none" as
   presentation attributes. A `fill` set on the wrapper span only INHERITS
   into the svg — and inheritance loses to the svg's own attributes, so the
   active state was invisible on the stock-loop variant (the Soft Card works
   because its CSS targets the svg element directly). Target the svg + path
   themselves: element-level CSS beats presentation attributes. */
.cws-wishlist-loop-toggle.is-active .cws-wishlist-loop-heart svg {
    fill: currentColor;
}

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

.cws-wishlist-loop-toggle:hover .cws-wishlist-loop-heart svg path {
    stroke: 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;
}

/* Remove button inside .acc-wish-row (my account widget wishlist).
   Must override .cws-wishlist-remove { position: absolute } from the base rule. */
.acc-wish-remove {
    position: static;
    top: auto;
    right: auto;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: #FFFFFF00 !important;
    color: #e63946;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    align-self: center;
    flex-shrink: 0;
}

.acc-wish-remove .cws-wishlist-remove-icon svg path {
    stroke: #e63946;
}

.acc-wish-remove:hover {
    background: rgba(230, 57, 70, 0.1);
}

/* In list view the remove button leaves the absolute flow and becomes the
   leftmost flex child — position: static + order: -1 puts it before the
   thumbnail regardless of DOM order, and we colour it red. */
.cws-wishlist-grid--list .cws-wishlist-remove {
    position: static;
    order: -1;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    align-self: center;
    background: #e63946;
    top: auto;
    right: auto;
}

.cws-wishlist-grid--list .cws-wishlist-remove:hover {
    background: #c0392b;
}

/* ============================================================
 * Specificity armour — Elementor kit button and link styling
 * ============================================================
 *
 * The kit ships `.elementor-kit-N button { background-color: …; color: … }` and
 * `.elementor-kit-N a { color: … }` — one class plus one element, (0,1,1),
 * which beats every single-class rule above (0,1,0).
 *
 * Element kind decides what is actually at risk, and it is not uniform here:
 *   - .cws-wishlist-card-title / .cws-wishlist-card-cta are <a> (wishlist JS
 *     :142 and :118), so only `color` is exposed — the dark CTA pill keeps its
 *     background, because the kit sets none on links.
 *   - .cws-wishlist-remove is a <span> in the widget (wishlist JS :135), which
 *     the kit cannot touch at all. It is only a <button> in My Account, where
 *     it ALWAYS also carries .acc-wish-remove — so that compound is the thing
 *     to defend, and its background is already pinned with !important there.
 *   - .cws-wishlist-loop-toggle is a real <button> on WooCommerce loop cards,
 *     so both background and colour need re-asserting.
 *
 * These use a second class on the SAME element rather than an ancestor. Both
 * controls are rendered into markup this stylesheet does not own — the loop
 * toggle by a WooCommerce hook, the remove button by the My Account widget — so
 * anchoring to a parent would be a guess about someone else's DOM.
 */

.cws-wishlist-card .cws-wishlist-card-title {
    color: inherit;
}

.cws-wishlist-card .cws-wishlist-card-cta {
    color: #fff;
}

.cws-wishlist-remove.acc-wish-remove {
    color: #e63946;
}

.cws-wishlist-loop-toggle.cws-wishlist-toggle {
    background: rgba(255, 255, 255, 0.92);
    color: #555;
}

.cws-wishlist-loop-toggle.cws-wishlist-toggle:hover {
    color: #e63946;
}

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