/**
 * KDS Floating Cart – Minimal
 *
 * CSS custom properties (injected inline):
 *   --kfc-bg, --kfc-icon, --kfc-vert, --kfc-horz
 *
 * Position: .kfc-bottom-right | .kfc-bottom-left | .kfc-top-right | .kfc-top-left
 */

:root {
    --kfc-bg: #6404b7;
    --kfc-icon: #ffffff;
    --kfc-vert: 24px;
    --kfc-horz: 24px;
}

/* ── Trigger ────────────────────────────────────────────────────── */
.kdsamref-cart-trigger {
    position: fixed;
    z-index: 9990;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--kfc-bg);
    color: var(--kfc-icon);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    padding: 0;
    outline: none;
}

.kdsamref-cart-trigger.kfc-bottom-right {
    bottom: var(--kfc-vert);
    right: var(--kfc-horz);
    top: auto;
    left: auto;
}

.kdsamref-cart-trigger.kfc-bottom-left {
    bottom: var(--kfc-vert);
    left: var(--kfc-horz);
    top: auto;
    right: auto;
}

.kdsamref-cart-trigger.kfc-top-right {
    top: var(--kfc-vert);
    right: var(--kfc-horz);
    bottom: auto;
    left: auto;
}

.kdsamref-cart-trigger.kfc-top-left {
    top: var(--kfc-vert);
    left: var(--kfc-horz);
    bottom: auto;
    right: auto;
}

/* Legacy compat */
.kdsamref-cart-trigger.kfc-right {
    bottom: var(--kfc-vert);
    right: var(--kfc-horz);
    top: auto;
    left: auto;
}

.kdsamref-cart-trigger.kfc-left {
    bottom: var(--kfc-vert);
    left: var(--kfc-horz);
    top: auto;
    right: auto;
}

.kdsamref-cart-trigger:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.kdsamref-cart-trigger:active {
    transform: scale(0.95);
}

.kdsamref-cart-trigger.kfc-bounce {
    animation: kfc-bounce 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes kfc-bounce {
    0% {
        transform: scale(1);
    }

    20% {
        transform: scale(1.25);
    }

    40% {
        transform: scale(0.9);
    }

    60% {
        transform: scale(1.12);
    }

    80% {
        transform: scale(0.97);
    }

    100% {
        transform: scale(1);
    }
}

.kdsamref-cart-icon {
    display: block;
}

/* Badge */
.kdsamref-cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: #fff;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.2s, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.kdsamref-cart-count.visible {
    opacity: 1;
    transform: scale(1);
}

/* ── Backdrop ───────────────────────────────────────────────────── */
.kdsamref-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9991;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.kdsamref-cart-overlay.open {
    opacity: 1;
    pointer-events: all;
}

/* ── Drawer ─────────────────────────────────────────────────────── */
.kdsamref-cart-drawer {
    position: fixed;
    top: 0;
    width: min(600px, 100vw);
    height: 100%;
    z-index: 9992;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 16px 40px rgba(0, 0, 0, 0.1);
    will-change: transform;
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

.kdsamref-cart-drawer.kfc-right,
.kdsamref-cart-drawer.kfc-bottom-right,
.kdsamref-cart-drawer.kfc-top-right {
    right: 0;
    left: auto;
    transform: translateX(100%);
}

.kdsamref-cart-drawer.kfc-right.open,
.kdsamref-cart-drawer.kfc-bottom-right.open,
.kdsamref-cart-drawer.kfc-top-right.open {
    transform: translateX(0);
}

.kdsamref-cart-drawer.kfc-left,
.kdsamref-cart-drawer.kfc-bottom-left,
.kdsamref-cart-drawer.kfc-top-left {
    left: 0;
    right: auto;
    transform: translateX(-100%);
}

.kdsamref-cart-drawer.kfc-left.open,
.kdsamref-cart-drawer.kfc-bottom-left.open,
.kdsamref-cart-drawer.kfc-top-left.open {
    transform: translateX(0);
}

/* ── Header ─────────────────────────────────────────────────────── */
.kdsamref-cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.kdsamref-cart-drawer-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.01em;
}

.kdsamref-cart-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #555555;
    font-size: 24px;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.15s;
}

.kdsamref-cart-close:hover {
    color: #333;
}

/* ── Items ──────────────────────────────────────────────────────── */
.kdsamref-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.kdsamref-cart-items::-webkit-scrollbar {
    width: 3px;
}

.kdsamref-cart-items::-webkit-scrollbar-track {
    background: transparent;
}

.kdsamref-cart-items::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 3px;
}

/* Loading */
.kdsamref-cart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #bbb;
    padding: 48px 0;
    font-size: 13px;
}

.kdsamref-cart-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #eee;
    border-top-color: #555555;
    border-radius: 50%;
    animation: kfc-spin 0.7s linear infinite;
}

@keyframes kfc-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Item ───────────────────────────────────────────────────────── */
.kdsamref-cart-item {
    display: flex;
    gap: 14px;
    padding: 16px 24px;
    border-bottom: 1px solid #f5f5f5;
    align-items: flex-start;
}

.kdsamref-cart-item:last-child {
    border-bottom: none;
}

.kdsamref-cart-item.is-removing {
    opacity: 0.35;
    pointer-events: none;
}

.kdsamref-cart-dine-in-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: color-mix(in srgb, var(--kfc-bg) 7%, transparent);
    color: var(--kfc-bg);
    padding: 10px 24px;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid #f0f0f0;
}

.kdsamref-cart-dine-in-banner svg {
    flex-shrink: 0;
    opacity: 0.8;
}

/* ── Dine-in Gate (Shortcode) ─────────────────────────────────── */
.kdsamref-dine-in-gate {
    text-align: center;
    padding: 64px 32px;
    background: #fdfdfd;
    border: 2px dashed #eee;
    border-radius: 16px;
    margin: 20px 0;
}

.kdsamref-dine-in-gate svg {
    color: #cbd5e0;
    margin-bottom: 16px;
}

.kdsamref-dine-in-gate h3 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    color: #2d3748;
}

.kdsamref-dine-in-gate p {
    margin: 0;
    color: #718096;
    font-size: 15px;
}

.kdsamref-cart-item-img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    background: #f4f4f4;
    display: block;
}

.kdsamref-cart-item-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    background: #f4f4f4;
    flex-shrink: 0;
}

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

.kdsamref-cart-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin-bottom: 3px;
}

.kdsamref-cart-item-meta {
    font-size: 12px;
    color: #585858;
    line-height: 1.45;
    margin-bottom: 8px;
}

.kdsamref-cart-addon-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    padding: 2px 0;
}

.kdsamref-cart-addon-label {
    font-weight: 600;
    color: #585858;
    white-space: nowrap;
}

.kdsamref-cart-addon-label::after {
    content: ':';
}

.kdsamref-cart-addon-value {
    flex: 1;
    min-width: 0;
    font-weight: 400;
    color: #555555;
}

.kdsamref-cart-addon-price {
    margin-left: auto;
    white-space: nowrap;
    color: #555;
    font-weight: 500;
    font-size: 11px;
}

span.kdsamref-cart-addon-sw {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 4px;
    margin-left: 4px;
    border: 1px solid rgba(0, 0, 0, .1);
    flex-shrink: 0;
}

img.kdsamref-cart-addon-sw {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.kdsamref-cart-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.kdsamref-cart-item-modify {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: 1px solid #e8e8e8;
    border-radius: 7px;
    height: 32px;
    padding: 0 12px;
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    line-height: 1;
}

.kdsamref-cart-item-modify svg {
    flex-shrink: 0;
}

.kdsamref-cart-item-modify:hover {
    background: #f8f8f8;
    color: #1a1a1a;
    border-color: #dcdcdc;
}

.kdsamref-cart-item-meta dt {
    display: inline;
    font-weight: 600;
    color: #777;
}

.kdsamref-cart-item-meta dt::after {
    content: ': ';
}

.kdsamref-cart-item-meta dd {
    display: inline;
    margin: 0;
}

.kdsamref-cart-item-meta dd::after {
    content: '\A';
    white-space: pre;
}

.kdsamref-cart-item-meta p {
    margin: 0;
}

.kdsamref-cart-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* Qty stepper */
.kdsamref-cart-item-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid #e8e8e8;
    border-radius: 7px;
    overflow: hidden;
}

.kdsamref-cart-qty-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #555;
    transition: background 0.12s;
    line-height: 1;
    flex-shrink: 0;
}

.kdsamref-cart-qty-btn:hover {
    background: #f5f5f5;
}

.kdsamref-cart-qty-val {
    min-width: 24px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
    padding: 0 2px;
}

.kdsamref-cart-item-price {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

/* Remove */
.kdsamref-cart-item-remove {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 2px;
    font-size: 16px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.12s;
    flex-shrink: 0;
    align-self: flex-start;
}

.kdsamref-cart-item-remove:hover {
    color: #e53e3e;
}

/* ── Empty ──────────────────────────────────────────────────────── */
.kdsamref-cart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 72px 32px;
    color: #bbb;
    font-size: 15px;
}

.kdsamref-cart-empty p {
    margin: 0;
}

/* ── Footer ─────────────────────────────────────────────────────── */
.kdsamref-cart-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

/* Summary breakdown */
.kdsamref-cart-summary {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 14px;
}

.kdsamref-cart-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0px 0;
}

.kdsamref-cart-row-label {
    font-size: 13px;
    color: #585858;
}

.kdsamref-cart-row-value {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
}

.kdsamref-cart-row-free {
    color: var(--kfc-bg);
    font-weight: 700;
}

.kdsamref-cart-row--total {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.kdsamref-cart-row--total .kdsamref-cart-row-label {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
}

.kdsamref-cart-row--total .kdsamref-cart-row-value {
    font-size: 18px;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: -0.02em;
}

.kdsamref-cart-total-note {
    font-size: 11px;
    font-weight: 400;
    color: #585858;
    margin-left: 4px;
}

.kdsamref-cart-checkout-btn {
    display: block;
    background: var(--kfc-bg);
    color: var(--kfc-icon);
    text-align: center;
    padding: 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
    text-decoration: none;
    transition: opacity 0.15s;
}

.kdsamref-cart-checkout-btn:hover {
    opacity: 0.9;
    color: var(--kfc-icon);
}

.kdsamref-cart-checkout-btn.kdsamref-btn-disabled {
    opacity: 1;
    pointer-events: none;
    cursor: not-allowed;
    background: #e8e8e8;
    color: #585858;
}

.kdsamref-cart-checkout-btn.kdsamref-btn-disabled:hover {
    opacity: 1;
    color: #585858;
}

/* ── Cart hints (min order, delivery, free shipping) ───────────── */
.kdsamref-cart-hints {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.kdsamref-cart-hint {
    font-size: 12px;
    color: #585858;
    line-height: 1;
}

.kdsamref-cart-hint-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 7px;
}

.kdsamref-cart-hint-label {
    color: #555555;
}

.kdsamref-cart-hint-value {
    font-weight: 700;
    color: #1a1a1a;
}

.kdsamref-cart-hint--addr {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #e62222;
    font-weight: 500;
    font-size: 14px;
    padding: 0px 0px 15px 0px;
    justify-content: center;
}

.kdsamref-cart-hint--addr svg {
    flex-shrink: 0;
}

.kdsamref-cart-hint--success {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--kfc-bg);
    font-weight: 600;
    font-size: 12px;
}

.kdsamref-cart-hint--error {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e53e3e;
    background: #fff5f5;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 500;
    border: 1px solid #feb2b2;
}

.kdsamref-cart-paused-banner {
    margin-bottom: 5px;
}

/* Minimal pill pause badge */
.kdsamref-cart-hint--paused-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 100px;
    background: #fff8ed;
    color: #92600a;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #ffd68a;
    width: auto;
    align-self: flex-start;
}

.kdsamref-cart-hint--paused-pill svg {
    flex-shrink: 0;
    color: #f59e0b;
}

.kdsamref-cart-drawer-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Minimal inline cart expiry */
.kdsamref-cart-expiry-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #585858;
    line-height: 1;
    font-weight: 500;
}

.kdsamref-cart-expiry-inline svg {
    color: #bbb;
    transition: color 0.3s;
}

.kdsamref-cart-expiry-inline .kdsamref-cart-expiry-timer {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    color: #585858;
    transition: color 0.3s;
}

/* Urgent state — last 2 minutes */
.kdsamref-cart-expiry-inline.is-urgent svg,
.kdsamref-cart-expiry-inline.is-urgent .kdsamref-cart-expiry-timer {
    color: #dc2626;
}

.kdsamref-cart-hint--error svg {
    flex-shrink: 0;
}

.kdsamref-min-order-bar {
    width: 100%;
    height: 4px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.kdsamref-min-order-fill {
    height: 100%;
    background: var(--kfc-bg);
    border-radius: 4px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}