/* ============================================================
   MHDCommerce — Modal Adicionar ao Carrinho + Confirmação
   Arquivo: wwwroot/css/add-carrinho.css
   Carregar DEPOIS de site.css e ofertas.css
   ============================================================ */

.cart-overlay {
    position: fixed; inset: 0; background: rgba(20,30,25,.55); backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 1000;
    opacity: 0; pointer-events: none; transition: opacity .2s;
}
.cart-overlay.open { opacity: 1; pointer-events: all; }
.cart-modal {
    background: var(--white); border-radius: var(--radius-xl); width: 100%; max-width: 440px;
    overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.3); max-height: 92vh;
    display: flex; flex-direction: column;
    transform: translateY(14px) scale(.98); transition: transform .2s;
}
.cart-overlay.open .cart-modal { transform: translateY(0) scale(1); }

/* Cabeçalho */
.cm-head { display: flex; gap: 14px; padding: 22px 24px; border-bottom: 1px solid var(--border); position: relative; }
.cm-close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: none; background: var(--bg); border-radius: 99px; cursor: pointer; font-size: 16px; color: var(--text-2); display: flex; align-items: center; justify-content: center; z-index: 2; }
.cm-close:hover { background: var(--border); }
.cm-thumb { width: 80px; height: 80px; border-radius: var(--radius-md); background: white; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 40px; position: relative; overflow: hidden; }
.cm-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.cm-clube-selo { position: absolute; bottom: 2px; left: 2px; width: 22px; height: 22px; border-radius: 99px; background: var(--clube); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; border: 2px solid #fff; overflow: hidden; }
.cm-clube-selo img { width: 100%; height: 100%; object-fit: cover; }
.cm-head-info { flex: 1; min-width: 0; padding-right: 28px; }
.cm-badges { display: flex; gap: 5px; margin-bottom: 5px; flex-wrap: wrap; }
.cm-badge { font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 99px; text-transform: uppercase; letter-spacing: .3px; }
.cm-badge.oferta { background: var(--brand-light); color: var(--brand-dark); }
.cm-badge.exclusivo { background: var(--brand-dark); color: #fff; }
.cm-badge.clube { background: var(--clube-light); color: var(--clube); }
.cm-badge.atacarejo { background: var(--atacarejo-light); color: var(--atacarejo); }
.cm-nome { font-family: 'Sora', sans-serif; font-size: 16px; font-weight: 700; line-height: 1.25; }

/* Corpo */
.cm-body { padding: 20px 24px; overflow-y: auto; }
.cm-precos { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.cm-preco-atual { font-family: 'Sora', sans-serif; font-size: 28px; font-weight: 700; color: var(--brand); line-height: 1; }
.cm-preco-atual.atacarejo-ativo { color: var(--atacarejo); }
.cm-preco-antigo { font-size: 15px; color: #bbb; text-decoration: line-through; }
.cm-preco-unidade { font-size: 12px; color: var(--muted); }
.cm-clube-linha { display: flex; align-items: center; gap: 8px; margin-top: 8px; background: var(--clube-light); border-radius: var(--radius-sm); padding: 8px 12px; }
.cm-clube-logo { width: 22px; height: 22px; border-radius: 99px; background: var(--clube); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.cm-clube-logo img { width: 100%; height: 100%; object-fit: cover; }
.cm-clube-txt { font-size: 12px; font-weight: 600; color: var(--clube); }
.cm-clube-valor { margin-left: auto; font-family: 'Sora', sans-serif; font-size: 17px; font-weight: 700; color: var(--clube); }
.cm-atacarejo { margin-top: 14px; background: var(--atacarejo-light); border: 1px dashed var(--atacarejo); border-radius: var(--radius-md); padding: 10px 12px; font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.cm-atacarejo b { color: var(--atacarejo); }
.cm-atacarejo .ico { font-size: 18px; }

/* Quantidade */
.cm-secao-label { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 18px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.cm-max { font-size: 11px; color: var(--muted); font-weight: 500; }
.cm-qtd { display: flex; align-items: center; gap: 16px; }
.cm-qtd-control { display: flex; align-items: center; background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.cm-qtd-btn { width: 46px; height: 46px; border: none; background: var(--white); cursor: pointer; font-size: 20px; color: var(--brand); display: flex; align-items: center; justify-content: center; }
.cm-qtd-btn:hover:not(:disabled) { background: var(--brand-light); }
.cm-qtd-btn:disabled { color: #ccc; cursor: not-allowed; }
.cm-qtd-value { width: 80px; height: 46px; border: none; border-left: 1.5px solid var(--border); border-right: 1.5px solid var(--border); text-align: center; font-family: 'Sora', sans-serif; font-size: 16px; font-weight: 600; color: var(--text); outline: none; }
.cm-qtd-aprox { font-size: 12px; color: var(--brand); font-weight: 600; }

/* Observação */
.cm-obs { width: 100%; border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: 11px 13px; font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--text); outline: none; resize: none; min-height: 60px; transition: border-color .15s; }
.cm-obs:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }
.cm-obs::placeholder { color: #bbb; }

/* Footer */
.cm-footer { padding: 16px 24px 22px; border-top: 1px solid var(--border); }
.cm-total { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cm-total-label { font-size: 14px; color: var(--text-2); }
.cm-total-valor { font-family: 'Sora', sans-serif; font-size: 24px; font-weight: 700; color: var(--brand); }
.cm-add-btn { width: 100%; height: 52px; background: var(--brand); color: #fff; border: none; border-radius: var(--radius-md); font-family: 'DM Sans', sans-serif; font-size: 16px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: background .15s; }
.cm-add-btn:hover { background: var(--brand-mid); }
.cm-add-btn:disabled { opacity: .7; cursor: progress; }

/* Confirmação */
.cm-confirm { padding: 36px 28px 28px; text-align: center; position: relative; }
.cm-confirm-ico { width: 72px; height: 72px; border-radius: 99px; background: var(--brand-light); color: var(--brand); display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }
.cm-confirm-ico svg { width: 38px; height: 38px; }
.cm-confirm-titulo { font-family: 'Sora', sans-serif; font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.cm-confirm-sub { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.cm-confirm-resumo { background: var(--bg); border-radius: var(--radius-md); padding: 12px 16px; margin: 18px 0; display: flex; align-items: center; gap: 12px; text-align: left; }
.cm-confirm-resumo .r-thumb { width: 44px; height: 44px; border-radius: var(--radius-sm); background: #f5f4ef; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; overflow: hidden; }
.cm-confirm-resumo .r-info { flex: 1; min-width: 0; }
.cm-confirm-resumo .r-nome { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
.cm-confirm-resumo .r-qtd { font-size: 12px; color: var(--muted); }
.cm-confirm-resumo .r-preco { font-family: 'Sora', sans-serif; font-weight: 700; color: var(--brand); }
.cm-confirm-acoes { display: flex; flex-direction: column; gap: 10px; }
.cm-btn-primary { width: 100%; height: 50px; background: var(--brand); color: #fff; border: none; border-radius: var(--radius-md); font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.cm-btn-primary:hover { background: var(--brand-mid); }
.cm-btn-secondary { width: 100%; height: 50px; background: var(--white); color: var(--brand); border: 1.5px solid var(--border); border-radius: var(--radius-md); font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 600; cursor: pointer; }
.cm-btn-secondary:hover { background: var(--bg); }

/* ── Mobile: bottom sheet ── */
@media (max-width: 768px) {
    .cart-overlay { padding: 0; align-items: flex-end; }
    .cart-modal { max-width: none; border-radius: var(--radius-xl) var(--radius-xl) 0 0; transform: translateY(100%); }
    .cart-overlay.open .cart-modal { transform: translateY(0); }
    .cm-qtd-btn { width: 48px; height: 48px; }
    .cm-add-btn { height: 54px; }
}

.cm-avisos {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cm-aviso {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.4;
    display: flex;
    gap: 6px;
}

.cm-aviso span {
    color: var(--brand);
    flex-shrink: 0;
}


.cm-estoque {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm, 8px);
    font-size: 12.5px;
    font-weight: 600;
    background: var(--amber-light, #fff4e0);
    color: var(--amber, #c77700);
    border: 1px solid #f0d9a8;
}

.cm-estoque.critico {
    background: var(--red-light, #fdecec);
    color: var(--red, #e53b3b);
    border-color: #f5c6c6;
}

.cm-estoque-ico {
    font-size: 12px;
    flex-shrink: 0;
    opacity: .8;
}
