/* ═══════════════════════════════════════════════════════════════════════════
   TABUTECH v14 — კალათა და ანგარიშის პანელები
   მობილური: ქვედა ფურცელი (ქვედა ნავიგაციის ზემოთ). დესკტოპი: გვერდითი პანელი.
   ═══════════════════════════════════════════════════════════════════════════ */

.tbp-sheet {
    --tbp-brand: var(--hd-brand, #5b4ce6);
    --tbp-ink: var(--hd-ink, #171a3a);
    --tbp-muted: #7c8099;
    --tbp-line: #eceef7;
    --tbp-soft: #eef0ff;
    font-family: var(--tabutech-font-family, inherit);
    color: var(--tbp-ink);
}

@supports (background: color-mix(in srgb, red 10%, white)) {
    .tbp-sheet { --tbp-soft: color-mix(in srgb, var(--hd-brand, #5b4ce6) 10%, #ffffff); }
}

.tbp-sheet a { text-decoration: none; }
.tbp-sheet .tbp-i { display: block; flex-shrink: 0; }

/* ── თავი ── */
.tbp-sheet .tbp-head {
    padding: 18px 22px 14px;
    background: #fff;
    border-bottom: 0.5px solid var(--tbp-line);
}
.tbp-sheet .tbp-head b { font-size: 17px; font-weight: 700; color: var(--tbp-ink); }
.tbp-sheet .tbp-head small { font-size: 12px; color: var(--tbp-muted); margin-left: 8px; font-weight: 400; }
.tbp-sheet .tbp-head span { font-size: inherit; font-weight: inherit; color: inherit; }

.tbp-sheet .tbp-x {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f1f2f8;
    color: #5b6080;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.15s;
}
.tbp-sheet .tbp-x:hover { background: #e4e6f2; }
.tbp-sheet .tbp-grab { display: none; }

/* ── ღილაკები ── */
.tbp-sheet .tbp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 14px;
    background: var(--tbp-brand);
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s;
}
.tbp-sheet .tbp-btn:hover { box-shadow: 0 8px 20px rgba(23, 26, 58, 0.2); }
.tbp-sheet .tbp-btn:active { transform: scale(0.985); }
.tbp-sheet .tbp-btn:disabled { opacity: 0.6; cursor: default; }
.tbp-sheet .tbp-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--tbp-brand) 40%, transparent); outline-offset: 2px; }

/* ── უფასო მიწოდების ზოლი ── */
.tbp-sheet .tbp-ship.tabutech-header__cart-upsell {
    margin: 12px 18px 4px;
    padding: 10px 12px;
    background: var(--tbp-soft);
    border-radius: 12px;
    color: #3c3489;
    flex-shrink: 0;
}
.tbp-sheet .tbp-ship-row { display: flex; align-items: center; gap: 8px; }
.tbp-sheet .tbp-ship .tabutech-header__cart-upsell-text { font-size: 12px; line-height: 1.4; margin: 0; color: inherit; }
.tbp-sheet .tbp-ship .tabutech-header__cart-upsell-text strong { color: inherit; font-weight: 700; }
.tbp-sheet .tbp-ship .tabutech-header__cart-upsell-bar {
    height: 5px;
    margin: 8px 0 0;
    border-radius: 3px;
    background: rgba(91, 76, 230, 0.18);
    overflow: hidden;
}
.tbp-sheet .tbp-ship .tabutech-header__cart-upsell-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--tbp-brand);
    transition: width 0.4s ease;
}
.tbp-sheet .tbp-ship.tabutech-header__cart-upsell--complete { background: #e7f7ee; color: #0f7a4a; }
.tbp-sheet .tbp-ship.tabutech-header__cart-upsell--complete .tabutech-header__cart-upsell-bar { background: rgba(15, 122, 74, 0.18); }
.tbp-sheet .tbp-ship.tabutech-header__cart-upsell--complete .tabutech-header__cart-upsell-fill { background: #16a34a; }

/* ── კალათის სხეული ── */
.tbp-cartbody {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.tbp-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 18px;
    scrollbar-width: thin;
}

.tbp-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 0.5px solid var(--tbp-line);
    transition: opacity 0.15s;
}
.tbp-item:last-child { border-bottom: 0; }
.tbp-item.is-busy { opacity: 0.55; pointer-events: none; }

.tbp-img {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: #f1f2f8;
    overflow: hidden;
    display: block;
}
.tbp-img img { width: 100%; height: 100%; object-fit: contain; display: block; max-width: none; }

.tbp-main { flex: 1; min-width: 0; }
.tbp-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.35;
    color: var(--tbp-ink);
    font-weight: 500;
}
a.tbp-title:hover { color: var(--tbp-brand); }

.tbp-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 8px;
    background: var(--tbp-soft);
    color: var(--tbp-brand);
    font-size: 11px;
    font-weight: 600;
}

.tbp-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }

.tbp-price { font-size: 15px; font-weight: 600; color: var(--tbp-ink); white-space: nowrap; }
.tbp-price s { font-size: 12px; font-weight: 400; color: #8a90b8; margin-right: 6px; }
.tbp-price.is-sale { color: #d92d20; }
.tbp-price .woocommerce-Price-currencySymbol { font-weight: inherit; }

.tbp-stepper {
    display: inline-flex;
    align-items: center;
    height: 32px;
    border: 0.5px solid #d5d8e6;
    border-radius: 10px;
    background: #fff;
    flex-shrink: 0;
}
.tbp-stepper button {
    width: 32px;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: #5b6080;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 10px;
}
.tbp-stepper button:hover { background: #f1f2f8; color: var(--tbp-ink); }
.tbp-stepper button:disabled { opacity: 0.35; cursor: default; background: transparent; }
.tbp-stepper button:focus-visible { outline: 2px solid var(--tbp-brand); outline-offset: -2px; }
.tbp-minus:has(.tbp-i path[d^="M4 7h16"]) { color: #b42318; }
.tbp-qty { min-width: 26px; text-align: center; font-size: 13px; font-weight: 500; color: var(--tbp-ink); }

.tbp-sum { margin-top: 5px; font-size: 12px; color: #8a90b8; }
.tbp-err { font-size: 12px; color: #b42318; margin-top: 4px; min-height: 0; }
.tbp-err:empty { display: none; }

/* ── ჯამი და გადახდა (ბოლოში მიმაგრებული) ── */
.tbp-foot {
    flex: 0 0 auto;
    padding: 12px 18px 16px;
    background: #fff;
    border-top: 0.5px solid var(--tbp-line);
    box-shadow: 0 -8px 20px rgba(23, 26, 58, 0.04);
}
.tbp-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; font-size: 13px; color: var(--tbp-muted); }
.tbp-row b { font-size: 18px; font-weight: 700; color: var(--tbp-ink); }
.tbp-lnk { display: block; text-align: center; margin-top: 10px; font-size: 13px; color: var(--tbp-brand); font-weight: 500; }
.tbp-lnk:hover { text-decoration: underline; }

/* ── ცარიელი კალათა ── */
.tbp-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px 28px;
    text-align: center;
}
.tbp-empty-ic {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--tbp-soft);
    color: var(--tbp-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.tbp-empty b { font-size: 16px; font-weight: 600; }
.tbp-empty p { margin: 0 0 14px; font-size: 13px; color: var(--tbp-muted); }
.tbp-empty .tbp-btn { max-width: 260px; }

/* ── ანგარიში ── */
.tbp-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 18px 18px; display: flex; flex-direction: column; }

.tbp-who {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
    background: var(--tbp-brand);
    color: #fff;
    flex-shrink: 0;
}
.tbp-av {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
}
.tbp-who b { display: block; font-size: 16px; font-weight: 600; line-height: 1.25; }
.tbp-who small { font-size: 12px; opacity: 0.85; word-break: break-all; }

.tbp-last {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 11px 14px;
    border: 0.5px solid #e3e5f0;
    border-radius: 14px;
    color: inherit;
    flex-shrink: 0;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tbp-last:hover { border-color: var(--tbp-brand); box-shadow: 0 4px 14px rgba(23, 26, 58, 0.07); }
.tbp-last .tbp-lt { display: flex; flex-direction: column; min-width: 0; }
.tbp-last .tbp-lt b { font-size: 13px; font-weight: 600; }
.tbp-last .tbp-lt small { font-size: 12px; color: var(--tbp-muted); }

.tbp-ic {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--tbp-soft);
    color: var(--tbp-brand);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tbp-tag {
    margin-left: auto;
    padding: 4px 8px;
    border-radius: 8px;
    background: #fff4d6;
    color: #8a5a00;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.tbp-tag--processing { background: #e3f6ec; color: #0f7a4a; }
.tbp-tag--pending, .tbp-tag--on-hold { background: #fff4d6; color: #8a5a00; }

.tbp-more { display: block; margin: 8px 4px 0; font-size: 12px; color: var(--tbp-brand); font-weight: 500; }

.tbp-rows { margin-top: 8px; flex-shrink: 0; }
.tbp-r {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 56px;
    border-bottom: 0.5px solid var(--tbp-line);
    color: inherit;
}
.tbp-r:last-child { border-bottom: 0; }
.tbp-r .tbp-ic { background: #f4f5fa; color: #5b6080; transition: background-color 0.15s, color 0.15s; }
.tbp-r:hover .tbp-ic { background: var(--tbp-soft); color: var(--tbp-brand); }
.tbp-r .tbp-l { font-size: 14px; }
.tbp-r .tbp-ch { margin-left: auto; color: #b1b5cb; }
.tbp-r .tbp-n {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--tbp-brand);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tbp-out {
    margin-top: auto;
    flex-shrink: 0;
    height: 46px;
    border-radius: 14px;
    background: #f4f5fa;
    color: #5b6080;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    transition: background-color 0.15s, color 0.15s;
}
.tbp-out:hover { background: #fdecea; color: #b42318; }
.tbp-account .tbp-rows + .tbp-out { margin-top: 16px; }
@media (max-width: 768px) { .tbp-account .tbp-rows + .tbp-out { margin-top: auto; } }

/* ── შესვლა ── */
.tbp-seg { display: flex; padding: 3px; background: #f1f2f8; border-radius: 12px; flex-shrink: 0; }
.tbp-seg > * { flex: 1; text-align: center; padding: 9px 0; border-radius: 10px; font-size: 13px; color: var(--tbp-muted); }
.tbp-seg .on { background: #fff; color: var(--tbp-ink); font-weight: 600; box-shadow: 0 1px 3px rgba(23, 26, 58, 0.12); }
.tbp-seg a:hover { color: var(--tbp-brand); }

.tbp-login .tabutech-header__auth-alert { margin: 14px 0 0; font-size: 13px; border-width: 1px; }
.tbp-form { margin-top: 16px; }
.tbp-f { margin-bottom: 12px; }
.tbp-f label { display: block; font-size: 12px; color: var(--tbp-muted); margin-bottom: 5px; }
.tbp-fld {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 48px;
    padding: 0 12px;
    border: 1px solid #d5d8e6;
    border-radius: 12px;
    background: #fff;
    color: #8a90b8;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tbp-fld:focus-within { border-color: var(--tbp-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tbp-brand) 18%, transparent); }
.tbp-fld input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0;
    font-family: inherit;
    font-size: 16px;   /* iOS-ზე ზუმი არ ჩნდება */
    color: var(--tbp-ink);
}
.tbp-eye { border: 0; background: transparent; padding: 6px; margin-right: -6px; color: #8a90b8; cursor: pointer; display: flex; border-radius: 8px; }
.tbp-eye:hover { color: var(--tbp-ink); }
.tbp-eye .tbp-eye-off { display: none; }
.tbp-eye.is-on .tbp-eye-on { display: none; }
.tbp-eye.is-on .tbp-eye-off { display: block; }

.tbp-mid { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 16px; font-size: 13px; }
.tbp-mid a { color: var(--tbp-brand); font-weight: 500; }
.tbp-chk { display: inline-flex; align-items: center; gap: 8px; color: #5b6080; cursor: pointer; }
.tbp-chk input { width: 16px; height: 16px; margin: 0; accent-color: var(--tbp-brand); }
.tbp-note { margin: 18px 4px 0; font-size: 12px; line-height: 1.5; color: #8a90b8; text-align: center; }

/* ═════════════ დესკტოპი: გვერდითი პანელი ═════════════ */
@media (min-width: 769px) {
    .tabutech-header__sidebar.tbp-sheet { width: 400px; }
    .tbp-sheet .tbp-cartbody { min-height: 0; }
}

/* ═════════════ მობილური: ქვედა ფურცელი ═════════════ */
@media (max-width: 768px) {
    .tabutech-header__sidebar.tbp-sheet {
        top: max(64px, 8vh);
        bottom: calc(58px + env(safe-area-inset-bottom, 0px));
        left: 0;
        right: 0;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -12px 40px rgba(23, 26, 58, 0.28);
        transform: translateY(105%);
        overflow: hidden;
    }
    .tabutech-header__sidebar--right.tbp-sheet.active { transform: none; }

    .tbp-sheet .tbp-grab {
        display: block;
        width: 38px;
        height: 4px;
        margin: 9px auto 0;
        border-radius: 2px;
        background: #d5d8e6;
        flex-shrink: 0;
        touch-action: none;
    }
    .tbp-sheet .tbp-head { padding: 10px 18px 12px; touch-action: none; border-bottom: 0; }
    .tbp-sheet .tbp-head b { font-size: 16px; }
    .tbp-foot { padding-bottom: 14px; }
    .tbp-body { padding-bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .tbp-sheet * { transition-duration: 0.01ms !important; }
}
