/* ==========================================================================
   WISHLIST PAGE
   ========================================================================== */

/* Header row: title+subtitle on left, clear-all button on right */
.wishlist-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.wishlist-header-actions {
    display: flex;
    gap: var(--space-xs, 0.5rem);
    align-self: center;
    flex-shrink: 0;
}

/* "Læg alle i kurv" — filled primary action, sits first in the header actions */
.wishlist-add-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    min-height: 36px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #FBFAF5;
    background: var(--sbv2-ink, #111111);
    border: 1px solid var(--sbv2-ink, #111111);
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, opacity 0.15s;
}

.wishlist-add-all-btn:hover {
    background: #1F1F1B;
}

.wishlist-add-all-btn:focus-visible {
    outline: 2px solid var(--sbv2-ink, #111111);
    outline-offset: 2px;
    border-radius: var(--radius-md);
}

.wishlist-add-all-btn[disabled] {
    opacity: 0.6;
    cursor: default;
}

/* "Del ønskeliste" — neutral secondary button, sits beside clear-all */
.wishlist-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    min-height: 36px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--sbv2-ink, #111111);
    background: none;
    border: 1px solid var(--sbv2-line-strong, #CCCCCC);
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.wishlist-share-btn:hover {
    background: var(--sbv2-line, #f2f2f2);
}

.wishlist-share-btn:focus-visible {
    outline: 2px solid var(--sbv2-ink, #111111);
    outline-offset: 2px;
    border-radius: var(--radius-md);
}

/* "Ryd ønskeliste" — muted destructive secondary button */
.wishlist-clear-all {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    min-height: 36px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--sbv2-muted, #666666);
    background: none;
    border: 1px solid var(--sbv2-line-strong, #CCCCCC);
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    align-self: center;
    flex-shrink: 0;
}

.wishlist-clear-all:hover {
    color: var(--sbv2-rust, #c0392b);
    border-color: #e8b4b0;
    background: var(--sbv2-rust-soft, #fdf4f3);
}

.wishlist-clear-all--confirming {
    color: var(--sbv2-rust, #c0392b);
    border-color: var(--sbv2-rust, #c0392b);
    background: var(--sbv2-rust-soft, #fdf4f3);
    font-weight: 600;
}

.wishlist-clear-all:focus-visible {
    outline: 2px solid var(--sbv2-ink, #111111);
    outline-offset: 2px;
    border-radius: var(--radius-md);
}

@media (prefers-reduced-motion: reduce) {
    .wishlist-clear-all,
    .wishlist-share-btn,
    .wishlist-add-all-btn {
        transition: none;
    }
}

.wishlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-lg);
}

.wishlist-item {
    position: relative;
    background: var(--sbv2-paper, #FFFFFF);
    border: 1px solid var(--sbv2-line, #E0E0E0);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow var(--duration) var(--ease);
    display: flex;
    flex-direction: column;
}

.wishlist-item:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.wishlist-item-image {
    display: block;
    aspect-ratio: 1;
    background: var(--sbv2-tint, #EEEEEE);
}

.wishlist-item-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Focus ring on the product image link — matches card focus treatment */
.wishlist-item-image:focus-visible {
    outline: 2px solid var(--sbv2-ink, #111111);
    outline-offset: 2px;
}

.wishlist-item-info {
    padding: var(--space-sm) var(--space-md) var(--space-md);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wishlist-item-info h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: var(--space-xs);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 2.8em;
}

.wishlist-item-info h3 a {
    color: var(--sbv2-ink, #111111);
}

.wishlist-item-info h3 a:hover {
    text-decoration: underline;
}

.wishlist-item-info h3 a:focus-visible {
    outline: 2px solid var(--sbv2-ink, #111111);
    outline-offset: 2px;
    border-radius: 2px;
    text-decoration: underline;
}

/* Brand · Era line beneath the product title on wishlist cards */
.wishlist-item-meta {
    font-size: 0.8125rem;
    color: var(--sbv2-muted-2, #696860);
    margin: 0 0 var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wishlist-item-price {
    font-weight: 500;
    color: var(--sbv2-muted, #666666);
}

/* Sale price: muted strikethrough for original, no underline on sale — matches shop cards */
.wishlist-item-price del {
    color: var(--sbv2-muted-2, #AAAAAA);
    font-weight: 400;
    margin-right: 0.375rem;
}

.wishlist-item-price ins {
    text-decoration: none;
}

.wishlist-item .out-of-stock {
    display: inline-block;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--sbv2-line, #E0E0E0);
    color: var(--sbv2-muted, #666666);
    margin-top: var(--space-xs);
}

/* "Se lignende møbler →" discovery link on sold wishlist items.
   Shown below the "Solgt" badge to give users a clear next step. */
.wishlist-sold-cta {
    display: inline-block;
    margin-top: var(--space-xs);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--sbv2-muted, #666666);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: var(--sbv2-line-strong, #CCCCCC);
    transition: color var(--duration) var(--ease), text-decoration-color var(--duration) var(--ease);
}

.wishlist-sold-cta:hover {
    color: var(--sbv2-ink, #111111);
    text-decoration-color: var(--sbv2-ink, #111111);
}

.wishlist-sold-cta:focus-visible {
    outline: 2px solid var(--sbv2-ink, #111111);
    outline-offset: 2px;
    border-radius: 2px;
    color: var(--sbv2-ink, #111111);
    text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
    .wishlist-sold-cta {
        transition: none;
    }
}

/* Sold-out wishlist item: desaturate image + suppress hover lift (matches shop product cards) */
.wishlist-item--sold .wishlist-item-image img {
    filter: grayscale(35%);
    opacity: 0.8;
}

.wishlist-item--sold:hover {
    box-shadow: none;
}

/* "Solgt" hover overlay on sold wishlist item images — pointer devices only (mirrors shop.css pattern) */
@media (hover: hover) {
    .wishlist-item--sold .wishlist-item-image {
        position: relative;
    }

    .wishlist-item--sold .wishlist-item-image::after {
        content: 'Solgt';
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(17, 17, 17, 0.42);
        color: var(--sbv2-paper, #FFFFFF);
        font-size: 0.75rem;
        font-weight: 600;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        opacity: 0;
        transition: opacity var(--duration-slow) var(--ease);
        pointer-events: none;
    }

    .wishlist-item--sold:hover .wishlist-item-image::after {
        opacity: 1;
    }
}

/* Reserved badge — amber, matches product card treatment across the site */
.wishlist-badge-reserved {
    display: inline-block;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--sbv2-amber, #92400e);
    color: var(--sbv2-amber-soft, #fef3c7);
    margin-top: var(--space-xs);
}

/* Restock ETA note — shown beneath the "Solgt" (wishlist) or "Reserveret"
   (reservations) badge for out-of-stock products with a known return date.
   Shared between wishlist-item-info and order-row-status contexts. */
.restock-eta-note {
    display: block;
    font-size: 0.6875rem;
    color: var(--sbv2-muted, #666666);
    margin-top: 0.25rem;
}

/* Back-in-stock notify-me toggle, per wishlist row (item 116). Own scoped
   class rather than reusing single-product.twig's .stock-notify-btn — that
   one's full-width flex treatment lives in shop.css, which this page never
   loads (see functions.php's asset-enqueue conditionals: shop.css is
   gated on is_woocommerce()/is_page('wishlist') etc., not is_account_page()).
   Styled as a small pill instead, matching .wishlist-badge-reserved/
   .wishlist-sold-cta already used in this same card. */
.wishlist-item-notify-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: var(--space-xs);
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--sbv2-line-strong, #CCCCCC);
    background: var(--sbv2-paper, #FFFFFF);
    color: var(--sbv2-ink, #111111);
    font-size: 0.6875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--duration) var(--ease), color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.wishlist-item-notify-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.wishlist-item-notify-btn:hover {
    border-color: var(--sbv2-ink, #111111);
}

.wishlist-item-notify-btn:focus-visible {
    outline: 2px solid var(--sbv2-ink, #111111);
    outline-offset: 2px;
}

.wishlist-item-notify-btn.is-active {
    background: var(--sbv2-ink, #111111);
    color: var(--sbv2-paper, #FFFFFF);
    border-color: var(--sbv2-ink, #111111);
}

@media (prefers-reduced-motion: reduce) {
    .wishlist-item-notify-btn {
        transition: none;
    }
}

.wishlist-remove {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sbv2-paper, #FFFFFF);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all var(--duration) var(--ease);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wishlist-item:hover .wishlist-remove {
    opacity: 1;
}

.wishlist-remove:hover {
    background: var(--sbv2-ink, #111111);
    color: var(--sbv2-paper, #FFFFFF);
}
.wishlist-remove:focus-visible {
    opacity: 1;
    outline: 2px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--sbv2-ink, #111111);
    background: var(--sbv2-ink, #111111);
    color: var(--sbv2-paper, #FFFFFF);
}

.wishlist-loading {
    text-align: center;
    padding: var(--space-xl);
    color: var(--sbv2-muted, #666666);
    animation: wishlist-pulse 1.4s ease-in-out infinite;
}

@keyframes wishlist-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@media (prefers-reduced-motion: reduce) {
    .wishlist-loading {
        animation: none;
    }
}

.wishlist-add-to-cart {
    display: block;
    width: 100%;
    margin-top: auto;
    padding: 0.5rem 1rem;
    background: var(--sbv2-ink, #111111);
    color: var(--sbv2-paper, #FFFFFF);
    border: 1px solid var(--sbv2-ink, #111111);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.wishlist-add-to-cart:hover {
    background: var(--sbv2-paper, #FFFFFF);
    color: var(--sbv2-ink, #111111);
}
.wishlist-add-to-cart:disabled {
    opacity: 0.6;
    cursor: wait;
}
.wishlist-add-to-cart.added {
    background: var(--sbv2-moss, #16a34a);
    border-color: var(--sbv2-moss, #16a34a);
    color: var(--sbv2-paper, #FFFFFF);
}
/* Transient confirmation flash: shown for ~1.5 s after a successful add-to-cart,
   before the button settles into the persistent "Fjern fra kurv" (added) state. */
.wishlist-add-to-cart--confirmed {
    background: var(--sbv2-moss-soft, #dcfce7);
    border-color: var(--sbv2-moss, #16a34a);
    color: var(--sbv2-moss, #166534);
    font-weight: 600;
}
.wishlist-add-to-cart:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--sbv2-ink, #111111);
}

@media (max-width: 768px) {
    .account-stats {
        grid-template-columns: 1fr;
    }

    .account-sections {
        grid-template-columns: 1fr;
    }

    .account-quick-links {
        flex-wrap: wrap;
    }

    .quick-link {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }

    .wishlist-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* At 2-col tablet widths each card is ~50vw — "Hans J. Wegner · 1960erne · Teak"
       gets truncated by the nowrap rule. Allow 2-line wrap so the full meta is visible. */
    .wishlist-item-meta {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Touch-target fix for tablet-range: add-to-cart button must meet 44px (WCAG 2.5.5).
       The ≤480px block already handles narrow phones; this catches 481–768px (tablets/landscape). */
    .wishlist-add-to-cart {
        min-height: 44px;
    }
}

/* Narrow phones (≤480px): single-column wishlist + touch-target fixes.
   2-col cards are too cramped at this width; go 1-col and allow cards to be
   as compact as their content (drop reserved min-height).
   Remove button is hidden until hover — on narrow touch screens there is no
   hover, so the action is invisible and unclickable. Fix: always show it at
   44×44px (WCAG 2.5.5). Add-to-cart gets min-height:44px for the same reason. */
@media (max-width: 480px) {
    .wishlist-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .wishlist-item-info h3 {
        min-height: auto;
    }

    /* Remove button: always visible at ≤480px (opacity:0 until hover means it
       is functionally invisible on touch devices and narrow desktop viewports) */
    .wishlist-remove {
        opacity: 1;
        width: 44px;
        height: 44px;
    }

    /* Add-to-cart: enforce WCAG 2.5.5 44px minimum touch target */
    .wishlist-add-to-cart {
        min-height: 44px;
        font-size: 0.9rem;
    }

    /* "Se lignende møbler →" link on sold cards: bump to 44px touch target.
       At ≤480px it renders as a tiny ~16px text link with no padding — unreachable
       for most thumb taps. Switch to inline-flex + min-height so the tap area
       meets WCAG 2.5.5 without changing the visible text style. */
    .wishlist-sold-cta {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }
}

/* Touch devices: wishlist remove button must always be visible (no hover = opacity:0 is a dead button).
   @media (hover: none) catches all touch screens regardless of viewport width — phones in landscape,
   tablets, iPads — without affecting desktop pointer devices where the hover reveal is intentional. */
@media (hover: none) {
    .wishlist-remove {
        opacity: 1;
        width: 44px;
        height: 44px;
    }

    /* Same 44px touch-target fix for the discovery link on sold wishlist cards.
       Applies to all touch viewports — tablets in landscape included. */
    .wishlist-sold-cta {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }
}

