/* ── Better Wishlists — Frontend ───────────────────────────────── */

:root {
    --wcwl-heart:       #94a3b8;
    --wcwl-heart-active:#ef4444;
    --wcwl-toast-bg:    #1e293b;
    --wcwl-toast-text:  #f8fafc;
    --wcwl-radius:      0.5rem;
    --wcwl-shadow:      0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --wcwl-shadow-lg:   0 4px 12px rgba(0,0,0,.1);
    --wcwl-transition:  200ms ease-out;
    --wcwl-green:       #22c55e;
    --wcwl-red:         #ef4444;
    --wcwl-gray-100:    #f1f5f9;
    --wcwl-gray-200:    #e2e8f0;
    --wcwl-gray-600:    #475569;
    --wcwl-gray-900:    #0f172a;
}

/* ── Heart Button ───────────────────────────────────────────────── */

.wcwl-heart {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
    width: 2.375rem;
    height: 2.375rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(4px);
    box-shadow: var(--wcwl-shadow);
    color: var(--wcwl-heart);
    cursor: pointer;
    transition: transform 180ms cubic-bezier(.34,1.56,.64,1),
                box-shadow 200ms ease-out,
                color 150ms ease;
    -webkit-tap-highlight-color: transparent;
    will-change: transform;
}

.wcwl-heart:hover {
    transform: scale(1.12);
    box-shadow: var(--wcwl-shadow-lg);
    color: var(--wcwl-heart-active);
}
.wcwl-heart:active {
    transform: scale(0.88);
    transition-duration: 80ms;
}

.wcwl-heart:focus-visible {
    outline: 2px solid var(--wcwl-heart-active);
    outline-offset: 2px;
}

.wcwl-heart[aria-pressed="true"] {
    color: var(--wcwl-heart-active);
}

.wcwl-heart[aria-pressed="true"] .wcwl-heart__icon {
    fill: var(--wcwl-heart-active);
    stroke: var(--wcwl-heart-active);
}

.wcwl-heart__icon {
    width: 1.0625rem;
    height: 1.0625rem;
    transition: fill 150ms ease, stroke 150ms ease, transform 150ms ease;
    pointer-events: none;
}
.wcwl-heart:hover .wcwl-heart__icon {
    transform: scale(1.05);
}

/* ── Juicy heart pop — two-stage squash-and-stretch ──────────────── */
@keyframes wcwl-pop {
    0%   { transform: scale(1); }
    15%  { transform: scale(0.7); }             /* squash — compress fast */
    40%  { transform: scale(1.3); }             /* stretch — overshoot big */
    60%  { transform: scale(0.92); }            /* settle bounce */
    80%  { transform: scale(1.05); }            /* tiny overshoot */
    100% { transform: scale(1); }               /* land */
}
.wcwl-heart--animate {
    animation: wcwl-pop 420ms cubic-bezier(.25,.46,.45,.94);
}

/* ── Particle burst on "add" ─────────────────────────────────────── */
.wcwl-heart::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--wcwl-heart-active);
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
}
@keyframes wcwl-ring {
    0%   { opacity: .6; transform: scale(.5); }
    100% { opacity: 0;  transform: scale(1.8); }
}
.wcwl-heart--burst::after {
    animation: wcwl-ring 500ms ease-out forwards;
}

/* ── Micro-bounce on filled state ────────────────────────────────── */
@keyframes wcwl-fill-bounce {
    0%   { transform: scale(1);    fill: transparent; }
    20%  { transform: scale(0.8);  fill: var(--wcwl-heart-active); }
    50%  { transform: scale(1.15); fill: var(--wcwl-heart-active); }
    100% { transform: scale(1);    fill: var(--wcwl-heart-active); }
}
.wcwl-heart--fill-in .wcwl-heart__icon {
    animation: wcwl-fill-bounce 350ms cubic-bezier(.34,1.56,.64,1) forwards;
}

/* Archive: absolute top-right overlay */
.wcwl-heart--archive {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 5;
}

/* PDP: overlay heart on product gallery, top-right */
.wcwl-heart--pdp {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
}

/* Ensure gallery wrapper is a positioning context */
.woocommerce-product-gallery {
    position: relative;
}

/* Ensure product card has relative position for overlay */
.products .product,
ul.products li.product,
.product-card {
    position: relative;
}

/* ── Toast Notification ─────────────────────────────────────────── */

.wcwl-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(0.75rem);
    background: var(--wcwl-toast-bg);
    color: var(--wcwl-toast-text);
    padding: 0.75rem 0.75rem 0.75rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 8px 30px rgba(0,0,0,.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease, transform 200ms ease;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    white-space: nowrap;
}
.wcwl-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.wcwl-toast__icon {
    width: 1.25rem;
    height: 1.25rem;
    fill: var(--wcwl-heart-active);
    flex-shrink: 0;
}

.wcwl-toast__text {
    flex: 1;
}

.wcwl-toast__view,
.wcwl-toast__view:visited,
.wcwl-toast__view:active {
    color: #fff !important;
    text-decoration: none;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    border: 1.5px solid rgba(255,255,255,.25);
    border-radius: 9999px;
    font-size: 0.8125rem;
    transition: border-color 150ms ease, background 150ms ease;
    line-height: 1;
}
.wcwl-toast__view:hover {
    border-color: rgba(255,255,255,.5);
    background: rgba(255,255,255,.1);
}

.wcwl-toast__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(255,255,255,.5);
    font-size: 1.125rem;
    cursor: pointer;
    padding: 0;
    transition: color 150ms ease, background 150ms ease;
    flex-shrink: 0;
    line-height: 1;
}
.wcwl-toast__close:hover {
    color: #fff;
    background: rgba(255,255,255,.1);
}

/* ── My Account — Wishlists ─────────────────────────────────────── */

.wcwl-lists__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.wcwl-lists__header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--wcwl-gray-900);
}

/* Create form */
.wcwl-create-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--wcwl-gray-100);
    border-radius: var(--wcwl-radius);
}
.wcwl-create-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--wcwl-gray-200);
    border-radius: var(--wcwl-radius);
    font-size: 0.875rem;
    transition: border-color var(--wcwl-transition);
}
.wcwl-create-input:focus {
    outline: none;
    border-color: var(--wcwl-heart-active);
    box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

/* Lists table */
.wcwl-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--wcwl-gray-200);
    border-radius: var(--wcwl-radius);
    overflow: hidden;
}
.wcwl-table thead th {
    background: var(--wcwl-gray-100);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wcwl-gray-600);
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--wcwl-gray-200);
}
.wcwl-table tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--wcwl-gray-200);
    font-size: 0.875rem;
    vertical-align: middle;
}
.wcwl-table tbody tr:last-child td {
    border-bottom: none;
}
.wcwl-table tbody tr:hover {
    background: var(--wcwl-gray-100);
}
.wcwl-table a {
    font-weight: 500;
}

/* Badges */
.wcwl-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.6;
}
.wcwl-badge--default {
    background: #dbeafe;
    color: #1e40af;
}
.wcwl-badge--public {
    background: #dcfce7;
    color: #166534;
}
.wcwl-badge--private {
    background: var(--wcwl-gray-100);
    color: var(--wcwl-gray-600);
}
.wcwl-badge--oos {
    background: #fef2f2;
    color: #991b1b;
    margin-top: 0.25rem;
    display: inline-block;
}

/* ── Manage View ────────────────────────────────────────────────── */

.wcwl-manage__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.wcwl-manage__header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}
.wcwl-delete-list {
    color: var(--wcwl-red);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
}
.wcwl-delete-list:hover {
    text-decoration: underline;
}

/* Tabs */
.wcwl-manage__tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--wcwl-gray-200);
    margin-bottom: 1.5rem;
}
.wcwl-tab {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--wcwl-gray-600);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color var(--wcwl-transition), border-color var(--wcwl-transition);
}
.wcwl-tab:hover {
    color: var(--wcwl-gray-900);
}
.wcwl-tab--active {
    color: var(--wcwl-gray-900);
    border-bottom-color: var(--wcwl-heart-active);
}
.wcwl-tab:focus-visible {
    outline: 2px solid var(--wcwl-heart-active);
    outline-offset: -2px;
    border-radius: 2px;
}

.wcwl-tab-content {
    display: none;
}
.wcwl-tab-content--active {
    display: block;
}

/* Bulk bar */
.wcwl-bulk-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--wcwl-gray-100);
    border-radius: var(--wcwl-radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}
.wcwl-bulk-bar label {
    white-space: nowrap;
}
.wcwl-bulk-select {
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--wcwl-gray-200);
    border-radius: var(--wcwl-radius);
    font-size: 0.8125rem;
    background: #fff;
}

/* Items table */
.wcwl-items-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--wcwl-gray-200);
    border-radius: var(--wcwl-radius);
    overflow: hidden;
}
.wcwl-items-table thead th {
    background: var(--wcwl-gray-100);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wcwl-gray-600);
    padding: 0.625rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--wcwl-gray-200);
}
.wcwl-items-table tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--wcwl-gray-200);
    vertical-align: middle;
    font-size: 0.875rem;
}
.wcwl-items-table tbody tr:last-child td {
    border-bottom: none;
}
.wcwl-items-table tbody tr:hover {
    background: var(--wcwl-gray-100);
}

.wcwl-col-check { width: 2rem; text-align: center; }
.wcwl-col-remove { width: 2rem; text-align: center; }
.wcwl-col-image { width: 4rem; }
.wcwl-col-image img {
    width: 3.5rem;
    height: 3.5rem;
    object-fit: cover;
    border-radius: 0.375rem;
    border: 1px solid var(--wcwl-gray-200);
}

.wcwl-remove-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--wcwl-gray-600);
    font-size: 1.125rem;
    cursor: pointer;
    transition: all var(--wcwl-transition);
}
.wcwl-remove-item:hover {
    background: #fef2f2;
    color: var(--wcwl-red);
}
.wcwl-remove-item:focus-visible {
    outline: 2px solid var(--wcwl-red);
    outline-offset: 1px;
}

.wcwl-qty {
    width: 3.5rem;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--wcwl-gray-200);
    border-radius: var(--wcwl-radius);
    font-size: 0.875rem;
    text-align: center;
    transition: border-color var(--wcwl-transition);
}
.wcwl-qty:focus {
    outline: none;
    border-color: var(--wcwl-heart-active);
    box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

.wcwl-manage__footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* Settings form */
.wcwl-settings-form label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--wcwl-gray-900);
}
.wcwl-settings-form input[type="text"] {
    width: 100%;
    max-width: 24rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--wcwl-gray-200);
    border-radius: var(--wcwl-radius);
    font-size: 0.875rem;
    transition: border-color var(--wcwl-transition);
}
.wcwl-settings-form input[type="text"]:focus {
    outline: none;
    border-color: var(--wcwl-heart-active);
    box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}
.wcwl-settings-form input[type="radio"] {
    accent-color: var(--wcwl-heart-active);
}

.wcwl-share-url-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.wcwl-share-url {
    flex: 1;
    min-width: 12rem;
    background: var(--wcwl-gray-100) !important;
    color: var(--wcwl-gray-600);
}
.wcwl-copy-url {
    white-space: nowrap;
}

/* ── Move Item Button ──────────────────────────────────────────── */

.wcwl-col-remove {
    white-space: nowrap;
}
.wcwl-move-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--wcwl-gray-600);
    cursor: pointer;
    transition: all var(--wcwl-transition);
    vertical-align: middle;
}
.wcwl-move-item:hover {
    background: #dbeafe;
    color: #1e40af;
}
.wcwl-move-item:focus-visible {
    outline: 2px solid #1e40af;
    outline-offset: 1px;
}
.wcwl-move-item svg {
    pointer-events: none;
}

/* ── List Picker (centered card modal) ─────────────────────────── */

.wcwl-picker-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .3);
    backdrop-filter: blur(2px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: wcwl-fade-in 180ms ease-out;
}

.wcwl-picker {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 20px 60px rgba(0,0,0,.15), 0 0 0 1px rgba(0,0,0,.05);
    min-width: 15rem;
    max-width: 20rem;
    width: 90vw;
    overflow: hidden;
    animation: wcwl-picker-in 280ms cubic-bezier(.34, 1.56, .64, 1);
    transform-origin: center;
}

.wcwl-picker__header {
    padding: 0.875rem 1rem 0.625rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--wcwl-gray-600);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wcwl-picker__list {
    list-style: none;
    margin: 0;
    padding: 0 0.5rem 0.5rem;
}

.wcwl-picker__item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    border-radius: var(--wcwl-radius);
    cursor: pointer;
    transition: background 120ms ease;
    font-size: 0.875rem;
    color: var(--wcwl-gray-900);
    user-select: none;
}
.wcwl-picker__item:hover {
    background: var(--wcwl-gray-100);
}

.wcwl-picker__check {
    position: relative;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--wcwl-gray-200);
    border-radius: 0.3125rem;
    background: #fff;
    flex-shrink: 0;
    transition: all 150ms cubic-bezier(.34, 1.56, .64, 1);
}
.wcwl-picker__check--active {
    background: var(--wcwl-heart-active);
    border-color: var(--wcwl-heart-active);
}
.wcwl-picker__check--active::after {
    content: '';
    position: absolute;
    left: 3.5px;
    top: 0.5px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Bounce on toggle */
@keyframes wcwl-check-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}
.wcwl-picker__check--pop {
    animation: wcwl-check-pop 250ms cubic-bezier(.34, 1.56, .64, 1);
}

.wcwl-picker__title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wcwl-picker__badge {
    font-size: 0.6875rem;
    color: var(--wcwl-gray-600);
    background: var(--wcwl-gray-100);
    padding: 0.0625rem 0.375rem;
    border-radius: 9999px;
    flex-shrink: 0;
}

@keyframes wcwl-picker-in {
    0%   { opacity: 0; transform: scale(.92); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes wcwl-fade-in {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}
.wcwl-picker-backdrop--out {
    animation: wcwl-fade-out 150ms ease-out forwards;
}
.wcwl-picker-backdrop--out .wcwl-picker {
    animation: wcwl-picker-out 150ms ease-out forwards;
}
@keyframes wcwl-fade-out {
    to { opacity: 0; }
}
@keyframes wcwl-picker-out {
    to { opacity: 0; transform: scale(.95); }
}

/* ── Move Dropdown (anchored) ──────────────────────────────────── */

.wcwl-move-dropdown {
    position: absolute;
    z-index: 10001;
    background: #fff;
    border-radius: 0.625rem;
    box-shadow: 0 12px 40px rgba(0,0,0,.14), 0 0 0 1px rgba(0,0,0,.05);
    min-width: 11rem;
    overflow: hidden;
    animation: wcwl-dropdown-in 200ms cubic-bezier(.34, 1.56, .64, 1);
    transform-origin: top left;
}

.wcwl-move-dropdown__header {
    padding: 0.625rem 0.875rem 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--wcwl-gray-600);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wcwl-move-dropdown__item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.875rem;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.875rem;
    color: var(--wcwl-gray-900);
    cursor: pointer;
    transition: background 100ms ease;
}
.wcwl-move-dropdown__item:hover {
    background: #dbeafe;
    color: #1e40af;
}
.wcwl-move-dropdown__item:last-child {
    margin-bottom: 0.375rem;
}

@keyframes wcwl-dropdown-in {
    0%   { opacity: 0; transform: scale(.9) translateY(-4px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Toast enhancements ────────────────────────────────────────── */

.wcwl-toast-link {
    color: rgba(255,255,255,.7);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    margin-left: 0.25rem;
    transition: color 120ms ease;
}
.wcwl-toast-link:hover {
    color: #fff;
}

/* ── Row slide-out animation ───────────────────────────────────── */

@keyframes wcwl-slide-right {
    0%   { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(2rem); }
}
.wcwl-row--moving {
    animation: wcwl-slide-right 250ms ease-out forwards;
}

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .wcwl-lists__header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    .wcwl-create-form {
        flex-direction: column;
    }
    .wcwl-bulk-bar {
        flex-wrap: nowrap;
        font-size: 0.8125rem;
        gap: 0.5rem;
    }
    .wcwl-bulk-bar label {
        font-size: 0;
    }
    .wcwl-bulk-bar label input {
        font-size: 0.8125rem;
    }
    .wcwl-bulk-apply {
        white-space: nowrap;
    }
    .wcwl-manage__header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    /* Card layout for items table on mobile */
    .wcwl-items-table thead { display: none; }
    .wcwl-items-table,
    .wcwl-items-table tbody { display: block; }
    .wcwl-items-table tbody tr {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto;
        gap: 0.25rem 0.75rem;
        padding: 0.75rem;
        border-bottom: 1px solid var(--wcwl-gray-200);
        align-items: center;
    }
    .wcwl-items-table tbody tr:last-child { border-bottom: none; }
    .wcwl-items-table tbody td {
        padding: 0;
        border-bottom: none;
    }

    /* Image: left column, spans both rows */
    .wcwl-items-table .wcwl-col-image {
        grid-row: 1 / 3;
        grid-column: 1;
        width: auto;
    }
    .wcwl-items-table .wcwl-col-image img {
        width: 3rem;
        height: 3rem;
    }

    /* Checkbox: hidden, use remove button only */
    .wcwl-items-table .wcwl-col-check { display: none; }

    /* Remove button: top-right */
    .wcwl-items-table .wcwl-col-remove {
        grid-row: 1;
        grid-column: 3;
        width: auto;
    }

    /* Product name + badge: top-center */
    .wcwl-items-table td:nth-child(4) {
        grid-row: 1;
        grid-column: 2;
    }

    /* Price + qty + cart button: bottom row */
    .wcwl-items-table td:nth-child(5),
    .wcwl-items-table td:nth-child(6),
    .wcwl-items-table td:nth-child(7) {
        grid-row: 2;
    }
    .wcwl-items-table td:nth-child(5) { grid-column: 2; }
    .wcwl-items-table td:nth-child(6) { grid-column: 3; }
    .wcwl-items-table td:nth-child(7) {
        grid-row: 3;
        grid-column: 1 / -1;
    }

    /* Full-width add-all button */
    .wcwl-add-all-to-cart { width: 100%; }
}
