/* Chat with the store team (plugin Chat\Chat + js/parts/chat.js). Floating button in web mode (brand red since r7, so it is
   not mistaken for WhatsApp), panel 360×520 bottom right on desktop, full screen on phones. Logo colors only. */

/* Floating button: same place and size as the WhatsApp button it replaces (.xwa in shell.css). */
.xwa.xwa--chat { border: 0; cursor: pointer; background: var(--red); box-shadow: 0 14px 30px -12px rgba(200, 20, 28, .55); }
.xwa.xwa--chat:hover { background: var(--red-hover, #C8141C); }
.xchat-badge { position: absolute; top: -5px; right: -5px; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 11px; background: var(--red); color: #fff; font: 800 11px/21px var(--display); font-style: normal; text-align: center; box-shadow: 0 0 0 2px #fff; }
.xchat-badge[hidden] { display: none; }
.sy-bar-ic .xchat-badge { top: 2px; right: 0; min-width: 18px; height: 18px; line-height: 18px; padding: 0 4px; font-size: 10.5px; }
.sy-hic .xchat-badge { top: 2px; right: 0; min-width: 18px; height: 18px; line-height: 18px; padding: 0 4px; font-size: 10.5px; background: #fff; color: var(--red-ink); box-shadow: none; }
.xchat-on .xwa, .xchat-on .xfloat { opacity: 0 !important; pointer-events: none !important; }

/* "Tanya produk ini" on the product page */
.xchat-ask { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; padding: 0 16px; border: 1.5px solid var(--line-2); border-radius: var(--r-sm, 8px); background: #fff; color: var(--ink); font: 700 15px/1 var(--display); cursor: pointer; transition: border-color .2s, background .2s; }
.xchat-ask:hover { border-color: var(--ink); background: #fff; }
.xchat-ask .ic { width: 20px; height: 20px; color: var(--red); }

/* Panel */
.xchat { position: fixed; right: 22px; bottom: calc(22px + var(--tab-h, 0px)); z-index: 95; display: flex; flex-direction: column; width: 360px; height: min(520px, calc(100vh - 44px - var(--tab-h, 0px))); background: #fff; border-radius: 16px; overflow: hidden; color: var(--ink); font: 14px/1.45 var(--body); box-shadow: 0 28px 60px -22px rgba(30, 26, 29, .5), 0 0 0 1px rgba(30, 26, 29, .08); opacity: 0; transform: translateY(14px); transition: opacity .2s, transform .28s var(--ease); }
.xchat[hidden] { display: none; }
.xchat.is-in { opacity: 1; transform: none; }
.xchat .ic { width: 20px; height: 20px; }
.xchat-head { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; background: #fff; color: var(--ink); box-shadow: inset 0 -1px 0 var(--line); }
.xchat-av { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--red); color: #fff; }
.xchat-who { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.xchat-who b { font: 800 15px/1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xchat-who small { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xchat-hb { flex: none; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.xchat-head .xchat-hb:hover { background: var(--bg); }
.xchat-back { display: none; }

.xchat-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 4px; padding: 14px 12px 10px; background: var(--linen, #FAF7F3); }
.xchat-wait { margin: auto; color: var(--ink-3); }
.xchat-day { align-self: center; margin: 8px 0 4px; padding: 3px 10px; border-radius: 999px; background: #fff; color: var(--ink-3); font-size: 11.5px; font-weight: 600; }
.xchat-row { display: flex; flex-direction: column; align-items: flex-start; align-self: flex-start; max-width: 84%; }
.xchat-row.is-me { align-self: flex-end; align-items: flex-end; }
.xchat-b { padding: 8px 12px; border-radius: 14px; background: #fff; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgba(30, 26, 29, .06); }
.is-them .xchat-b { border-top-left-radius: 4px; }
.is-me .xchat-b { background: var(--red-bg); border-top-right-radius: 4px; }
.xchat-b a { color: var(--red-ink); text-decoration: underline; }
.xchat-b a.xchat-card, .xchat-b a.xchat-card:hover { color: var(--ink); }
.xchat-by { display: block; margin-bottom: 2px; color: var(--red-ink); font: 800 11.5px/1.2 var(--display); }
.xchat-row--greet { max-width: 90%; }
.xchat-b--image, .xchat-b--product, .xchat-b--order { padding: 4px; background: #fff; }
.is-me .xchat-b--image, .is-me .xchat-b--product, .is-me .xchat-b--order { background: var(--red-bg); }
.xchat-b--image img { display: block; width: auto; max-width: 220px; max-height: 260px; height: auto; border-radius: 10px; object-fit: cover; }
.xchat-time { margin: 2px 4px 6px; color: var(--ink-3); font-size: 11px; }
.xchat-older { align-self: center; margin: 2px 0 8px; padding: 6px 14px; border: 1px solid var(--line-2); border-radius: 999px; background: #fff; color: var(--ink-2); font: 700 12.5px/1 var(--display); cursor: pointer; }

/* Product and order cards */
.xchat-card { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; align-items: center; width: 248px; max-width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); text-decoration: none !important; white-space: normal; }
a.xchat-card:hover { border-color: var(--line-2); }
.xchat-card-img { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: var(--line); }
.xchat-card-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.xchat-card-tx { display: grid; gap: 1px; min-width: 0; line-height: 1.3; }
.xchat-card-tx small { color: var(--ink-3); font: 700 10.5px/1.2 var(--display); letter-spacing: .05em; text-transform: uppercase; }
.xchat-card-tx b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; font-weight: 700; }
.xchat-card-tx em { color: var(--red-ink); font: 800 13.5px/1.3 var(--display); font-style: normal; }
.xchat-card-tx em i { color: var(--ink-3); font: 500 11.5px var(--body); font-style: normal; }
.xchat-card-tx em.is-gone { color: var(--ink-3); font-weight: 600; }
.xchat-card-go { margin-top: 2px; color: var(--red-ink); font-size: 12px; font-weight: 700; }
.xchat-card--order small { color: var(--red-ink); letter-spacing: 0; text-transform: none; font-size: 11.5px; }

/* Composer */
.xchat-att { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line); background: #fff; }
.xchat-att[hidden] { display: none; }
.xchat-att-item { position: relative; }
.xchat-att-item .xchat-card { width: 260px; background: #FAF9F9; }
.xchat-att-item--img img { display: block; width: 64px; height: 64px; border-radius: 8px; object-fit: cover; }
.xchat-att-x { position: absolute; top: -7px; right: -7px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: var(--red); color: #fff; cursor: pointer; }
.xchat-att-x .ic { width: 13px; height: 13px; }
.xchat-err { margin: 0; padding: 7px 12px; background: var(--red-bg); color: var(--red-ink); font-size: 12.5px; font-weight: 600; }
.xchat-err[hidden] { display: none; }
.xchat-form { display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; }
.xchat-pic { color: var(--ink-2); }
.xchat-pic:hover { background: var(--red-bg); color: var(--red-ink); }
.xchat-form textarea { flex: 1; min-width: 0; height: 40px; max-height: 120px; padding: 9px 14px; border: 1px solid var(--line-2); border-radius: 20px; background: #fff; color: var(--ink); font: 15px/1.35 var(--body); resize: none; }
.xchat-form textarea:focus { outline: 0; border-color: var(--ink-3); }
.xchat-send { flex: none; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: var(--red); color: #fff; cursor: pointer; }
.xchat-send:hover { background: var(--red-ink); }
.xchat-send[disabled] { opacity: .5; cursor: wait; }

/* Guest and staff */
.xchat-gate { flex: 1; display: grid; align-content: center; justify-items: center; gap: 10px; padding: 28px 26px; background: #F5F4F4; text-align: center; }
.xchat-gate-ic { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: var(--red-bg); color: var(--red); }
.xchat-gate-ic .ic { width: 28px; height: 28px; }
.xchat-gate h2 { margin: 4px 0 0; font: 800 18px/1.25 var(--display); }
.xchat-gate p { margin: 0 0 6px; color: var(--ink-2); font-size: 14px; }
.xchat-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 200px; height: 46px; padding: 0 22px; border-radius: var(--r-sm, 8px); background: var(--red); color: #fff !important; font: 700 15px/1 var(--display); text-decoration: none; }
.xchat-btn:hover { background: var(--red-ink); }
.xchat-wa { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; color: var(--ink-2) !important; font-weight: 600; font-size: 14px; }
.xchat-wa .ic { color: var(--wa); }
.xchat-wa:hover span { text-decoration: underline; }

@media (max-width: 760px) {
	.xchat { inset: 0; width: auto; height: 100vh; height: 100dvh; z-index: 115; border-radius: 0; box-shadow: none; transform: translateY(24px); }
	.xchat-head { padding: 8px 8px calc(8px) 4px; padding-top: calc(8px + env(safe-area-inset-top)); }
	.xchat-back { display: grid; }
	.xchat-x { display: none; }
	.xchat-row { max-width: 86%; }
	.xchat-att-item .xchat-card { width: min(260px, calc(100vw - 48px)); }
}
