/* ============================================================
   PERFILFERROS — Cart Sidebar v2 (task 008)
   Prefixo .pf-cs- ; drawer fixo a direita, cabecalho/rodape fixos.
   ============================================================ */

.pf-cs-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 3400;
}
.pf-cs-overlay.pf-cs-open { display: block; }

#pf-cart-sidebar {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 460px;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    background: #fff;
    color: #003352;
    font-family: 'Prompt', system-ui, sans-serif;
    z-index: 3500;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .32s cubic-bezier(.4, 0, .2, 1), visibility 0s .32s;
    box-shadow: -4px 0 32px rgba(0, 0, 0, .18);
}
#pf-cart-sidebar.pf-cs-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform .32s cubic-bezier(.4, 0, .2, 1), visibility 0s 0s;
}
.pf-cs-drawer [hidden] { display: none !important; }

/* Cabecalho verde */
.pf-cs-header {
    background: #0f6b34;
    color: #fff;
    padding: 14px 16px 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}
.pf-cs-header-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pf-cs-header-texts { display: flex; flex-direction: column; min-width: 0; }
.pf-cs-header-text { font-size: 18px; line-height: 24px; font-weight: 600; }
.pf-cs-header-sub { font-size: 13px; line-height: 18px; }
.pf-cs-close {
    flex: 0 0 44px;
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    border: 0; border-radius: 22px;
    background: #0a5228; color: #fff;
    cursor: pointer;
}
.pf-cs-close:hover { background: #0057a6; }
.pf-cs-close:focus-visible { outline: 2px solid #00a3e0; outline-offset: 2px; }

/* Meio rolavel */
.pf-cs-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Item */
.pf-cs-item-section { display: flex; flex-direction: column; gap: 12px; }
.pf-cs-item { display: flex; gap: 14px; align-items: flex-start; }
.pf-cs-item-img-wrap {
    width: 80px; height: 80px; flex: 0 0 80px;
    border-radius: 8px;
    background: #eef5fb;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.pf-cs-item-img { width: 100%; height: 100%; object-fit: contain; }
.pf-cs-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pf-cs-item-title { font-size: 16px; line-height: 22px; font-weight: 600; overflow-wrap: break-word; }
.pf-cs-item-attrs { font-size: 13px; line-height: 18px; color: #56657a; overflow-wrap: break-word; }
.pf-cs-item-price-line { display: flex; align-items: baseline; gap: 2px; }
.pf-cs-item-price { font-size: 18px; font-weight: 600; color: #0057a6; }
.pf-cs-item-unidade { font-size: 13px; font-weight: 400; color: #56657a; }

.pf-cs-controls {
    display: flex; flex-wrap: wrap; align-items: center;
    justify-content: space-between; gap: 8px 16px;
}
.pf-cs-qty { display: inline-flex; align-items: stretch; height: 44px; border: 1px solid #6f849b; border-radius: 2px; background: #fff; }
.pf-cs-qty:focus-within { border-color: #0057a6; box-shadow: 0 0 0 1px #0057a6; }
.pf-cs-qb { width: 44px; border: 0; background: transparent; color: #003352; font-size: 20px; cursor: pointer; }
.pf-cs-qb:hover { background: #eef5fb; }
.pf-cs-qb:disabled { color: #9aa8b8; cursor: not-allowed; background: transparent; }
.pf-cs-qb:focus-visible { outline: 2px solid #0057a6; outline-offset: -2px; }
.pf-cs-qty input {
    width: 52px; border: 0;
    border-left: 1px solid #d7e1ea; border-right: 1px solid #d7e1ea;
    text-align: center;
    font-family: 'Prompt', sans-serif; font-size: 16px; font-weight: 500; color: #003352;
    outline: none;
}
.pf-cs-locked { display: flex; flex-direction: column; }
.pf-cs-lock-label { font-size: 14px; font-weight: 500; }
.pf-cs-lock-note { font-size: 12px; color: #56657a; }
.pf-cs-item-actions { display: flex; align-items: center; gap: 16px; margin-left: auto; }

.pf-cs-link {
    display: inline-flex; align-items: center;
    min-height: 44px; min-width: 44px; padding: 0;
    border: 0; background: none;
    font-family: 'Prompt', sans-serif; font-size: 13px; font-weight: 500;
    color: #0057a6; cursor: pointer;
    text-decoration: underline; text-underline-offset: 3px;
}
.pf-cs-link:hover { color: #00477f; }
.pf-cs-link:focus-visible { outline: 2px solid #0057a6; outline-offset: 2px; }
.pf-cs-link-light { color: #7fd1f0; }
.pf-cs-link-light:hover { color: #7fd1f0; }

.pf-cs-removed {
    background: #003352; color: #fff;
    padding: 4px 16px; border-radius: 2px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    font-size: 14px;
}

/* Botoes com placa chanfrada (contrato visual) */
.pf-cs-btn {
    --pf-cs-pl: #0057a6; --pf-cs-sw: #00477f; --pf-cs-tx: #fff; --pf-cs-txh: #fff;
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 0 18px;
    border: 0; background: transparent; cursor: pointer;
    font-family: 'Barlow Condensed', 'Prompt', sans-serif;
    font-weight: 600; font-size: 16px; letter-spacing: .06em; text-transform: uppercase;
    color: var(--pf-cs-tx); text-decoration: none;
    isolation: isolate; white-space: nowrap;
    transition: color 120ms;
}
a.pf-cs-btn, a.pf-cs-btn:visited { color: var(--pf-cs-tx); }
.pf-cs-btn:hover, a.pf-cs-btn:hover { color: var(--pf-cs-txh); }
.pf-cs-btn:focus-visible { outline: 2px solid #0057a6; outline-offset: 2px; }
.pf-cs-plate {
    position: absolute; inset: 0;
    background: var(--pf-cs-pl);
    clip-path: polygon(9px 0, 100% 0, calc(100% - 9px) 100%, 0 100%);
    overflow: hidden; z-index: -1;
}
.pf-cs-plate::after {
    content: ''; position: absolute; top: 0; bottom: 0; left: -25%; width: 150%;
    background: var(--pf-cs-sw);
    transform: translateX(-105%) skewX(-12deg);
    transition: transform 420ms cubic-bezier(.7, 0, .2, 1); z-index: 1;
}
.pf-cs-btn:hover .pf-cs-plate::after { transform: translateX(0) skewX(-12deg); }
.pf-cs-btn-outline { --pf-cs-pl: #003352; --pf-cs-sw: #003352; --pf-cs-tx: #003352; --pf-cs-txh: #fff; }
.pf-cs-btn-outline .pf-cs-plate::before {
    content: ''; position: absolute; inset: 2px; background: #fff;
    clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.pf-cs-btn-offer { --pf-cs-pl: #c2410c; --pf-cs-sw: #003352; }
.pf-cs-btn-done { --pf-cs-pl: #0f6b34; --pf-cs-sw: #0a5228; }
.pf-cs-btn-sm { min-height: 44px; padding: 0 12px; font-size: 14px; }
.pf-cs-btn-main { min-height: 52px; font-size: 18px; width: 100%; }
.pf-cs-btn:disabled, .pf-cs-btn[aria-disabled="true"] { opacity: .65; cursor: not-allowed; }

/* Ofertas */
.pf-cs-offers { display: flex; flex-direction: column; gap: 10px; }
.pf-cs-offers-title { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #c2410c; font-weight: 600; }
.pf-cs-offers-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 359px) { .pf-cs-offers-grid { grid-template-columns: minmax(0, 1fr); } }
.pf-cs-offer {
    position: relative;
    border: 1px solid #d7e1ea; border-radius: 4px; overflow: hidden;
    display: flex; flex-direction: column;
    min-width: 0;
}
.pf-cs-offer-badge {
    position: absolute; top: 8px; left: 0;
    padding: 2px 14px 2px 10px;
    background: #c2410c; color: #fff;
    font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 13px;
    letter-spacing: .06em; text-transform: uppercase;
    clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
    z-index: 1;
}
.pf-cs-offer-img { height: 84px; background: #eef5fb; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pf-cs-offer-img img, .pf-cs-rec-img img { width: 100%; height: 100%; object-fit: contain; }
.pf-cs-offer-body { flex: 1; padding: 10px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pf-cs-offer-name { flex: 1; font-size: 13px; line-height: 18px; font-weight: 500; overflow-wrap: break-word; }
.pf-cs-offer-de { font-size: 12px; color: #56657a; }
.pf-cs-offer-por { font-size: 16px; font-weight: 600; color: #c2410c; }
.pf-cs-offer-por .pf-cs-unit, .pf-cs-rec-price .pf-cs-unit { font-size: 12px; font-weight: 400; color: #56657a; }

/* Abas similares/relacionados */
.pf-cs-sugestoes { display: flex; flex-direction: column; }
.pf-cs-tabs { display: flex; border-bottom: 1px solid #d7e1ea; }
.pf-cs-tab {
    flex: 1; min-height: 44px;
    border: 0; border-bottom: 3px solid transparent; background: transparent;
    font-family: 'Prompt', sans-serif; font-size: 14px; font-weight: 500; color: #56657a;
    cursor: pointer;
}
.pf-cs-tab:hover { color: #0057a6; }
.pf-cs-tab.pf-cs-tab-on { color: #003352; border-bottom-color: #0057a6; }
.pf-cs-tab:focus-visible { outline: 2px solid #0057a6; outline-offset: -2px; }
.pf-cs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pf-cs-list.pf-cs-list-all { max-height: 252px; overflow-y: auto; border-bottom: 1px solid #d7e1ea; }
.pf-cs-rec { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #d7e1ea; min-width: 0; }
.pf-cs-rec-img { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 4px; background: #eef5fb; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pf-cs-rec-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pf-cs-rec-name { font-size: 13px; line-height: 18px; font-weight: 500; overflow-wrap: break-word; }
.pf-cs-rec-price { font-size: 13px; color: #56657a; }
.pf-cs-more { align-self: center; justify-content: center; }

/* Rodape */
.pf-cs-footer {
    border-top: 1px solid #d7e1ea;
    padding: 14px 24px 20px;
    display: flex; flex-direction: column; gap: 10px;
    background: #fff;
    flex-shrink: 0;
}
.pf-cs-total-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pf-cs-total-label { font-size: 14px; }
.pf-cs-total { font-size: 22px; font-weight: 600; color: #0057a6; }
.pf-cs-footer-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pf-cs-msg { font-size: 12px; line-height: 16px; min-height: 16px; text-align: center; color: #56657a; overflow-wrap: break-word; }

@media (max-width: 480px) {
    #pf-cart-sidebar { width: 100%; }
    .pf-cs-scroll { padding: 16px 20px; }
    .pf-cs-footer { padding: 12px 20px 16px; }
}

@media (prefers-reduced-motion: reduce) {
    #pf-cart-sidebar { transition: none; }
    .pf-cs-btn, .pf-cs-plate, .pf-cs-plate::after { transition: none; }
}
