/* Корзина-калькулятор: круглая кнопка, выезжающая панель, список позиций.
 * Значения перенесены из самописного блока Битрикса без изменений. */

:root {
    --cart-brand: #7e1329;
    --cart-brand-light: rgba(126, 19, 41, 0.08);
    --cart-brand-glow: rgba(126, 19, 41, 0.25);
    --cart-accent: #c0dd92;
    --cart-glass: rgba(255, 255, 255, 0.72);
    --cart-glass-border: rgba(255, 255, 255, 0.45);
    --cart-glass-shadow: rgba(126, 19, 41, 0.12);
    --cart-text: #1a1a1a;
    --cart-text-soft: #777777;
    --cart-radius: 22px;
    --cart-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --cart-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --------------------------------------------------------- круглая кнопка */
.cart-btn {
    position: fixed;
    right: clamp(14px, 2.5vw, 24px);
    bottom: clamp(14px, 2.5vw, 24px);
    width: clamp(54px, 6vw, 66px);
    height: clamp(54px, 6vw, 66px);
    background: var(--cart-brand);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10003;
    opacity: 0;
    transform: scale(0) rotate(-180deg);
    transition: transform 0.5s var(--cart-spring), opacity 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 20px var(--cart-glass-shadow), 0 0 0 0 var(--cart-brand-glow);
    -webkit-tap-highlight-color: transparent;
}

.cart-btn.active { opacity: 1; transform: scale(1) rotate(0deg); }

.cart-btn:hover {
    box-shadow: 0 8px 32px var(--cart-glass-shadow), 0 0 0 8px var(--cart-brand-glow);
    transform: scale(1.08) rotate(0deg);
}

.cart-btn:active { transform: scale(0.95) rotate(0deg); transition-duration: 0.1s; }
.cart-btn.pulse { animation: cartPulse 0.5s var(--cart-spring); }
.cart-btn.catch { animation: cartCatch 0.4s var(--cart-spring); }

.cart-icon { width: clamp(22px, 2.8vw, 28px); height: clamp(22px, 2.8vw, 28px); }

.cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--cart-accent);
    color: var(--cart-brand);
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: 11px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: transform 0.4s var(--cart-spring);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cart-count.visible { transform: scale(1); }
.cart-count.bump { animation: countBump 0.4s var(--cart-spring); }

/* Летящая точка от карточки к корзине. */
.cart-fly-dot {
    position: fixed;
    z-index: 99999;
    pointer-events: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f5c542;
    opacity: 0;
    filter: blur(0.5px);
}

/* ---------------------------------------------------------------- панель */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10003;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.cart-overlay.active { opacity: 1; pointer-events: auto; }

.cart-panel {
    position: fixed;
    right: 0;
    bottom: 0;
    width: min(380px, 100%);
    height: 75vh;
    max-height: 680px;
    background: var(--cart-glass);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    border: 1px solid var(--cart-glass-border);
    border-right: none;
    border-bottom: none;
    border-radius: var(--cart-radius) 0 0 0;
    z-index: 10004;
    display: flex;
    flex-direction: column;
    transform: translateX(105%);
    opacity: 0;
    transition: transform 0.45s var(--cart-ease), opacity 0.35s ease;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.cart-panel.active { transform: translateX(0); opacity: 1; }

.cart-header {
    padding: 20px 22px 16px;
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.02em;
    color: var(--cart-brand);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(126, 19, 41, 0.08);
}

.cart-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--cart-brand-light);
    color: var(--cart-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s var(--cart-spring);
}

.cart-close:hover { background: var(--cart-brand); color: #ffffff; transform: rotate(90deg) scale(1.1); }

.cart-items {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 16px;
    scroll-behavior: smooth;
}

.cart-items::-webkit-scrollbar { width: 4px; }
.cart-items::-webkit-scrollbar-track { background: transparent; }
.cart-items::-webkit-scrollbar-thumb { background: rgba(126, 19, 41, 0.15); border-radius: 4px; }

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--cart-text-soft);
    font-family: "Nunito", sans-serif;
    font-size: 15px;
    text-align: center;
}

.cart-empty-icon { width: 48px; height: 48px; opacity: 0.25; }

/* ------------------------------------------------------------- позиции */
.cart-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin: 6px 0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.04);
    font-family: "Nunito", sans-serif;
    gap: 12px;
    transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    animation: itemSlideIn 0.4s var(--cart-spring) both;
}

.cart-item:hover {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    transform: translateX(-2px);
}

.cart-item.removing { animation: itemSlideOut 0.35s var(--cart-ease) forwards; }

.cart-item-img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cart-item-info { flex: 1; min-width: 0; }

.cart-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--cart-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-right { display: flex; align-items: center; flex-shrink: 0; gap: 8px; }
.cart-price { font-weight: 800; font-size: 14px; color: var(--cart-brand); }

.cart-qty {
    display: flex;
    align-items: center;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(126, 19, 41, 0.12);
}

.cart-qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--cart-brand-light);
    color: var(--cart-brand);
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    padding: 0;
    line-height: 1;
}

.cart-qty-btn:hover { background: var(--cart-brand); color: #ffffff; }
.cart-qty-btn:active { transform: scale(0.9); }

.cart-qty-num {
    width: 26px;
    text-align: center;
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: 13px;
    color: var(--cart-brand);
    background: rgba(255, 255, 255, 0.6);
}

/* --------------------------------------------------------------- итог */
.cart-footer {
    padding: 16px 22px 20px;
    font-family: "Nunito", sans-serif;
    color: var(--cart-brand);
    border-top: 1px solid rgba(126, 19, 41, 0.08);
    background: rgba(255, 255, 255, 0.4);
}

.cart-service {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: var(--cart-text-soft);
    margin-bottom: 10px;
}

.cart-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(126, 19, 41, 0.12), transparent);
    margin-bottom: 10px;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.cart-total-value {
    font-size: 22px;
    background: linear-gradient(135deg, var(--cart-brand), #a82040);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ---------------------------------------------------------- анимации */
@keyframes cartPulse {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.25); }
    60%  { transform: scale(0.92); }
    100% { transform: scale(1); }
}

@keyframes cartCatch {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.3); box-shadow: 0 0 0 12px var(--cart-brand-glow); }
    70%  { transform: scale(0.9); }
    100% { transform: scale(1); box-shadow: 0 4px 20px var(--cart-glass-shadow); }
}

@keyframes countBump {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.4); }
    100% { transform: scale(1); }
}

@keyframes itemSlideIn {
    0%   { opacity: 0; transform: translateX(40px) scale(0.9); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes itemSlideOut {
    0%   { opacity: 1; transform: translateX(0) scale(1); max-height: 80px; margin: 6px 0; padding: 12px; }
    100% { opacity: 0; transform: translateX(-60px) scale(0.8); max-height: 0; margin: 0; padding: 0 12px; border-width: 0; }
}

@media (max-width: 420px) {
    .cart-panel {
        width: 100%;
        height: 80vh;
        border-radius: var(--cart-radius) var(--cart-radius) 0 0;
        border-right: none;
        border-left: 1px solid var(--cart-glass-border);
        transform: translateY(105%);
    }
    .cart-panel.active { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .cart-btn, .cart-count, .cart-item { animation: none; }
    .cart-fly-dot { display: none; }
}

/* ==================================================== общая корзина стола */
/*
 * Главная задача блока: с одного взгляда видеть, где своё.
 *
 * Мелкой подписи «вы» под названием для этого мало - за столом на
 * четверых её не замечают. Поэтому свои позиции вынесены отдельной
 * группой наверх, помечены полосой цвета акцента и подложкой, и только у
 * них есть кнопки количества. Три сигнала вместо одного слова.
 */
.cgroup { margin-bottom: 18px; }
.cgroup:last-child { margin-bottom: 0; }

.cgroup__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #8a8078;
}

.cgroup__n {
    min-width: 20px;
    padding: 1px 7px;
    font-size: 11px;
    letter-spacing: 0;
    text-align: center;
    border-radius: 999px;
    background: rgba(18, 34, 45, 0.07);
    color: #12222d;
}

/* Своя группа: заголовок цветом акцента и жирнее - её ищут первой. */
.cgroup--mine .cgroup__title { color: #7e1329; }
.cgroup--mine .cgroup__n { background: rgba(126, 19, 41, 0.12); color: #7e1329; }

.crow {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    background: transparent;
}

/*
 * Свои строки: подложка и полоса слева. Полоса важнее подложки - она
 * читается даже на телефоне при ярком солнце, когда лёгкий фон не виден.
 */
.crow--mine {
    background: rgba(126, 19, 41, 0.055);
    box-shadow: inset 3px 0 0 #7e1329;
}

.crow__pic {
    width: 44px;
    height: 44px;
    flex: none;
    object-fit: cover;
    border-radius: 8px;
    background: rgba(18, 34, 45, 0.06);
}

.crow__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.crow__name {
    font-size: 14px;
    line-height: 1.3;
    color: #12222d;
}
.crow--mine .crow__name { font-weight: 700; }

.crow__who {
    margin-top: 2px;
    font-size: 11.5px;
    color: #8a8078;
}
/* Позиция, положенная официантом на весь стол, а не кем-то из гостей. */
.crow__who--staff { color: #6f8f3f; font-weight: 700; }

.crow__right {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.crow__sum {
    font-size: 13.5px;
    font-weight: 700;
    color: #7e1329;
    white-space: nowrap;
}

.crow__qty { font-size: 12px; color: #8a8078; }

.crow__ctl { display: flex; align-items: center; gap: 4px; }

.crow__step {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    padding: 0;
    font: inherit;
    font-size: 15px;
    line-height: 1;
    color: #7e1329;
    background: #fff;
    border: 1px solid rgba(126, 19, 41, 0.28);
    border-radius: 50%;
    cursor: pointer;
}
.crow__step:hover { background: #7e1329; color: #fff; border-color: #7e1329; }

.crow__n {
    min-width: 18px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* --- кто за столом --- */
.cart-people {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0 16px 10px;
    list-style: none;
}

.cart-people__one {
    padding: 3px 10px;
    font-size: 11.5px;
    border-radius: 999px;
    background: rgba(18, 34, 45, 0.06);
    color: #8a8078;
}
.cart-people__one.is-me {
    background: #7e1329;
    color: #fff;
    font-weight: 700;
}

/* --- своя сумма отдельной строкой --- */
.cart-mine {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(126, 19, 41, 0.2);
    font-size: 13px;
    font-weight: 700;
    color: #7e1329;
}

/* --- сообщение о потере связи --- */
.cart-flash {
    position: fixed;
    left: 50%;
    bottom: 90px;
    z-index: 120;
    transform: translateX(-50%);
    margin: 0;
    padding: 8px 16px;
    font-size: 13px;
    color: #fff;
    background: rgba(18, 34, 45, 0.9);
    border-radius: 999px;
}

/* --- знакомство за столом --- */
.hello {
    position: fixed;
    inset: 0;
    z-index: 130;
    display: grid;
    place-items: center;
    padding: 20px;
}
.hello[hidden] { display: none; }

.hello__veil { position: absolute; inset: 0; background: rgba(18, 34, 45, 0.55); }

.hello__card {
    position: relative;
    width: min(380px, 100%);
    padding: 22px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.hello__title {
    margin: 0 0 8px;
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 19px;
    font-weight: 400;
}

.hello__note { margin: 0 0 14px; font-size: 13px; line-height: 1.5; color: #8a8078; }

.hello__input {
    width: 100%;
    padding: 11px 13px;
    font: inherit;
    font-size: 16px;             /* меньше 16 - iOS зумит страницу на фокусе */
    border: 1px solid rgba(126, 19, 41, 0.25);
    border-radius: 10px;
}
.hello__input:focus { outline: none; border-color: #7e1329; }

.hello__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.hello__skip {
    padding: 0;
    font: inherit;
    font-size: 13px;
    color: #8a8078;
    background: none;
    border: 0;
    cursor: pointer;
}
.hello__skip:hover { color: #7e1329; }

.hello__go {
    padding: 10px 22px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: #7e1329;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
}
.hello__go:hover { background: #5e0e1f; }
