/* Website chat (assets/js/chat.js). Uses the site tokens from site.css. */

.edc-launcher {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 0 18px 0 16px; border: 0; border-radius: 999px;
  background: var(--primary); color: var(--on-primary);
  font: inherit; font-size: 16px; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 24px -8px rgba(16, 24, 40, 0.45);
}
.edc-launcher svg { width: 24px; height: 24px; }
.edc-launcher:hover { filter: brightness(1.08); }
.edc-dot {
  position: absolute; top: 6px; right: 8px; width: 12px; height: 12px; border-radius: 50%;
  background: #ef4444; box-shadow: 0 0 0 2px var(--primary);
}
.edc-dot[hidden] { display: none; }
@media (max-width: 519px) {
  .edc-launcher { padding: 0; width: 56px; min-height: 56px; justify-content: center; }
  .edc-launcher-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

.edc-panel {
  position: fixed; right: 16px; bottom: 84px; z-index: 61;
  display: flex; flex-direction: column;
  width: min(380px, calc(100vw - 32px)); height: min(600px, calc(100dvh - 108px));
  background: var(--surface-raised); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-l); box-shadow: var(--shadow);
  overflow: hidden; margin: 0; padding: 0; font-size: 15px; line-height: 1.5; text-align: left;
}
.edc-panel[hidden] { display: none; }
@media (max-width: 519px) {
  .edc-panel { inset: 0; width: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .edc-is-open .edc-launcher { display: none; }
}

.edc-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 16px 14px; background: var(--primary); color: var(--on-primary);
}
.edc-head h2 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.edc-head p { margin: 2px 0 0; font-size: 13px; opacity: 0.9; }
.edc-close {
  display: inline-grid; place-items: center; width: 36px; height: 36px; margin: -6px -6px 0 0;
  border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer;
}
.edc-close svg { width: 20px; height: 20px; }
.edc-close:hover { background: rgba(255, 255, 255, 0.15); }

.edc-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.edc-form { overflow-y: auto; padding: 14px 16px 16px; display: grid; gap: 12px; }
.edc-note { margin: 0; padding: 10px 12px; border-radius: var(--radius-s); background: var(--primary-container); color: var(--on-primary-container); font-size: 13px; }
.edc-note a { color: inherit; font-weight: 700; }
.edc-field { display: grid; gap: 4px; }
.edc-field label { font-size: 13px; font-weight: 700; }
.edc-field input, .edc-field select, .edc-field textarea, .edc-compose textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-s);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; /* 16px: no zoom on iOS */
}
.edc-field textarea { resize: vertical; min-height: 88px; }
.edc-field input:focus, .edc-field select:focus, .edc-field textarea:focus, .edc-compose textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-container);
}
.edc-field [aria-invalid="true"] { border-color: #dc2626; }
.edc-hint { margin: 0; font-size: 12px; color: var(--text-muted); }
.edc-error, .edc-status { margin: 0; font-size: 13px; color: #dc2626; }
.edc-error[hidden], .edc-status[hidden] { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .edc-error, :root:not([data-theme="light"]) .edc-status { color: #f87171; }
}
.edc-btn {
  min-height: 48px; border: 0; border-radius: var(--radius-s); background: var(--primary); color: var(--on-primary);
  font: inherit; font-weight: 700; cursor: pointer;
}
.edc-btn:disabled { opacity: 0.6; cursor: default; }

.edc-messages { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 14px 14px 8px; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.edc-msg { display: flex; flex-direction: column; max-width: 85%; }
.edc-mine { align-self: flex-end; align-items: flex-end; }
.edc-theirs { align-self: flex-start; }
.edc-bubble { padding: 9px 13px; border-radius: 16px; overflow-wrap: anywhere; }
.edc-bubble p { margin: 0; white-space: pre-wrap; }
.edc-bubble img { max-height: 220px; border-radius: 10px; margin-bottom: 4px; }
.edc-mine .edc-bubble { background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 4px; }
.edc-theirs .edc-bubble { background: var(--surface-alt); border: 1px solid var(--border-subtle); border-bottom-left-radius: 4px; }
.edc-meta { margin-top: 3px; font-size: 11px; color: var(--text-muted); }
.edc-system { align-self: center; text-align: center; font-size: 12px; color: var(--text-muted); max-width: 90%; }

.edc-footer { border-top: 1px solid var(--border-subtle); padding: 10px 12px 12px; display: grid; gap: 6px; }
.edc-compose { display: flex; align-items: flex-end; gap: 8px; }
.edc-compose textarea { resize: none; min-height: 46px; max-height: 140px; }
.edc-send {
  flex: none; display: inline-grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: var(--radius-s);
  background: var(--primary); color: var(--on-primary); cursor: pointer;
}
.edc-send svg { width: 20px; height: 20px; }
.edc-send:disabled { opacity: 0.6; }
.edc-link { justify-self: start; padding: 4px 0; border: 0; background: none; color: var(--text-muted); font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; }
.edc-link:hover { color: var(--text); }

@media print { .edc-launcher, .edc-panel { display: none !important; } }
