/* TEREA 365 — chat widget.
 *
 * Self-contained on purpose: the Worker-rendered pages and the static blog
 * pages ship different design-token sets, so this file depends on neither and
 * carries its own literal values. Depth follows the site's language — a tight
 * contact shadow paired with a wide ambient one, and one hairline of light. */

.t365chat-pill, .t365chat-panel {
  --c-font: "Bahnschrift", "DIN Alternate", "Segoe UI", Roboto, system-ui,
            -apple-system, Arial, sans-serif;
  --c-ink: #0B1220;
  --c-ink-2: #1B2740;
  --c-muted: #6B7789;
  --c-line: #E3E8EF;
  --c-bg: #FFFFFF;
  --c-bg-2: #F5F8FB;
  --c-accent: #12BEEE;
  --c-accent-2: #0A8FB8;
  --c-accent-ink: #04222C;
  --wa-gap: 82px;                 /* clears the WhatsApp button beneath it */
}

/* --------------------------------------------------------------- launcher */
.t365chat-pill {
  position: fixed; right: 18px; bottom: var(--wa-gap); z-index: 81;
  display: inline-flex; align-items: center; gap: 10px;
  border: 0; cursor: pointer; padding: 8px 18px 8px 8px; border-radius: 999px;
  font-family: var(--c-font); color: var(--c-accent-ink);
  background: linear-gradient(180deg, #5FE0FF, #12BEEE 45%, #0A8FB8);
  box-shadow: 0 6px 16px rgba(10, 143, 184, .28),
              0 18px 44px rgba(18, 190, 238, .30),
              inset 0 1px 0 rgba(255, 255, 255, .55),
              inset 0 -1px 0 rgba(4, 34, 44, .18);
  transition: transform .18s ease, box-shadow .18s ease;
}
.t365chat-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(10, 143, 184, .32),
              0 24px 54px rgba(18, 190, 238, .36),
              inset 0 1px 0 rgba(255, 255, 255, .6);
}
.t365chat-pill[hidden] { display: none; }
.t365chat-pill .av, .t365chat-hd .av {
  position: relative; width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #fff;
  background: linear-gradient(160deg, #25405F, #0B1220);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22),
              0 2px 6px rgba(11, 18, 32, .28);
}
.t365chat-pill .dot, .t365chat-hd .dot {
  position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px;
  border-radius: 50%; background: #2ED573; border: 2px solid #DCF3FB;
}
.t365chat-pill .lb { display: grid; text-align: left; line-height: 1.15; }
.t365chat-pill .lb b { font-size: 14px; font-weight: 800; }
.t365chat-pill .lb i { font-size: 10.5px; font-style: normal; opacity: .78; }

/* ------------------------------------------------------------------ panel */
.t365chat-panel {
  position: fixed; right: 18px; bottom: var(--wa-gap); z-index: 82;
  width: 372px; max-width: calc(100vw - 24px);
  height: min(542px, calc(100vh - 150px));
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 22px; background: var(--c-bg);
  border: 1px solid var(--c-line); font-family: var(--c-font);
  box-shadow: 0 3px 6px rgba(11, 18, 32, .09), 0 22px 50px rgba(11, 18, 32, .18),
              inset 0 1px 0 rgba(255, 255, 255, .7);
  animation: t365pop .18s ease-out;
}
.t365chat-panel[hidden] { display: none; }
@keyframes t365pop {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.t365chat-hd {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; color: #fff;
  background: linear-gradient(160deg, #22375B, #0B1220 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14),
              0 2px 10px rgba(11, 18, 32, .20);
}
.t365chat-hd .who { display: grid; line-height: 1.2; flex: 1; min-width: 0; }
.t365chat-hd .who b { font-size: 14.5px; }
.t365chat-hd .who i { font-size: 10.5px; font-style: normal; color: #8FE6FF; }
.t365chat-hd .x {
  margin-left: auto; background: rgba(255, 255, 255, .12); border: 0; color: #fff;
  width: 30px; height: 30px; border-radius: 9px; font-size: 19px; line-height: 1;
  cursor: pointer; font-family: inherit;
}
.t365chat-hd .x:hover { background: rgba(255, 255, 255, .22); }

/* -------------------------------------------------------------- transcript */
.t365chat-log {
  flex: 1; overflow-y: auto; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 9px;
  background:
    radial-gradient(1200px 300px at 100% 0, rgba(18, 190, 238, .07), transparent 60%),
    var(--c-bg-2);
}
.t365chat-row { display: flex; }
.t365chat-row.me { justify-content: flex-end; }
.t365chat-row .bb {
  max-width: 85%; padding: 9px 12px 7px; border-radius: 15px;
  font-size: 14.5px; line-height: 1.5; color: var(--c-ink-2); position: relative;
  box-shadow: 0 1px 2px rgba(11, 18, 32, .07), 0 6px 16px rgba(11, 18, 32, .06),
              inset 0 1px 0 rgba(255, 255, 255, .7);
}
.t365chat-row.them .bb { background: #fff; border-bottom-left-radius: 5px; }
.t365chat-row.me .bb {
  background: linear-gradient(180deg, #E3F8FF, #CFF1FC);
  border-bottom-right-radius: 5px; color: #08303D;
}
.t365chat-row .bb a {
  color: var(--c-accent-2); font-weight: 600; text-decoration: underline;
}
.t365chat-row .tm {
  display: block; text-align: right; font-size: 9.5px; opacity: .45;
  margin-top: 2px; letter-spacing: .02em;
}
.t365chat-typing .bb { display: flex; gap: 4px; padding: 12px 14px; }
.t365chat-typing .d {
  width: 6px; height: 6px; border-radius: 50%; background: rgba(11, 18, 32, .3);
  animation: t365bounce 1s infinite;
}
.t365chat-typing .d:nth-child(2) { animation-delay: .15s; }
.t365chat-typing .d:nth-child(3) { animation-delay: .3s; }
@keyframes t365bounce {
  0%, 60%, 100% { transform: none; opacity: .35; }
  30%           { transform: translateY(-4px); opacity: .85; }
}

/* ---------------------------------------------------------- quick replies */
.t365chat-chips {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px;
  background: var(--c-bg-2);
}
.t365chat-chips[hidden] { display: none; }
.t365chat-chips .chip {
  border: 1px solid var(--c-line); background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: var(--c-ink-2); font-family: var(--c-font); font-size: 12.5px;
  font-weight: 600; padding: 7px 11px; border-radius: 999px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(11, 18, 32, .06), inset 0 1px 0 rgba(255, 255, 255, .8);
}
.t365chat-chips .chip:hover { border-color: var(--c-accent); color: var(--c-accent-2); }

/* --------------------------------------------------------------- composer */
.t365chat-in {
  display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--c-line);
  background: var(--c-bg);
}
.t365chat-in input {
  flex: 1; min-width: 0; border: 1px solid var(--c-line); border-radius: 999px;
  padding: 11px 15px; font: inherit; font-family: var(--c-font); font-size: 14.5px;
  color: var(--c-ink); background: var(--c-bg-2);
  box-shadow: inset 0 1px 2px rgba(11, 18, 32, .06);
}
.t365chat-in input:focus {
  outline: 2px solid rgba(18, 190, 238, .35); outline-offset: 1px;
  border-color: var(--c-accent); background: #fff;
}
.t365chat-in button {
  flex: 0 0 42px; height: 42px; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: var(--c-accent-ink);
  background: linear-gradient(180deg, #5FE0FF, #12BEEE 45%, #0A8FB8);
  box-shadow: 0 2px 4px rgba(10, 143, 184, .24), 0 8px 18px rgba(18, 190, 238, .26),
              inset 0 1px 0 rgba(255, 255, 255, .5);
}
.t365chat-in button:hover { transform: translateY(-1px); }
.t365chat-ft {
  margin: 0; padding: 0 12px 10px; font-size: 10.5px; color: var(--c-muted);
  text-align: center; background: var(--c-bg);
}
.t365chat-ft a { color: var(--c-accent-2); }

@media (max-width: 600px) {
  .t365chat-pill, .t365chat-panel { --wa-gap: 78px; }
  .t365chat-pill { right: 12px; padding: 7px 15px 7px 7px; }
  .t365chat-panel {
    right: 8px; left: 8px; width: auto; height: min(72vh, calc(100vh - 132px));
  }
  body.t365chat-open .wafloat { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .t365chat-panel { animation: none; }
  .t365chat-typing .d { animation: none; }
}
