/* ============================================================================
   CB Wishlist + Comparar — Castor Bezerra (paridade WP F-48)
   ----------------------------------------------------------------------------
   Somente os componentes NOVOS da Nuvemshop (drawer de desejos, overlay de
   comparacao, icone do header). Os botoes .ttd-wishlist-btn / .ttd-compare-btn,
   o toast .ttd-wl-toast, a tray .ttd-compare-tray, a tabela .ttd-compare-table
   e os empty-cards ja estao estilizados no style-wp-port.scss.tpl (porte do WP).
   Paleta: azul royal #1E5FD8 + ambar #F59E0B via vars --rastreio-brand-*.
   ========================================================================== */

/* ================= Body lock ================= */
body.cb-no-scroll { overflow: hidden; }

/* ================= Header: icone Desejos ================= */
.cb-wl-header { cursor: pointer; }
.cb-wl-header:hover svg { color: #E11D48; }
.cb-wl-badge.is-zero { display: none; }

/* ================= Overlay generico (fundo escurecido) ================= */
.cb-ui-overlay {
    position: fixed;
    inset: 0;
    z-index: 10040;
    background: rgba(14, 23, 38, .55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .24s ease;
}
.cb-ui-overlay.is-show {
    opacity: 1;
    pointer-events: auto;
}

/* ================= Botao fechar (X) ================= */
.cb-ui-close {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1.5px solid var(--rastreio-brand-line, #e2e8f0);
    background: #fff;
    color: var(--rastreio-brand-muted, #3c4a60);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}
.cb-ui-close:hover {
    color: var(--rastreio-brand-primary, #1e5fd8);
    border-color: var(--rastreio-brand-primary, #1e5fd8);
    background: var(--rastreio-brand-bg-2, #fbfcfe);
}
.cb-ui-close:focus-visible {
    outline: 3px solid var(--rastreio-brand-accent, #f59e0b);
    outline-offset: 2px;
}

/* ================= Drawer "Meus desejos" ================= */
.cb-wl-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 10060;
    width: min(420px, 100%);
    background: #fff;
    box-shadow: -18px 0 48px rgba(15, 42, 102, .22);
    transform: translateX(105%);
    transition: transform .3s cubic-bezier(.22, 1, .36, 1);
    display: flex;
    flex-direction: column;
    font-family: var(--rastreio-font-ui, 'Inter', -apple-system, system-ui, sans-serif);
}
.cb-wl-drawer.is-open { transform: translateX(0); }

.cb-wl-drawer__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 2px solid var(--rastreio-brand-line, #e2e8f0);
    flex-shrink: 0;
}
.cb-wl-drawer__head-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #fff5f5;
    color: #E11D48;
}
.cb-wl-drawer__head-txt { flex: 1; min-width: 0; }
.cb-wl-drawer__title {
    font-family: var(--rastreio-font-display, 'Sora', system-ui, sans-serif);
    font-weight: 700;
    letter-spacing: -0.01em;
    font-size: 20px;
    color: var(--rastreio-brand-ink, #0e1726);
    margin: 0 0 2px;
}
.cb-wl-drawer__sub {
    font-size: 12.5px;
    color: var(--rastreio-brand-muted, #3c4a60);
    margin: 0;
}
.cb-wl-drawer__count {
    color: #E11D48;
    font-weight: 700;
    margin-left: 4px;
}

.cb-wl-drawer__list {
    list-style: none;
    margin: 0;
    padding: 14px 16px 24px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
}
.cb-wl-item {
    display: flex;
    gap: 12px;
    background: #fff;
    border: 1.5px solid var(--rastreio-brand-line, #e2e8f0);
    border-radius: 14px;
    padding: 12px;
    transition: box-shadow .22s ease, border-color .22s ease;
}
.cb-wl-item:hover {
    box-shadow: 0 10px 24px rgba(15, 42, 102, .10);
}
.cb-wl-item__media {
    display: block;
    flex-shrink: 0;
    width: 84px;
    height: 84px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--rastreio-brand-bg, #f7f9fc);
    border: 1px solid var(--rastreio-brand-line, #e2e8f0);
}
.cb-wl-item__media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.cb-wl-item__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cb-wl-item__title {
    font-weight: 600;
    font-size: 13.5px;
    line-height: 1.35;
    color: var(--rastreio-brand-ink, #0e1726);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cb-wl-item__title:hover { color: var(--rastreio-brand-link, #1d4ed8); }
.cb-wl-item__price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
.cb-wl-item__price-old {
    color: var(--rastreio-brand-muted, #3c4a60);
    text-decoration: line-through;
    font-size: 12px;
}
.cb-wl-item__price {
    color: #0d5f0d;
    font-weight: 700;
    font-size: 16px;
}
.cb-wl-item__actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 2px;
}
/* Reusa .ttd-wishlist-card__buy / __remove do porte WP; aqui so compacta */
.cb-wl-item__actions .ttd-wishlist-card__buy {
    padding: 8px 12px;
    font-size: 12.5px;
}
.cb-wl-item__actions .ttd-wishlist-card__remove {
    padding: 8px 10px;
    font-size: 12px;
}

/* Empty-state dentro do drawer (reusa .ttd-wishlist-empty-card do porte) */
.cb-wl-drawer__empty { padding: 10px 16px; overflow-y: auto; }
.cb-wl-drawer__empty .ttd-wishlist-empty-card {
    margin: 14px auto;
    padding: 40px 22px;
}

/* ================= Overlay de comparacao ================= */
.cb-cmp-overlay {
    position: fixed;
    inset: 0;
    z-index: 10070;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(12px, 4vh, 48px) clamp(8px, 3vw, 32px);
    visibility: hidden;
    opacity: 0;
    transition: opacity .24s ease, visibility 0s linear .24s;
}
.cb-cmp-overlay.is-open {
    visibility: visible;
    opacity: 1;
    transition: opacity .24s ease;
}
.cb-cmp-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(14, 23, 38, .58);
}
.cb-cmp-modal {
    position: relative;
    z-index: 1;
    width: min(1180px, 100%);
    max-height: 100%;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(14px) scale(.985);
    transition: transform .26s cubic-bezier(.22, 1, .36, 1);
    font-family: var(--rastreio-font-ui, 'Inter', -apple-system, system-ui, sans-serif);
}
.cb-cmp-overlay.is-open .cb-cmp-modal { transform: translateY(0) scale(1); }

.cb-cmp-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 16px;
    border-bottom: 2px solid var(--rastreio-brand-line, #e2e8f0);
    flex-shrink: 0;
}
.cb-cmp-modal__title {
    font-family: var(--rastreio-font-display, 'Sora', system-ui, sans-serif);
    font-weight: 700;
    letter-spacing: -0.01em;
    font-size: clamp(20px, 3vw, 28px);
    color: var(--rastreio-brand-ink, #0e1726);
    margin: 0 0 4px;
}
.cb-cmp-modal__sub {
    font-size: 13.5px;
    color: var(--rastreio-brand-muted, #3c4a60);
    margin: 0;
}
.cb-cmp-modal__empty {
    padding: 8px 22px 26px;
    overflow-y: auto;
}
.cb-cmp-modal__empty .ttd-compare-empty-card { margin: 20px auto; }

/* Tabela: reusa .ttd-compare-table do porte; o wrap rola nos 2 eixos */
.cb-cmp-tablewrap {
    margin: 16px 22px 22px;
    overflow: auto;
    max-height: calc(90vh - 140px);
}

@media (max-width: 580px) {
    .cb-cmp-overlay { padding: 0; }
    .cb-cmp-modal {
        border-radius: 0;
        width: 100%;
        height: 100%;
        max-height: none;
    }
    .cb-cmp-modal__head { padding: 16px 14px 12px; }
    .cb-cmp-tablewrap {
        margin: 12px 10px 16px;
        max-height: none;
        flex: 1;
    }
    .cb-wl-drawer { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .cb-wl-drawer,
    .cb-cmp-modal,
    .cb-ui-overlay,
    .cb-cmp-overlay { transition: none; }
}
