/* Cleared. — chat widget styles */

.widget-fab {
  position: fixed;
  right: 20px; bottom: 20px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: var(--bg-primary);
  border: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(31,42,36,0.22), 0 2px 6px rgba(31,42,36,0.12);
  z-index: 50;
  transition: transform 240ms ease, opacity 240ms ease;
}
.widget-fab:hover { opacity: 0.92; }
.widget-fab.hidden {
  transform: scale(0.6);
  opacity: 0;
  pointer-events: none;
}

/* Mobile sticky-cta and FAB don't fight */
@media (max-width: 767px) {
  .widget-fab { bottom: 84px; }
  .widget-fab.no-bar { bottom: 20px; }
}

@media (min-width: 768px) {
  .widget-fab { right: 32px; bottom: 32px; }
}

/* Backdrop */
.widget-backdrop {
  position: fixed; inset: 0;
  background: rgba(31,42,36,0.32);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}
.widget-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Panel */
.widget-panel {
  position: fixed;
  z-index: 70;
  background: var(--bg-primary);
  display: flex; flex-direction: column;
  overflow: hidden;
  /* mobile: bottom sheet */
  left: 0; right: 0; bottom: 0;
  height: 90vh;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  border: 1px solid var(--line);
  border-bottom: none;
  box-shadow: 0 -16px 48px rgba(31,42,36,0.18);
  transform: translateY(100%);
  transition: transform 320ms cubic-bezier(0.34, 1.18, 0.64, 1);
}
.widget-panel.open { transform: translateY(0); }

@media (min-width: 768px) {
  .widget-panel {
    left: auto; bottom: 32px; right: 32px;
    width: 400px; height: 640px; max-height: calc(100vh - 64px);
    border-radius: 16px;
    border: 1px solid var(--line);
    box-shadow: 0 24px 64px rgba(31,42,36,0.22), 0 4px 12px rgba(31,42,36,0.08);
    transform: translateY(16px) scale(0.98);
    opacity: 0;
  }
  .widget-panel.open { transform: none; opacity: 1; }
}

/* Header */
.w-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-primary);
  position: relative;
  flex-shrink: 0;
}
.w-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--line);
  margin: -2px auto 12px;
}
@media (min-width: 768px) {
  .w-handle { display: none; }
  .w-head { padding: 18px 20px; }
}
.w-head-row {
  display: flex; align-items: center; justify-content: space-between;
}
.w-head-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.015em;
  line-height: 1; margin-bottom: 5px;
}
.w-head-title .dot { margin-left: -0.06em; }
.w-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--ink-secondary);
}
.w-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-warm);
}
.w-close {
  width: 36px; height: 36px;
  background: transparent; border: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-primary);
  transition: background 160ms ease;
}
.w-close:hover { background: var(--bg-secondary); }

/* Convo area */
.w-convo {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 8px;
  display: flex; flex-direction: column; gap: 18px;
  scroll-behavior: smooth;
}

/* Empty state */
.w-empty {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 0 20px;
}
.w-empty h3 {
  font-family: var(--font-display);
  font-weight: 400; font-size: 26px; line-height: 1.15;
  margin: 0 0 12px; letter-spacing: -0.01em;
  max-width: 280px;
}
.w-empty p {
  margin: 0; color: var(--ink-secondary); font-size: 14px;
  max-width: 300px;
}
.w-prompts {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 24px;
}
.w-prompt {
  font-family: var(--font-body);
  font-size: 13px;
  background: var(--bg-secondary);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--ink-primary);
  cursor: pointer;
  transition: border-color 200ms ease;
}
.w-prompt:hover { border-color: var(--ink-primary); }

/* Messages */
.msg-ai {
  padding: 0 28px 0 12px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-primary);
  max-width: 92%;
  animation: fadeUp 400ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.msg-user {
  align-self: flex-end;
  background: var(--bg-primary);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 14px;
  max-width: 85%;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-primary);
  word-wrap: break-word;
  animation: fadeUp 320ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.msg-user.has-image { padding: 8px 8px 10px; }
.msg-user-img {
  width: 100%; aspect-ratio: 4 / 3;
  border-radius: 10px;
  margin-bottom: 8px;
  object-fit: cover;
  background: linear-gradient(135deg, #C9B996 0%, #A89472 50%, #8E7A56 100%);
  min-width: 180px;
  display: block;
}
.msg-user-text { padding: 0 6px; }

.msg-ai-error {
  background: var(--bg-secondary);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px 14px;
  margin-left: 12px;
  max-width: 88%;
}
.msg-ai-error-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink-primary);
}
.msg-ai-error-text {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-secondary);
}
.msg-ai-error-action {
  margin-top: 10px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  color: var(--ink-primary);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  transition: border-color 200ms ease;
}
.msg-ai-error-action:hover { border-color: var(--ink-primary); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Thinking dots */
.thinking {
  padding-left: 12px;
  display: flex; gap: 5px; align-items: center; height: 24px;
}
.thinking span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-secondary);
  animation: thinkPulse 1.4s ease-in-out infinite;
}
.thinking span:nth-child(2) { animation-delay: 0.18s; }
.thinking span:nth-child(3) { animation-delay: 0.36s; }
@keyframes thinkPulse {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 0.85; }
}

/* Composer */
.w-composer {
  border-top: 1px solid var(--line);
  padding: 12px 14px 14px;
  background: var(--bg-primary);
  flex-shrink: 0;
}
.w-attachment {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px; margin-bottom: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.w-attach-thumb {
  width: 40px; height: 40px;
  border-radius: 5px;
  object-fit: cover;
  background: linear-gradient(135deg, #C9B996, #8E7A56);
  flex-shrink: 0;
  display: block;
}
.w-attach-label {
  font-size: 12px;
  color: var(--ink-secondary);
  padding-right: 4px;
  max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.w-attach-x {
  width: 22px; height: 22px; margin-right: 4px;
  background: transparent; border: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-secondary);
  border-radius: 50%;
  transition: background 160ms ease;
}
.w-attach-x:hover { background: var(--bg-primary); color: var(--ink-primary); }

.w-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 4px 4px 4px 4px;
  transition: border-color 200ms ease;
}
.w-input-row:focus-within { border-color: var(--ink-primary); }
.w-cam {
  width: 36px; height: 36px;
  background: transparent; border: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-secondary);
  border-radius: 50%;
  flex-shrink: 0;
  transition: color 160ms ease;
}
.w-cam:hover { color: var(--ink-primary); }
.w-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
  font: inherit;
  font-size: 15px;
  color: var(--ink-primary);
  padding: 9px 4px;
  line-height: 1.4;
  max-height: 120px;
  font-family: var(--font-body);
}
.w-input::placeholder { color: var(--ink-secondary); }
.w-send {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: var(--bg-primary);
  border: none;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: opacity 200ms ease;
}
.w-send:disabled {
  background: var(--line);
  color: var(--bg-secondary);
  cursor: not-allowed;
}

/* Summary card */
.summary {
  background: var(--bg-secondary);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 20px 20px 16px;
  max-width: 92%;
  margin-left: 12px;
  animation: fadeUp 480ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.summary h4 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.summary-sub {
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.5;
  margin: 0 0 16px;
}
.summary-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  align-items: baseline;
}
.summary-row:last-of-type { border-bottom: 1px solid var(--line); }
.summary-row .label {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-secondary);
}
.summary-row .value {
  font-size: 14px;
  color: var(--ink-primary);
  line-height: 1.45;
}
.summary-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.summary-close {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  color: var(--ink-primary);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  transition: border-color 200ms ease;
}
.summary-close:hover { border-color: var(--ink-primary); }

/* sr-only */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
