/* =============================================================
   TABUTECH Cart Widget — cart.css
   ============================================================= */

.ttc-wrap {
    --accent:   #5b5bd6;
    --accent-h: #4a4abf;
    --bg:       #f2f2f8;
    --white:    #ffffff;
    --border:   #e4e4f0;
    --muted:    #888899;
    --dark:     #1a1a2e;
    --body:     #3a3a5c;
    --red:      #dc2626;
    --green:    #16a34a;
    --r:        12px;
    --r-sm:     8px;
    --r-pill:   999px;
    --font:     inherit;
    font-family: var(--font);
    color: var(--dark);
    font-size: 14px;
    line-height: 1.5;
    /* overflow fix — horizontal scroll-ის თავიდან ასაცილებლად */
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* accent helpers (overridden by Elementor color control) */
.ttc-accent-bg    { background-color: var(--accent) !important; }
.ttc-accent-color { color: var(--accent) !important; }

/* ── EMPTY ──────────────────────────────────────────────── */
.ttc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 64px 24px;
    text-align: center;
}
.ttc-empty-icon { opacity: .55; }
.ttc-empty-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.02em;
}
.ttc-empty-sub { color: var(--muted); font-size: 14px; }
/* empty state — AJAX fade-in */
.ttc-empty.ttc-shown {
    animation: ttc-fadein .3s ease;
}
@keyframes ttc-fadein {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ── PAGE HEAD ──────────────────────────────────────────── */
.ttc-page-head {
    text-align: center;
    margin-bottom: 24px;
}
.ttc-page-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.02em;
    margin-bottom: 8px;
}
.ttc-page-count {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--body);
}
.ttc-count-badge {
    width: 26px; height: 26px;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: grid; place-items: center;
}

/* ── LAYOUT ─────────────────────────────────────────────── */
.ttc-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 16px;
    align-items: start;
}

/* ── CARD ───────────────────────────────────────────────── */
.ttc-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}

/* ── TABLE HEAD ─────────────────────────────────────────── */
.ttc-thead {
    display: grid;
    grid-template-columns: 2.5fr 90px 150px 100px 40px;
    padding: 10px 20px;
    background: #f8f8fc;
    border-bottom: 1px solid var(--border);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* ── ITEM ───────────────────────────────────────────────── */
.ttc-items-list { padding: 0 6px; }

.ttc-item {
    display: grid;
    grid-template-columns: 2.5fr 90px 150px 100px 40px;
    align-items: center;
    padding: 16px 14px;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}
.ttc-item:last-child { border-bottom: none; }
.ttc-item:hover { background: #fafafd; }

/* removing animation */
.ttc-item.is-removing {
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity .25s ease, transform .25s ease;
}

/* product cell */
.ttc-item-product {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.ttc-item-img-wrap {
    flex-shrink: 0;
    width: 60px; height: 60px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    background: #f5f5fa;
    display: flex; align-items: center; justify-content: center;
}
.ttc-item-img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
}
.ttc-item-meta { min-width: 0; }
.ttc-item-name {
    display: block;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--dark);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    transition: color .15s;
}
.ttc-item-name:hover { color: var(--accent); }
.ttc-item-sku {
    display: block;
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 2px;
}

/* price */
.ttc-item-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--body);
}

/* quantity */
.ttc-item-qty-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--r-pill);
    width: fit-content;
    overflow: hidden;
}
.ttc-qty-btn {
    width: 34px; height: 34px;
    border: none;
    background: transparent;
    color: var(--body);
    font-size: 18px;
    font-weight: 400;
    cursor: pointer;
    display: grid; place-items: center;
    transition: background .15s, color .15s;
    flex-shrink: 0;
    line-height: 1;
}
.ttc-qty-btn:hover {
    background: var(--accent);
    color: #fff;
}
.ttc-qty-btn:disabled {
    opacity: .35;
    cursor: not-allowed;
    pointer-events: none;
}
.ttc-qty-input {
    width: 40px;
    border: none;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    text-align: center;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    background: transparent;
    height: 34px;
    outline: none;
    -moz-appearance: textfield;
}
.ttc-qty-input::-webkit-outer-spin-button,
.ttc-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* subtotal */
.ttc-item-subtotal {
    font-size: 15px;
    font-weight: 700;
}

/* remove button */
.ttc-remove-btn {
    width: 32px; height: 32px;
    border: 1.5px solid var(--border);
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: grid; place-items: center;
    transition: background .15s, border-color .15s, color .15s;
    flex-shrink: 0;
}
.ttc-remove-btn:hover {
    background: #fff0f0;
    border-color: var(--red);
    color: var(--red);
}
.ttc-remove-btn.is-loading {
    pointer-events: none;
    opacity: .5;
}

/* ── CARD FOOTER ────────────────────────────────────────── */
.ttc-card-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.ttc-coupon-row {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    min-width: 200px;
}
.ttc-coupon-input {
    flex: 1;
    height: 38px;
    border: 1.5px solid var(--border);
    border-right: none;
    border-radius: var(--r-sm) 0 0 var(--r-sm);
    padding: 0 14px;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--dark);
    outline: none;
    background: var(--white);
    transition: border-color .15s;
}
.ttc-coupon-input:focus { border-color: var(--accent); }
.ttc-coupon-input::placeholder { color: #bbbbd0; }
.ttc-coupon-btn {
    height: 38px;
    padding: 0 18px;
    border: none;
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    color: #fff;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: filter .15s;
}
.ttc-coupon-btn:hover { filter: brightness(1.1); }
.ttc-coupon-btn:disabled { opacity: .6; cursor: not-allowed; }

.ttc-link-back {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
    transition: color .15s;
}
.ttc-link-back:hover { color: var(--accent); }

/* applied coupon tags */
.ttc-coupon-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 14px;
}
.ttc-coupon-tags:empty { display: none; }
.ttc-coupon-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--r-pill);
    color: var(--green);
    font-size: 12px;
    font-weight: 600;
}
.ttc-coupon-tag-rm {
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    opacity: .7;
    transition: opacity .15s;
}
.ttc-coupon-tag-rm:hover { opacity: 1; }

/* ── SUMMARY ────────────────────────────────────────────── */
.ttc-summary {
    padding: 20px;
    position: sticky;
    top: 80px;
}
.ttc-summary-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.ttc-summary-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
.ttc-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13.5px;
    color: var(--body);
}
.ttc-summary-row strong { font-weight: 600; color: var(--dark); }
.ttc-discount-val { color: var(--green) !important; }
.ttc-summary-total {
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 15px;
    font-weight: 700;
}
.ttc-summary-total strong {
    font-size: 18px;
    font-weight: 800;
    color: var(--dark) !important;
}

/* checkout button */
.ttc-btn-checkout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 20px;
    border-radius: var(--r-sm);
    color: #fff;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: filter .15s, transform .1s;
}
.ttc-btn-checkout:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

/* ── TOAST ──────────────────────────────────────────────── */
.ttc-toasts {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.ttc-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--r-sm);
    background: var(--dark);
    color: #fff;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
    transform: translateY(12px);
    opacity: 0;
    transition: opacity .25s, transform .25s;
    pointer-events: auto;
    min-width: 220px;
    max-width: 360px;
}
.ttc-toast.show { opacity: 1; transform: translateY(0); }
.ttc-toast.is-success { background: #166534; }
.ttc-toast.is-error   { background: #991b1b; }
.ttc-toast svg { flex-shrink: 0; }

/* ── SKELETON LOADING ───────────────────────────────────── */
.ttc-skeleton {
    animation: ttc-pulse 1.4s ease-in-out infinite;
    background: linear-gradient(90deg, #eee 25%, #f8f8f8 50%, #eee 75%);
    background-size: 200%;
    border-radius: 4px;
}
@keyframes ttc-pulse {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── MOBILE RESPONSIVE ──────────────────────────────────── */

/* wrapper — overflow fix, horizontal scroll-ის თავიდან ასაცილებლად */
.ttc-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* tablet — 2 კოლონიდან 1-ზე */
@media (max-width: 900px) {
    .ttc-layout {
        grid-template-columns: 1fr;
    }
    .ttc-col-side {
        order: -1;
    }
    .ttc-summary {
        position: static;
    }
}

/* Elementor mobile breakpoint — 767px */
@media (max-width: 767px) {
    /* thead დამალვა */
    .ttc-thead { display: none; }

    /* items — flex card layout */
    .ttc-item {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        padding: 14px 12px;
        position: relative;
        width: 100%;
        box-sizing: border-box;
    }
    .ttc-item-product {
        flex: 1 1 100%;
        padding-right: 40px;
        min-width: 0;
    }
    .ttc-item-price {
        flex: 1;
        font-size: 13px;
        color: var(--muted);
        align-self: center;
    }
    .ttc-item-price::before {
        content: 'ფასი: ';
        font-weight: 400;
    }
    .ttc-item-qty-wrap {
        flex: 0;
        align-self: center;
    }
    .ttc-item-subtotal {
        flex: 1;
        text-align: right;
        font-size: 16px;
        align-self: center;
    }
    .ttc-remove-btn {
        position: absolute;
        top: 14px;
        right: 12px;
    }

    /* item name — სრული სიგანე */
    .ttc-item-name {
        max-width: 100%;
        white-space: normal;
        word-break: break-word;
    }

    /* footer */
    .ttc-card-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .ttc-coupon-row {
        min-width: 0;
        width: 100%;
    }
    .ttc-link-back { text-align: center; }

    /* summary */
    .ttc-summary { padding: 16px; }

    /* toasts */
    .ttc-toasts {
        bottom: 12px;
        right: 12px;
        left: 12px;
    }
    .ttc-toast {
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }
}

/* small phones */
@media (max-width: 420px) {
    .ttc-page-title { font-size: 20px; }

    .ttc-item-qty-wrap {
        transform: scale(0.9);
        transform-origin: left center;
    }
}

/* ── MOBILE OVERFLOW FIX (767px) ── */
@media (max-width: 767px) {

    /* root fix — Elementor container-ში overflow */
    .ttc-wrap,
    .ttc-wrap * {
        box-sizing: border-box;
    }
    .ttc-wrap {
        overflow-x: hidden;
        width: 100%;
    }

    /* cards — არ გადის */
    .ttc-card,
    .ttc-summary {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    /* summary rows — wrap + ფასი არ გაჭრა */
    .ttc-summary-row {
        flex-wrap: wrap;
        gap: 4px;
    }
    .ttc-summary-row strong,
    .ttc-summary-row span {
        word-break: break-word;
    }

    /* summary padding შემცირება */
    .ttc-summary {
        padding: 14px 12px;
    }
    .ttc-summary-title {
        font-size: 15px;
    }
    .ttc-summary-total strong {
        font-size: 16px;
    }

    /* layout — სრული სიგანე */
    .ttc-layout,
    .ttc-col-main,
    .ttc-col-side {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
}

