/**
 * Buy and Save - Wishlist & Compare Styles
 * Designed to match Buy and Save's modern, editorial design system.
 * Typography: DM Sans + Manrope, warm ink, clean borders, minimal aesthetic.
 */

:root {
    --bns-ink: #20251f;
    --bns-paper: #fbfbf9;
    --bns-muted: #6b7265;
    --bns-line: #e2e4dd;
    --bns-accent: #f0f0e9;
    --bns-yellow: #fed700;
    --bns-red: #d93829;
}

/* ==========================================================================
   1. Uniform Action Buttons (Wishlist & Compare)
   ========================================================================== */

.bns-actions-group {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    margin: 10px 0 6px;
    font-family: inherit;
    font-size: 13px;
    color: var(--bns-muted);
    flex-wrap: wrap;
}

.single-product .bns-actions-group {
    margin: 14px 0 16px;
    gap: 28px;
    padding-bottom: 0;
    border-bottom: none;
}

.bns-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 6px 0;
    margin: 0;
    color: #6a7164;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
    line-height: 1;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.bns-action-btn:hover {
    color: var(--bns-ink);
}

.bns-action-btn:active {
    transform: scale(0.97);
}

.bns-action-btn .bns-icon {
    display: inline-block;
    flex-shrink: 0;
    transition: stroke 0.15s ease, fill 0.15s ease, transform 0.2s ease;
}

/* Reference image precision: Heart icon has crisp ink outline, compare icon is grey */
.bns-action-btn .bns-icon-heart {
    stroke: var(--bns-ink);
}

.bns-action-btn .bns-icon-compare {
    stroke: #6a7164;
}

.bns-action-btn:hover .bns-icon-compare {
    stroke: var(--bns-ink);
}

/* Heart button active state (saved in wishlist) */
.bns-action-btn.bns-wishlist-btn.is-active {
    color: var(--bns-ink);
    font-weight: 600;
}

.bns-action-btn.bns-wishlist-btn.is-active .bns-icon-heart {
    fill: var(--bns-ink);
    stroke: var(--bns-ink);
    transform: scale(1.08);
}

/* Compare button active state (in compare tray) */
.bns-action-btn.bns-compare-btn.is-active {
    color: var(--bns-ink);
    font-weight: 600;
}

.bns-action-btn.bns-compare-btn.is-active .bns-icon-compare {
    stroke: var(--bns-ink);
    animation: bns-spin 0.4s ease;
}

@keyframes bns-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(180deg); }
}

/* Header badge counts */
.bns-header-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: var(--bns-ink);
    background: var(--bns-accent);
    border-radius: 9px;
    margin-left: 5px;
    vertical-align: middle;
}

.bns-header-badge.has-items {
    background: var(--bns-yellow);
}

/* ==========================================================================
   2. Floating Comparison Dock (Bottom Sticky)
   ========================================================================== */

.bns-compare-dock {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: #ffffff;
    border: 1px solid var(--bns-ink);
    box-shadow: 0 16px 36px rgba(32, 37, 31, 0.16);
    border-radius: 8px;
    padding: 12px 20px;
    max-width: 92vw;
    width: 680px;
    animation: bns-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bns-slide-up {
    from { transform: translate(-50%, 30px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.bns-compare-dock-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.bns-compare-dock-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bns-compare-dock-count {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--bns-ink);
}

.bns-count-badge {
    background: var(--bns-ink);
    color: #ffffff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.bns-compare-dock-hint {
    font-size: 11px;
    color: var(--bns-muted);
}

.bns-compare-dock-thumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.bns-dock-thumb-slot {
    width: 44px;
    height: 44px;
    border: 1px dashed var(--bns-line);
    border-radius: 6px;
    background: var(--bns-paper);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bns-dock-thumb-slot img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 3px;
}

.bns-dock-thumb-remove {
    position: absolute;
    top: 1px;
    right: 1px;
    background: rgba(32, 37, 31, 0.75);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    line-height: 1;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bns-compare-dock-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bns-dock-clear-btn {
    background: transparent;
    border: none;
    color: var(--bns-muted);
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
}

.bns-dock-clear-btn:hover {
    color: var(--bns-ink);
}

.bns-dock-view-btn {
    padding: 9px 16px !important;
    font-size: 13px !important;
    white-space: nowrap;
}

/* ==========================================================================
   3. Wishlist View Page
   ========================================================================== */

.bns-wishlist-container {
    padding: 20px 0 60px;
    font-family: inherit;
}

.bns-view-header {
    margin-bottom: 35px;
    border-bottom: 1px solid var(--bns-line);
    padding-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
}

.bns-view-header-main h1 {
    font-size: clamp(28px, 3.5vw, 42px);
    font-weight: 700;
    color: var(--bns-ink);
    margin: 6px 0;
    line-height: 1.15;
}

.bns-view-header-main p {
    font-size: 14px;
    color: var(--bns-muted);
    margin: 0;
}

.bns-wishlist-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 28px 24px;
}

.bns-wishlist-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--bns-line);
    border-radius: 6px;
    padding: 16px;
    background: #ffffff;
    position: relative;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bns-wishlist-card:hover {
    border-color: var(--bns-ink);
    box-shadow: 0 10px 24px rgba(32, 37, 31, 0.06);
}

.bns-card-remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: 1px solid var(--bns-line);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bns-muted);
    transition: all 0.15s ease;
    z-index: 2;
}

.bns-card-remove-btn:hover {
    background: var(--bns-ink);
    color: #ffffff;
    border-color: var(--bns-ink);
}

.bns-wishlist-img-wrap {
    aspect-ratio: 1/1;
    background: var(--bns-accent);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}

.bns-wishlist-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.bns-wishlist-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.bns-wishlist-category {
    font-size: 11px;
    color: var(--bns-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.bns-wishlist-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--bns-ink);
    margin: 0 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 40px;
}

.bns-wishlist-title a {
    color: inherit;
    text-decoration: none;
}

.bns-wishlist-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--bns-ink);
    margin-bottom: 14px;
    margin-top: auto;
}

.bns-wishlist-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bns-wishlist-actions .bns-add-cart-btn {
    width: 100%;
    padding: 10px;
    text-align: center;
    background: var(--bns-yellow);
    color: var(--bns-ink);
    border: 1px solid var(--bns-yellow);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.bns-wishlist-actions .bns-add-cart-btn:hover {
    background: #e5c200;
}

/* ==========================================================================
   4. Compare View Page
   ========================================================================== */

.bns-compare-container {
    padding: 20px 0 80px;
    font-family: inherit;
}

.bns-compare-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--bns-line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(32, 37, 31, 0.04);
}

.bns-compare-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 720px;
}

.bns-compare-table th,
.bns-compare-table td {
    padding: 18px 20px;
    border-bottom: 1px solid var(--bns-line);
    border-right: 1px solid var(--bns-line);
    vertical-align: top;
    text-align: left;
}

.bns-compare-table td:last-child,
.bns-compare-table th:last-child {
    border-right: none;
}

.bns-compare-table tr:last-child td,
.bns-compare-table tr:last-child th {
    border-bottom: none;
}

.bns-compare-table .bns-th-label {
    width: 180px;
    background: #f8f8f5;
    font-size: 13px;
    font-weight: 700;
    color: var(--bns-ink);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.bns-compare-product-col {
    position: relative;
}

.bns-compare-remove {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--bns-muted);
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
}

.bns-compare-remove:hover {
    color: var(--bns-red);
}

.bns-compare-thumb {
    width: 100%;
    aspect-ratio: 1/1;
    max-height: 180px;
    background: var(--bns-accent);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    margin-bottom: 12px;
}

.bns-compare-thumb img {
    max-height: 100%;
    width: auto;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.bns-compare-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--bns-ink);
    margin: 0 0 8px;
}

.bns-compare-title a {
    color: inherit;
    text-decoration: none;
}

.bns-compare-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--bns-ink);
    margin-bottom: 12px;
}

.bns-compare-stock {
    font-size: 13px;
    font-weight: 600;
}

.bns-stock-in {
    color: #2e7d32;
}

.bns-stock-out {
    color: var(--bns-red);
}

/* ==========================================================================
   5. Empty State
   ========================================================================== */

.bns-empty-state {
    padding: 60px 20px;
    text-align: center;
    max-width: 580px;
    margin: 0 auto;
}

.bns-empty-icon {
    margin-bottom: 20px;
    color: var(--bns-muted);
}

.bns-empty-state h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--bns-ink);
    margin: 0 0 10px;
}

.bns-empty-state p {
    font-size: 15px;
    color: var(--bns-muted);
    margin: 0 0 24px;
    line-height: 1.6;
}

/* ==========================================================================
   6. Notification Toast
   ========================================================================== */

.bns-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100000;
    background: var(--bns-ink);
    color: #ffffff;
    padding: 12px 22px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: -0.01em;
    box-shadow: 0 12px 32px rgba(32, 37, 31, 0.22);
    transform: translateY(-20px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
}

.bns-toast.is-visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   7. Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1024px) {
    .bns-wishlist-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
}

@media (max-width: 768px) {
    .bns-wishlist-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .bns-compare-dock {
        width: calc(100vw - 32px);
        bottom: 16px;
        padding: 10px 14px;
    }

    .bns-compare-dock-thumbs {
        display: none;
    }

    .bns-compare-table .bns-th-label {
        width: 130px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .bns-actions-group {
        gap: 12px;
    }
    
    .bns-action-btn {
        font-size: 12px;
    }
}
