/* Floating chat widget — WhatsApp-style panel driven by chat-widget.js's intent engine. */

.cw-panel {
  position: fixed;
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  width: min(360px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 140px));
  background: #E5DDD5;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.cw-panel.cw-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

@media (max-width: 480px) {
  .cw-panel {
    right: 8px;
    left: 8px;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    width: auto;
    height: min(70vh, 520px);
  }
}

.cw-header {
  background: #0B141A;
  color: #E9EDEF;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  flex-shrink: 0;
}

.cw-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent, #C77B2E);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono, monospace);
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.cw-header-text { flex: 1; min-width: 0; }
.cw-title { font-size: 0.88rem; font-weight: 600; line-height: 1.2; }
.cw-status { font-size: 0.66rem; color: #8696A0; }

.cw-close {
  background: none;
  border: none;
  color: #E9EDEF;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
}
.cw-close:hover { opacity: 1; }

.cw-chat {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(229, 221, 213, 0.94);
}

.cw-msg {
  max-width: 84%;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 0.84rem;
  line-height: 1.5;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
  white-space: pre-line;
}
.cw-msg.bot { background: #fff; color: #111B21; align-self: flex-start; border-top-left-radius: 2px; }
.cw-msg.user { background: #D9FDD3; color: #111B21; align-self: flex-end; border-top-right-radius: 2px; }
.cw-time { display: block; font-size: 0.58rem; color: #667781; text-align: right; margin-top: 3px; }

.cw-typing {
  align-self: flex-start;
  background: #fff;
  border-radius: 9px;
  padding: 10px 14px;
  display: none;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}
.cw-typing.cw-on { display: block; }
.cw-typing i {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8696A0;
  margin-right: 3px;
  animation: cwDot 1.2s infinite;
}
.cw-typing i:nth-child(2) { animation-delay: 0.15s; }
.cw-typing i:nth-child(3) { animation-delay: 0.3s; margin-right: 0; }
@keyframes cwDot {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

.cw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 4px;
  background: rgba(229, 221, 213, 0.94);
  flex-shrink: 0;
}
.cw-chip {
  background: #fff;
  border: 1px solid #C9C2BA;
  color: #0B141A;
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 0.72rem;
  font-family: var(--sans, sans-serif);
  cursor: pointer;
  transition: background 0.15s;
}
.cw-chip:hover { background: #F0EBE3; }

.cw-inputbar {
  display: flex;
  gap: 8px;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(229, 221, 213, 0.94);
  flex-shrink: 0;
}
.cw-input {
  flex: 1;
  border: none;
  border-radius: 20px;
  padding: 11px 16px;
  font-size: 0.84rem;
  font-family: var(--sans, sans-serif);
  outline: none;
  background: #fff;
  color: #111B21;
  min-width: 0;
}
.cw-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #00A884;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cw-send:hover { background: #029274; }

@media (prefers-reduced-motion: reduce) {
  .cw-panel { transition: opacity 0.15s ease, visibility 0.15s; }
}
