/* ============================================================
   Joey Store — JoeyBot: Widget Chat CS (chatbot)
   Tema: Robux gold — mengikuti accent CTA + koin Robux.
   ============================================================ */

.cb-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 9990;
  width: 64px; height: 64px; border-radius: 22px; border: none;
  background: linear-gradient(135deg, #FFB020, #FF7A1A); color: #fff;
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 14px 34px -10px rgba(255, 122, 26, .6);
  transition: transform .15s ease, box-shadow .2s ease;
}
.cb-launcher:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 18px 40px -10px rgba(255, 122, 26, .7); }
.cb-launcher:active { transform: scale(.97); }
.cb-launcher .cb-dot {
  position: absolute; top: 4px; right: 4px; width: 15px; height: 15px;
  border-radius: 50%; background: var(--green); border: 3px solid #fff;
  animation: cbPulse 2s infinite;
}
@keyframes cbPulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); }
  70% { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.cb-panel {
  position: fixed; right: 24px; bottom: 104px; z-index: 9990;
  width: 384px; max-width: calc(100vw - 32px);
  height: 620px; max-height: calc(100vh - 136px);
  background: var(--card); border-radius: 24px; border: 1px solid var(--border);
  box-shadow: 0 28px 70px -20px rgba(15, 27, 51, .4);
  display: flex; flex-direction: column; overflow: hidden;
  transform-origin: bottom right; animation: cbIn .22s ease;
}
.cb-panel.closed { display: none; }
@keyframes cbIn {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to { opacity: 1; transform: none; }
}

/* ---------- header ---------- */
.cb-head {
  background: linear-gradient(135deg, #FFB020, #FF7A1A); color: #3A2A00;
  padding: 16px 16px 15px; display: flex; align-items: center; gap: 12px; flex: none;
  position: relative; overflow: hidden;
}
.cb-head::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px;
  border-radius: 50%; background: rgba(255, 255, 255, .22); pointer-events: none;
}
.cb-avatar {
  width: 44px; height: 44px; border-radius: 15px; background: #fff;
  color: var(--brand); font-family: var(--font-display); font-weight: 800;
  font-size: 22px; display: grid; place-items: center; flex: none; position: relative; z-index: 1;
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .25);
}
.cb-head h4 { color: #3A2A00; font-size: 16.5px; line-height: 1.2; position: relative; z-index: 1; }
.cb-head small {
  color: rgba(58, 42, 0, .78); font-weight: 800; font-size: 11.5px;
  display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; position: relative; z-index: 1;
}
.cb-head small i { width: 8px; height: 8px; border-radius: 50%; background: #16A34A; display: inline-block; box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); }
.cb-close {
  margin-left: auto; background: rgba(0, 0, 0, .12); border: none; color: #3A2A00;
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  cursor: pointer; transition: .15s; flex: none; position: relative; z-index: 1;
}
.cb-close:hover { background: rgba(0, 0, 0, .24); }

/* ---------- isi chat ---------- */
.cb-body {
  flex: 1; overflow-y: auto; padding: 16px 14px; background: var(--bg-2);
  display: flex; flex-direction: column; gap: 10px;
}
.cb-body::-webkit-scrollbar { width: 8px; }
.cb-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.cb-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 94%; }
.cb-msg.bot { align-self: flex-start; }
.cb-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.cb-msg .bub {
  padding: 10px 13px; border-radius: 16px; font-size: 14px; line-height: 1.55;
  word-break: break-word; text-align: left;
}
.cb-msg.bot .bub {
  background: var(--card); border: 1px solid var(--border);
  border-bottom-left-radius: 6px; box-shadow: var(--shadow-soft); color: var(--ink);
}
.cb-msg.user .bub { background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.cb-msg .bub a { color: var(--brand); font-weight: 800; text-decoration: underline; }
.cb-msg .bub small { color: var(--muted); font-weight: 700; font-size: 12px; }
.cb-msg .bub ul, .cb-msg .bub ol { margin: 6px 0 0; padding-left: 18px; }
.cb-msg .bub li { margin: 3px 0; }
.cb-msg.bot .mini-av {
  width: 28px; height: 28px; border-radius: 9px; background: linear-gradient(135deg, #FFB020, #FF7A1A);
  color: #fff; font-family: var(--font-display); font-weight: 800;
  font-size: 14px; display: grid; place-items: center; flex: none; margin-bottom: 2px;
  box-shadow: 0 3px 8px -3px rgba(255, 122, 26, .5);
}

/* ---------- quick reply ---------- */
.cb-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }
.cb-chip {
  border: 1px solid var(--border); background: var(--card); color: var(--accent);
  font-family: var(--font-display); font-weight: 700; font-size: 12.5px;
  padding: 7px 13px; border-radius: 999px; cursor: pointer; transition: .15s;
}
.cb-chip:hover { background: linear-gradient(135deg, #FFB020, #FF7A1A); border-color: transparent; color: #3A2A00; }

/* ---------- kartu status pesanan ---------- */
.cb-card {
  background: #1C2740; border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 14px; margin-top: 8px; box-shadow: var(--shadow-soft);
}
.cb-card .row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 4px 0; }
.cb-card .row span { color: var(--muted); font-weight: 700; }
.cb-card .row b { font-family: var(--font-display); font-size: 13.5px; color: var(--ink); }
.cb-st {
  display: inline-flex; align-items: center; font-family: var(--font-display);
  font-weight: 700; font-size: 11px; letter-spacing: .4px; padding: 3px 10px;
  border-radius: 999px; text-transform: uppercase;
}
.cb-st.pending { background: #FEF3C7; color: #92600A; }
.cb-st.paid { background: var(--brand-soft); color: var(--brand); }
.cb-st.process { background: #E0E7FF; color: #4338CA; }
.cb-st.done { background: #DCFCE7; color: var(--green-dark); }
.cb-st.cancel { background: #FEE2E2; color: var(--red); }
.cb-progress { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.cb-progress i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #FFB020, #FF7A1A);
}
.cb-note { font-size: 12px; color: var(--muted); font-weight: 700; margin-top: 8px; line-height: 1.5; }

/* ---------- typing indicator ---------- */
.cb-typing { display: inline-flex; gap: 4px; padding: 13px 15px; }
.cb-typing i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: cbB 1.2s infinite;
}
.cb-typing i:nth-child(2) { animation-delay: .15s; }
.cb-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes cbB {
  0%, 60%, 100% { transform: none; opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- input ---------- */
.cb-foot { border-top: 1px solid var(--border); background: var(--card); padding: 10px 12px; display: flex; gap: 8px; flex: none; }
.cb-foot input {
  flex: 1; border: 2px solid var(--border); border-radius: 999px; padding: 10px 16px;
  font-family: inherit; font-size: 14px; background: var(--bg-2); color: var(--ink);
  outline: none; transition: .15s; min-width: 0;
}
.cb-foot input::placeholder { color: var(--muted); }
.cb-foot input:focus { border-color: #FFB020; background: var(--bg); }
.cb-send {
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #FFB020, #FF7A1A); color: #fff;
  display: grid; place-items: center; flex: none; transition: .15s;
  box-shadow: 0 6px 14px -6px rgba(255, 122, 26, .6);
}
.cb-send:hover { filter: brightness(1.05); transform: translateY(-1px); }
.cb-send:disabled { opacity: .55; box-shadow: none; }

/* ---------- mobile ---------- */
@media (max-width: 560px) {
  .cb-panel {
    right: 0; bottom: 0; width: 100vw; max-width: 100vw;
    height: 100dvh; max-height: 100dvh; border-radius: 0; border: none;
  }
  .cb-launcher { right: 18px; bottom: 18px; }
}

/* ---- Foto dalam chat + mobile responsive ---- */
.cb-img { max-width: 200px; max-height: 240px; width: auto; border-radius: 12px; display: block; margin-top: 4px; cursor: pointer; }
.cb-photo {
  flex: none; width: 42px; border: 1px solid var(--border); background: var(--bg);
  border-radius: 12px; color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: .15s;
}
.cb-photo:hover { color: var(--brand); border-color: #FFB020; }

@media (max-width: 480px) {
  .cb-panel {
    right: 0; left: 0; bottom: 0; width: 100vw; max-width: 100vw;
    height: 100dvh; max-height: 100dvh; border-radius: 0; border: none;
  }
  .cb-launcher { width: 56px; height: 56px; right: 16px; bottom: 16px; }
  .cb-img { max-width: 70vw; }
}
