/* ============================================================
   My Bookings — embedded chat widget (PracOS Aria style)
   Floating launcher bubble + slide-up panel; no separate page.
   ============================================================ */

:root {
  --mbw-teal: #0d9488;
  --mbw-teal-dk: #0f766e;
  --mbw-teal-lt: #ccfbf1;
  --mbw-ink: #1f2937;
  --mbw-bg: #f0fdfa;
}

/* Launcher bubble (bottom-right) - a pill with an icon + "My Bookings"
   label, built entirely with pseudo-elements so the JS side (which just
   sets innerHTML to a plain 💬 character + the unread badge span) never
   needs to change. font-size:0 on the button collapses that raw emoji
   text node so only our ::before icon and ::after label actually render;
   the badge span keeps its own explicit font-size regardless, since an
   element's own set value always wins over an inherited one. */
.mbw-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9998;
  height: 56px;
  min-width: 56px;
  padding: 0 22px 0 16px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #2dd4bf 0%, var(--mbw-teal) 55%, var(--mbw-teal-dk) 100%);
  color: #fff;
  font-size: 0; /* collapses the raw "💬" text node from the JS-set innerHTML */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 10px 30px -6px rgba(13, 148, 136, 0.55), 0 2px 10px rgba(15, 118, 110, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease, padding 0.18s ease;
  animation: mbw-pulse-ring 2.6s ease-out infinite;
}
.mbw-launcher::before {
  content: "";
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  background-color: #fff;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/></svg>') center / contain no-repeat;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/></svg>') center / contain no-repeat;
}
.mbw-launcher::after {
  content: "My Bookings";
  font-family: -apple-system, "Segoe UI", "Work Sans", sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.mbw-launcher:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 14px 36px -6px rgba(13, 148, 136, 0.65), 0 4px 14px rgba(15, 118, 110, 0.4);
}
.mbw-launcher:active { transform: translateY(0) scale(0.98); }

@keyframes mbw-pulse-ring {
  0%   { box-shadow: 0 10px 30px -6px rgba(13, 148, 136, 0.55), 0 2px 10px rgba(15, 118, 110, 0.35), 0 0 0 0 rgba(45, 212, 191, 0.55); }
  70%  { box-shadow: 0 10px 30px -6px rgba(13, 148, 136, 0.55), 0 2px 10px rgba(15, 118, 110, 0.35), 0 0 0 14px rgba(45, 212, 191, 0); }
  100% { box-shadow: 0 10px 30px -6px rgba(13, 148, 136, 0.55), 0 2px 10px rgba(15, 118, 110, 0.35), 0 0 0 0 rgba(45, 212, 191, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .mbw-launcher { animation: none; }
}

.mbw-launcher .mbw-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 6px;
  display: none;
}

/* Panel */
.mbw-panel {
  position: fixed;
  right: 20px;
  bottom: 96px;
  z-index: 9999;
  width: 380px;
  max-width: calc(100vw - 24px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, sans-serif;
}
.mbw-panel.open { display: flex; }

/* Header — teal bar like the PracOS assistant */
.mbw-header {
  background: linear-gradient(135deg, var(--mbw-teal-dk), var(--mbw-teal));
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.mbw-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  color: var(--mbw-teal-dk);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.mbw-htext { flex: 1; min-width: 0; }
.mbw-htext .mbw-title { font-weight: 700; font-size: 15px; }
.mbw-htext .mbw-sub { font-size: 11px; opacity: 0.9; }
.mbw-sub .mbw-dot { color: #4ade80; }
.mbw-hbtn {
  background: rgba(255, 255, 255, 0.16);
  border: 0;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
}
.mbw-hbtn:hover { background: rgba(255, 255, 255, 0.28); }

/* Tab bar (Stays / Food) */
.mbw-tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
}
.mbw-tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 10px 0;
  font-size: 13px;
  font-weight: 700;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
}
.mbw-tab:hover { color: var(--mbw-teal-dk); }
.mbw-tab.active { color: var(--mbw-teal-dk); border-bottom-color: var(--mbw-teal); }

/* Star rating input (food order feedback) */
.mbw-stars { display: flex; gap: 4px; font-size: 22px; }
.mbw-star { color: #d1d5db; cursor: pointer; transition: color 0.1s; }
.mbw-star.filled { color: #f59e0b; }
.mbw-feedback-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12.5px;
  margin-top: 8px;
  resize: vertical;
  min-height: 50px;
  font-family: inherit;
}
.mbw-feedback-form textarea:focus { border-color: var(--mbw-teal); outline: none; }

/* Body */
.mbw-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: var(--mbw-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mbw-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.mbw-msg.bot {
  background: #fff;
  color: var(--mbw-ink);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  align-self: flex-start;
}
.mbw-msg.user {
  background: var(--mbw-teal);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.mbw-msg .mbw-name { color: var(--mbw-teal-dk); font-weight: 700; }

/* Quick action chips */
.mbw-chips { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; }
.mbw-chip {
  background: #fff;
  border: 1.5px solid var(--mbw-teal);
  color: var(--mbw-teal-dk);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}
.mbw-chip:hover { background: var(--mbw-teal-lt); }
.mbw-chip.danger { border-color: #ef4444; color: #b91c1c; }
.mbw-chip.danger:hover { background: #fee2e2; }

/* Booking cards inside chat */
.mbw-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left: 4px solid var(--mbw-teal);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  align-self: stretch;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.mbw-card b { color: var(--mbw-teal-dk); }
.mbw-card .mbw-card-actions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.mbw-card .mbw-status {
  float: right;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--mbw-teal-lt);
  color: var(--mbw-teal-dk);
}
.mbw-card .mbw-status.cancelled { background: #fee2e2; color: #b91c1c; }

/* Input area */
.mbw-inputrow {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  align-items: center;
}
.mbw-input {
  flex: 1;
  border: 1.5px solid #e5e7eb;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  outline: none;
}
.mbw-input:focus { border-color: var(--mbw-teal); }
.mbw-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--mbw-teal);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.mbw-send:hover { background: var(--mbw-teal-dk); }
.mbw-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* Login mini-form inside the panel */
.mbw-login {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  align-self: stretch;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.mbw-login label { font-size: 12px; font-weight: 600; color: var(--mbw-ink); display: block; margin: 8px 0 4px; }
.mbw-login input {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
}
.mbw-login input:focus { border-color: var(--mbw-teal); outline: none; }
.mbw-btn {
  width: 100%;
  margin-top: 10px;
  background: var(--mbw-teal);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.mbw-btn:hover { background: var(--mbw-teal-dk); }
.mbw-btn:disabled { opacity: 0.5; }
.mbw-err { color: #b91c1c; font-size: 12px; margin-top: 6px; min-height: 14px; }
.mbw-ok { color: var(--mbw-teal-dk); }

.mbw-typing { font-size: 12px; color: #6b7280; align-self: flex-start; padding-left: 4px; }

@media (max-width: 480px) {
  .mbw-panel { right: 8px; left: 8px; width: auto; bottom: 84px; }
  .mbw-launcher {
    right: 14px;
    bottom: 14px;
    padding: 0;
    width: 56px;
    min-width: 56px;
  }
  .mbw-launcher::after { display: none; } /* icon-only at phone widths - the pill got too wide otherwise */
}
