/* ── Studio 206 Chat Widget ─────────────────────────────────────────────────── */
/* Brand: #F0EDE8 cream · #1C1C1C near-black · #E63F2B red · #7EDDC9 mint     */

:root {
  --s206-cream: #F0EDE8;
  --s206-dark: #1C1C1C;
  --s206-red: #E63F2B;
  --s206-mint: #7EDDC9;
  --s206-mid: #888;
  --s206-border: rgba(28,28,28,0.12);
  --s206-radius: 16px;
  --s206-shadow: 0 8px 40px rgba(28,28,28,0.18), 0 2px 8px rgba(28,28,28,0.10);
}

/* ── Trigger ────────────────────────────────────────────────────────────────── */
#s206-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 88px;
  height: 88px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: s206-breathe 3.5s ease-in-out infinite;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
}

#s206-trigger:hover {
  transform: scale(1.08);
  animation-play-state: paused;
}

#s206-trigger:hover #s206-ring-svg {
  filter: drop-shadow(0 0 8px rgba(230,63,43,0.35));
}

@keyframes s206-breathe {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.04); }
}

/* ── Ring (rotating SVG) ────────────────────────────────────────────────────── */
#s206-ring-svg {
  position: absolute;
  inset: 0;
  width: 88px;
  height: 88px;
  transition: filter 0.3s ease;
  will-change: transform;
}

/* ── Portrait circle ────────────────────────────────────────────────────────── */
#s206-portrait {
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--s206-dark);
  box-shadow: 0 4px 20px rgba(28,28,28,0.25);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#s206-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
  display: block;
}

#s206-portrait-fallback {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--s206-cream);
  line-height: 1;
  letter-spacing: -1px;
}

/* ── Panel ──────────────────────────────────────────────────────────────────── */
#s206-panel {
  position: fixed;
  bottom: 124px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: 580px;
  background: var(--s206-cream);
  border-radius: var(--s206-radius);
  box-shadow: var(--s206-shadow);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  transform: translateY(16px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease;
}

#s206-panel.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
#s206-header {
  background: var(--s206-dark);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

#s206-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255,255,255,0.1);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#s206-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
}

#s206-header-avatar-fallback {
  font-size: 16px;
  font-weight: 800;
  color: var(--s206-cream);
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

#s206-header-info {
  flex: 1;
  min-width: 0;
}

#s206-header-name {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--s206-cream);
  margin: 0;
  letter-spacing: 0.01em;
}

#s206-header-sub {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 11px;
  color: rgba(240,237,232,0.6);
  margin: 2px 0 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.s206-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--s206-red);
  display: inline-block;
  animation: s206-pulse 2s ease-in-out infinite;
}

@keyframes s206-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

#s206-close {
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(240,237,232,0.7);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

#s206-close:hover {
  background: rgba(230,63,43,0.3);
  color: #fff;
}

/* ── Messages ───────────────────────────────────────────────────────────────── */
#s206-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#s206-messages::-webkit-scrollbar { width: 4px; }
#s206-messages::-webkit-scrollbar-track { background: transparent; }
#s206-messages::-webkit-scrollbar-thumb { background: rgba(28,28,28,0.15); border-radius: 4px; }

.s206-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.s206-msg--agent { flex-direction: row; }
.s206-msg--user  { flex-direction: row-reverse; }

.s206-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--s206-dark);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.s206-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
}

.s206-msg-avatar-txt {
  font-size: 11px;
  font-weight: 800;
  color: var(--s206-cream);
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

.s206-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.s206-msg--agent .s206-bubble {
  background: #fff;
  color: var(--s206-dark);
  border-radius: 14px 14px 14px 4px;
  box-shadow: 0 1px 4px rgba(28,28,28,0.08);
}

.s206-msg--user .s206-bubble {
  background: var(--s206-dark);
  color: var(--s206-cream);
  border-radius: 14px 14px 4px 14px;
}

/* ── Typing indicator ───────────────────────────────────────────────────────── */
.s206-typing {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.s206-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(28,28,28,0.3);
  animation: s206-dot 1.3s ease-in-out infinite;
}

.s206-typing span:nth-child(2) { animation-delay: 0.15s; }
.s206-typing span:nth-child(3) { animation-delay: 0.30s; }

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

/* ── Quick actions ──────────────────────────────────────────────────────────── */
#s206-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}

.s206-chip {
  background: #fff;
  border: 1px solid var(--s206-border);
  color: var(--s206-dark);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 100px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  white-space: nowrap;
}

.s206-chip:hover {
  border-color: var(--s206-red);
  background: var(--s206-dark);
  color: var(--s206-cream);
}

/* ── Input area ─────────────────────────────────────────────────────────────── */
#s206-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--s206-border);
  background: var(--s206-cream);
  flex-shrink: 0;
}

#s206-input {
  flex: 1;
  resize: none;
  border: 1.5px solid var(--s206-border);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 13.5px;
  color: var(--s206-dark);
  background: #fff;
  outline: none;
  min-height: 40px;
  max-height: 96px;
  line-height: 1.4;
  transition: border-color 0.2s;
}

#s206-input:focus {
  border-color: var(--s206-dark);
}

#s206-input::placeholder {
  color: rgba(28,28,28,0.35);
}

#s206-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--s206-dark);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

#s206-send:hover {
  background: var(--s206-red);
}

#s206-send:active {
  transform: scale(0.93);
}

#s206-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#s206-send svg {
  width: 16px;
  height: 16px;
  fill: var(--s206-cream);
}

/* ── Branding ───────────────────────────────────────────────────────────────── */
#s206-branding {
  text-align: center;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 10.5px;
  color: rgba(28,28,28,0.35);
  padding: 6px 16px 10px;
  flex-shrink: 0;
}

#s206-branding a {
  color: var(--s206-red);
  text-decoration: none;
}

/* ── Cursor (typewriter) ────────────────────────────────────────────────────── */
.s206-cursor::after {
  content: '|';
  animation: s206-blink 0.8s step-end infinite;
  color: var(--s206-red);
  margin-left: 1px;
}

@keyframes s206-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Mobile ─────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #s206-panel {
    right: 12px;
    bottom: 116px;
    width: calc(100vw - 24px);
    max-height: 70vh;
  }

  #s206-trigger {
    right: 16px;
    bottom: 16px;
  }
}
