/* Корзина-панель из шапки (28.09.2026): ПК — панель справа, телефон — окно снизу (как окна быстрого заказа).
   Разметка — layouts/pages/cart_drawer.php, поведение — assets/js/cart-drawer.js. Откат — $config['cart_drawer'] = FALSE. */
body.cd-on .popup_cart_items { display: none !important; } /* прежний выпадающий список при наведении — не нужен */
.cd-wrap { --cd-brand: #b74923; --cd-brand-d: #9a3c1c; --cd-ink: #1c1a19; --cd-muted: #6b625d; --cd-line: #efe9e4; --cd-soft: #fbefe9;
    position: fixed; inset: 0; z-index: 100003; visibility: hidden; pointer-events: none; }
.cd-wrap.is-open { visibility: visible; pointer-events: auto; }
.cd-bg { position: absolute; inset: 0; background: rgba(28, 26, 25, .5); opacity: 0; transition: opacity .25s ease; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); cursor: pointer; }
.cd-wrap.is-open .cd-bg { opacity: 1; }
.cd-panel { position: absolute; top: 0; right: 0; bottom: 0; width: 440px; max-width: 100%; background: #fff; display: flex; flex-direction: column;
    box-shadow: -24px 0 60px -20px rgba(28, 26, 25, .45); transform: translateX(104%); transition: transform .32s cubic-bezier(.2, .8, .3, 1); color: var(--cd-ink); outline: none; }
.cd-wrap.is-open .cd-panel { transform: none; }
.cd-panel.is-busy { cursor: progress; }
.cd-panel.is-busy .cd-body, .cd-panel.is-busy .cd-foot { opacity: .6; pointer-events: none; transition: opacity .15s; }

.cd-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 14px 22px; border-bottom: 1px solid var(--cd-line); }
.cd-title { font-size: 20px; font-weight: 700; line-height: 1.25; }
.cd-title span { font-size: 14px; font-weight: 500; color: var(--cd-muted); }
.cd-x { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #f5f1ee; color: var(--cd-ink); display: grid; place-items: center; cursor: pointer;
    transition: background-color .15s, color .15s, transform .2s; }
.cd-x:hover { background: var(--cd-soft); color: var(--cd-brand); transform: rotate(90deg); }

.cd-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 22px; }
.cd-item { position: relative; display: grid; grid-template-columns: 72px minmax(0, 1fr) 32px; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--cd-line);
    transition: opacity .2s, transform .2s; }
.cd-item:last-child { border-bottom: 0; }
.cd-item.is-gone { opacity: 0; transform: translateX(24px); }
.cd-img { width: 72px; height: 72px; border-radius: 6px; border: 1px solid var(--cd-line); background: #fff; display: grid; place-items: center; overflow: hidden; }
.cd-img img { width: 100%; height: 100%; object-fit: contain; }
.cd-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cd-t { font-size: 14px; line-height: 1.35; font-weight: 500; color: var(--cd-ink); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cd-t:hover { color: var(--cd-brand); }
.cd-sku { font-size: 12px; color: #8a817b; }
.cd-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.cd-qty { display: inline-flex; align-items: center; height: 36px; border: 1px solid #d8cfc9; border-radius: 5px; overflow: hidden; }
.cd-qty button { width: 34px; height: 100%; border: 0; background: #fff; color: var(--cd-ink); font-size: 18px; line-height: 1; cursor: pointer; transition: background-color .12s, color .12s; }
.cd-qty button:hover:not([disabled]) { background: var(--cd-soft); color: var(--cd-brand); }
.cd-qty button[disabled] { color: #c9c0ba; cursor: default; }
.cd-n { min-width: 30px; text-align: center; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cd-qty--fixed { padding: 0 10px; border-style: dashed; font-size: 14px; color: var(--cd-muted); }
.cd-pr { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.cd-pr s { font-size: 12.5px; color: var(--cd-ink); }
.cd-pr b { font-size: 17px; font-weight: 800; color: var(--cd-brand); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cd-pr b.is-sale { color: #d7322b; }
.cd-pr b small { font-size: 12px; font-weight: 600; }
.cd-del { align-self: start; width: 32px; height: 32px; margin-top: -4px; border: 0; border-radius: 50%; background: none; color: #9a8f88; display: grid; place-items: center; cursor: pointer;
    transition: background-color .15s, color .15s; }
.cd-del:hover { background: #fdecea; color: #d7322b; }

.cd-foot { flex: none; padding: 14px 22px calc(18px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--cd-line); background: #fff;
    box-shadow: 0 -10px 24px -18px rgba(28, 26, 25, .35); display: flex; flex-direction: column; gap: 10px; }
.cd-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--cd-muted); }
.cd-line--save b { color: #1f7a3a; font-weight: 700; }
.cd-line--total { font-size: 16px; font-weight: 600; color: var(--cd-ink); }
.cd-line--total b { font-size: 24px; font-weight: 800; color: var(--cd-ink); font-variant-numeric: tabular-nums; }
.cd-line--total b small { font-size: 14px; font-weight: 600; }
.cd-panel *, .cd-panel *::before, .cd-panel *::after { box-sizing: border-box; }
.cd-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 5px; font-size: 15px; font-weight: 600;
    font-family: inherit; text-decoration: none; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s, transform .15s; }
.cd-btn--main { width: 100%; min-height: 50px; border: 0; background: var(--cd-brand); color: #fff; font-size: 16px; font-weight: 700; box-shadow: 0 8px 18px -10px rgba(183, 73, 35, .9); }
.cd-btn--main:hover { background: var(--cd-brand-d); color: #fff; transform: translateY(-1px); }
.cd-btn--main svg { transition: transform .2s; }
.cd-btn--main:hover svg { transform: translateX(3px); }
.cd-foot__row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cd-btn--line { width: 100%; border: 1px solid var(--cd-brand); background: #fff; color: var(--cd-brand); }
.cd-btn--line:hover { background: var(--cd-soft); color: var(--cd-brand); }
.cd-btn--ghost { border: 1px solid #d8cfc9; background: #fff; color: var(--cd-muted); }
.cd-btn--ghost:hover { border-color: var(--cd-ink); color: var(--cd-ink); }
.cd-x:focus-visible, .cd-btn:focus-visible, .cd-qty button:focus-visible, .cd-del:focus-visible, .cd-t:focus-visible, .cd-link:focus-visible { outline: 2px solid var(--cd-brand); outline-offset: 2px; }

.cd-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 30px 28px; text-align: center; }
.cd-empty__ic { width: 84px; height: 84px; border-radius: 50%; background: var(--cd-soft); color: var(--cd-brand); display: grid; place-items: center; margin-bottom: 6px; }
.cd-empty b { font-size: 18px; }
.cd-empty p { margin: 0 0 8px; font-size: 14px; color: var(--cd-muted); max-width: 30ch; }
.cd-empty .cd-btn--main { max-width: 300px; }
.cd-link { font-size: 14px; font-weight: 600; color: var(--cd-brand); text-decoration: none; padding: 6px; }
.cd-loading { flex: 1; display: grid; place-items: center; }
.cd-loading i { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--cd-soft); border-top-color: var(--cd-brand); animation: cdSpin .8s linear infinite; }
@keyframes cdSpin { to { transform: rotate(360deg); } }
body.cd-lock { overflow: hidden; }
body.cd-lock #mcChatWidget, body.cd-lock .phone_fix { display: none !important; }

/* телефон: окно снизу */
@media (max-width: 600px) {
    .cd-panel { top: auto; left: 0; width: 100%; max-height: 90vh; max-height: 90dvh; border-radius: 16px 16px 0 0; transform: translateY(104%);
        box-shadow: 0 -20px 50px -20px rgba(28, 26, 25, .5); }
    .cd-panel::before { content: ""; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: #e3dcd7; }
    .cd-head { padding: 18px 12px 12px 16px; }
    .cd-title { font-size: 18px; }
    .cd-body { padding: 0 16px; }
    .cd-item { grid-template-columns: 64px minmax(0, 1fr) 30px; gap: 10px; padding: 12px 0; }
    .cd-img { width: 64px; height: 64px; }
    .cd-foot { padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px)); gap: 8px; }
    .cd-foot__row .cd-btn { font-size: 14px; padding: 0 8px; }
    .cd-empty { padding: 20px 20px 28px; }
}
@media (prefers-reduced-motion: reduce) { .cd-panel, .cd-bg, .cd-item { transition: none; } }
