/* Organizer chat widget stylesheet.
 * Lean extract of exaWEB's chat rules ONLY — no body/html/* globals, so the
 * organizer page (rendered by render.py with its own <style>) keeps its
 * Didot/navy/gold gradient + padding. Adds only the brand vars the widget
 * needs that the organizer doesn't define; never overrides --ink/--gold/
 * --display/etc. Mirrors exaWEB public/css/site.css chat selectors — re-sync
 * the chat rules here after any exaWEB chat widget CSS change.
 */
:root {
  --paper-raised: #ffffff;
  --serif: var(--display);
  --sans: var(--display);
  --focus: var(--gold);
}
.chat-fab {
  position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 40;
  background: var(--ink); color: #fff; border: 0; border-radius: 999px;
  padding: .8rem 1.3rem; font-size: 1rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 33, 53, .25);
}
.chat-fab:hover { background: var(--gold-deep); }
.chat-panel {
  position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 50;
  width: min(380px, calc(100vw - 2rem)); height: min(540px, calc(100vh - 4rem));
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(16, 33, 53, .22);
  display: flex; flex-direction: column; overflow: hidden;
}
@media (max-width: 640px) {
  .chat-panel { right: 0; bottom: 0; width: 100%; height: 82vh; border-radius: 14px 14px 0 0; }
}
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1rem; border-bottom: 1px solid var(--line); background: var(--paper);
}
.chat-head h2 { font-family: var(--serif); font-size: 1rem; margin: 0; }
.chat-head .chat-close { border: 0; background: none; font-size: 1.2rem; cursor: pointer; color: var(--ink-soft); padding: .2rem .5rem; }
.chat-log { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.chat-msg { max-width: 85%; padding: .55rem .8rem; border-radius: 12px; font-size: .95rem; }
.chat-msg.user { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.model { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-card {
  align-self: flex-start; background: var(--paper-raised); border: 1px solid var(--gold);
  border-radius: 12px; padding: .8rem 1rem; width: 90%;
}
.chat-card h3 { margin: 0 0 .1rem; font-family: var(--serif); font-size: 1rem; }
.chat-card .where { font-size: .85rem; color: var(--ink-soft); margin: 0 0 .5rem; }
.chat-card .tel { display: block; font-size: 1.2rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.chat-card .desk-link { font-size: .88rem; }
.chat-card-pivot { border-color: var(--gold); background: var(--paper-soft); }
.chat-card-pivot .card-email { display: block; font-size: .88rem; margin-top: .3rem; }
.chat-form { display: flex; gap: .5rem; padding: .8rem; border-top: 1px solid var(--line); }
.chat-form input {
  flex: 1; font-size: 16px; padding: .6rem .8rem; border: 1px solid var(--line);
  border-radius: 8px; background: var(--paper);
}
.chat-form .chat-sendbtn {
  border: 0; background: var(--gold-deep); color: #fff; border-radius: 8px;
  padding: 0 1rem; font-weight: 600; cursor: pointer;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.chat-controls-hint {
  margin: 0; padding: 0 .9rem .7rem; text-align: center;
  font-family: var(--serif); font-size: .8rem; color: var(--ink-soft);
  line-height: 1.4; background: var(--paper);
}
.v1-chat-window .chat-form input {
  flex: 1; min-width: 0; font-family: var(--serif); font-size: 16px;
  padding: .85rem 1.1rem; border: 1px solid #e3e3e6;
  border-radius: 12px; background: #f1f1f3; color: var(--ink);
}
.v1-chat-window .chat-form input:focus {
  outline: 2px solid var(--gold); outline-offset: 1px;
  border-color: var(--gold); background: var(--paper);
}
.v1-chat-window .chat-form .chat-sendbtn {
  border: 0; background: var(--ink); color: #fff; min-height: 44px;
  border-radius: 12px; padding: 0 1.4rem; font-family: var(--display);
  font-weight: 700; font-size: 1rem; cursor: pointer; letter-spacing: .03em;
}
.v1-chat-window .chat-form .chat-sendbtn:hover { background: var(--gold-deep); }

/* Mic button — "Rather speak than type?" */
.chat-mic, .chat-attach {
  flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--gold); background: var(--paper);
  color: var(--gold-deep); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.chat-mic:hover, .chat-attach:hover { background: var(--paper-soft); border-color: var(--gold-deep); }
.chat-mic.listening {
  background: #c0392b; border-color: #c0392b; color: #fff;
  animation: micpulse 1.2s ease-in-out infinite;
}
@keyframes micpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, .45); }
  50% { box-shadow: 0 0 0 7px rgba(192, 57, 43, 0); }
}

/* Header controls — hands-free + speaker toggles */
.chat-head h2 { flex: 1; }
.chat-hf, .chat-speaker {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper);
  color: var(--ink-soft); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.chat-hf:hover, .chat-speaker:hover { border-color: var(--gold); color: var(--gold-deep); }
.chat-hf.on, .chat-speaker.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chat-hf.on {
  background: #c0392b; border-color: #c0392b;
  animation: micpulse 1.4s ease-in-out infinite;
}
.v1-chat-window .chat-head .chat-close { margin-left: .3rem; }

.chat-upload-card {
  align-self: stretch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: .85rem;
  box-shadow: 0 8px 22px rgba(16, 33, 53, .08);
}
.chat-upload-head {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: .7rem;
}
.chat-upload-head h3 {
  flex: 1;
  margin: 0;
  font-family: var(--display);
  font-size: .92rem;
  letter-spacing: .03em;
  color: var(--ink);
  text-transform: uppercase;
}
.chat-upload-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1;
}
.chat-upload-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem .7rem;
}
.chat-upload-field {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-family: var(--serif);
  font-size: .84rem;
  color: var(--ink-soft);
}
.chat-upload-field:nth-of-type(4),
.chat-upload-field:nth-of-type(5),
.chat-upload-actions,
.chat-upload-status {
  grid-column: 1 / -1;
}
.chat-upload-field input,
.chat-upload-field textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  padding: .55rem .65rem;
}
.chat-upload-field input[type="file"] {
  padding: .55rem;
}
.chat-upload-field textarea {
  resize: vertical;
  min-height: 64px;
}
.chat-upload-actions {
  display: flex;
  justify-content: flex-end;
}
.chat-upload-submit {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-family: var(--display);
  font-weight: 700;
  font-size: .92rem;
  letter-spacing: .03em;
  padding: 0 1rem;
}
.chat-upload-submit:disabled {
  cursor: wait;
  opacity: .7;
}
.chat-upload-status {
  min-height: 1.2em;
  margin: 0;
  font-family: var(--serif);
  font-size: .84rem;
  color: var(--ink-soft);
}
.chat-upload-status.ok { color: #1f7a45; }
.chat-upload-status.error { color: #a32d2d; }
.chat-upload-status.working { color: var(--gold-deep); }
.chat-fab { bottom: max(1.1rem, calc(.6rem + env(safe-area-inset-bottom))); }
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible, summary:focus-visible {
  outline: 3px solid var(--gold-deep);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Readable placeholder text (default browser placeholders fail AA contrast) */
input::placeholder, textarea::placeholder {
  color: var(--ink-soft);
  opacity: 1;
}

/* Chat failover block — no blind intake */
.chat-failover {
  align-self: stretch; background: var(--paper-soft); border: 1px solid var(--gold);
  border-radius: 12px; padding: .9rem 1rem; font-size: .92rem;
}
.chat-failover p { margin: 0 0 .5rem; }
.chat-failover .tel { display: block; font-size: 1.15rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.chat-failover .card-email { display: block; font-size: .88rem; margin: .2rem 0 .6rem; }
.chat-failover-form { display: flex; flex-direction: column; gap: .45rem; }
.chat-failover-form input, .chat-failover-form textarea {
  font: inherit; font-size: .92rem; padding: .45rem .6rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.chat-failover-form button {
  font: inherit; font-size: .92rem; padding: .5rem .8rem; border: 0; border-radius: 8px;
  background: var(--gold); color: var(--ink); cursor: pointer;
}
.chat-failover-form button:hover { background: var(--gold-deep); }
.chat-failover-thanks {  color: var(--ink-soft); }
