/* ═══════════════════════════════════════════
   AutoReach Booking Widget — embeddable AI booking chat
   Brand tokens mirror the main theme.css
   ═══════════════════════════════════════════ */

/* CSS Variables — can be overridden by host page */
:root {
  --ar-accent: #E8632A;
  --ar-accent-light: #FDF0E8;
  --ar-bg: #F8F5F0;
  --ar-card: #ffffff;
  --ar-fg: #1A1A1A;
  --ar-muted: #6B6560;
  --ar-border: #D9D3CB;
  --ar-radius: 16px;
  --ar-font: 'DM Sans', system-ui, sans-serif;
}

/* ── FAB Toggle ── */
.ar-widget-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: var(--ar-accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(232, 99, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999998;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  padding: 0;
}

.ar-widget-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(232, 99, 42, 0.5);
}

.ar-widget-fab svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.ar-widget-fab.has-unread::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid white;
}

/* ── Chat Window ── */
.ar-widget-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: var(--ar-card);
  border-radius: var(--ar-radius);
  box-shadow: 0 8px 40px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
  z-index: 999999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--ar-font);
  border: 1px solid var(--ar-border);
}

.ar-widget-window.open {
  display: flex;
  animation: arSlideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes arSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ── Header ── */
.ar-widget-header {
  background: var(--ar-accent);
  color: white;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ar-widget-header-icon {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ar-widget-header-icon svg {
  width: 24px;
  height: 24px;
  fill: white;
}

.ar-widget-header-text h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 2px;
  font-family: 'Syne', system-ui, sans-serif;
}

.ar-widget-header-text p {
  font-size: 12px;
  opacity: 0.85;
  margin: 0;
  line-height: 1.4;
}

.ar-widget-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
  color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s;
  flex-shrink: 0;
}

.ar-widget-close:hover {
  background: rgba(255,255,255,0.15);
  color: white;
}

.ar-widget-close svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ── Message Area ── */
.ar-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--ar-bg);
  max-height: 340px;
  scroll-behavior: smooth;
}

.ar-message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.ar-message.ai {
  align-self: flex-start;
}

.ar-message.user {
  align-self: flex-end;
}

.ar-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ar-fg);
  word-wrap: break-word;
}

.ar-message.ai .ar-bubble {
  background: var(--ar-card);
  border: 1px solid var(--ar-border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.ar-message.user .ar-bubble {
  background: var(--ar-accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.ar-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: var(--ar-card);
  border: 1px solid var(--ar-border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.ar-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--ar-muted);
  border-radius: 50%;
  animation: arBounce 1.2s infinite;
}

.ar-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.ar-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes arBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

/* ── Progress Indicator ── */
.ar-progress {
  display: flex;
  gap: 4px;
  padding: 8px 20px 0;
}

.ar-progress-dot {
  height: 3px;
  border-radius: 2px;
  background: var(--ar-border);
  flex: 1;
  transition: background 0.3s;
}

.ar-progress-dot.active {
  background: var(--ar-accent);
}

/* ── Form Area ── */
.ar-widget-form {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--ar-border);
  background: var(--ar-card);
}

.ar-form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ar-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}

.ar-form-input,
.ar-form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--ar-border);
  border-radius: 10px;
  font-family: var(--ar-font);
  font-size: 14px;
  color: var(--ar-fg);
  background: var(--ar-bg);
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}

.ar-form-input:focus,
.ar-form-select:focus {
  border-color: var(--ar-accent);
  background: white;
}

.ar-form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6560' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.ar-form-row {
  margin-bottom: 10px;
}

.ar-form-row:last-child {
  margin-bottom: 0;
}

.ar-btn-submit {
  width: 100%;
  padding: 12px;
  background: var(--ar-accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: var(--ar-font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.2s, transform 0.1s;
}

.ar-btn-submit:hover {
  background: #d4551f;
}

.ar-btn-submit:active {
  transform: scale(0.98);
}

.ar-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Confirmation Screen ── */
.ar-confirmation {
  padding: 32px 24px;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--ar-bg);
}

.ar-confirm-icon {
  width: 64px;
  height: 64px;
  background: #22c55e;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.ar-confirm-icon svg {
  width: 32px;
  height: 32px;
  fill: white;
}

.ar-confirm-title {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--ar-fg);
  margin-bottom: 8px;
}

.ar-confirm-sub {
  font-size: 13px;
  color: var(--ar-muted);
  line-height: 1.5;
  max-width: 260px;
}

.ar-confirm-ref {
  margin-top: 16px;
  padding: 8px 16px;
  background: var(--ar-card);
  border: 1px solid var(--ar-border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--ar-muted);
}

.ar-confirm-ref strong {
  color: var(--ar-fg);
  font-weight: 600;
}

/* ── Timestamp ── */
.ar-msg-time {
  font-size: 10px;
  color: var(--ar-muted);
  margin-top: 3px;
  padding: 0 4px;
}

.ar-message.user .ar-msg-time {
  text-align: right;
}

/* ── Mobile adjustments ── */
@media (max-width: 480px) {
  .ar-widget-window {
    bottom: 88px;
    right: 16px;
    width: calc(100vw - 32px);
  }

  .ar-widget-fab {
    bottom: 16px;
    right: 16px;
  }
}