/* CENTAS ENT — AI Receptionist widget
 * Refined editorial aesthetic: serif typography, sage detailing, tinted shadows.
 * No `transition-all`, no default Tailwind blue/indigo, no cliched chat-bubble blue.
 * All selectors are namespaced under `.cc-` to avoid collisions with the host page.
 */

.cc-root {
  /* CENTAS palette — exact values from Branding Guide.pdf */
  --cc-forest:   #2D5016;
  --cc-forest-2: #3a651e;
  --cc-navy:     #1A3A52;
  --cc-navy-2:   #224a68;
  --cc-sage:     #8BA888;
  --cc-sage-2:   #b9cdb6;
  --cc-beige:    #F5F1E8;
  --cc-offwhite: #FAFAF9;
  --cc-ink:      #1f2a23;
  --cc-ink-soft: #4d5a52;
  --cc-line:     rgba(45, 80, 22, 0.12);
  --cc-line-soft:rgba(45, 80, 22, 0.06);

  --cc-shadow-launcher:
    0 1px 0 rgba(45, 80, 22, 0.06),
    0 6px 16px rgba(45, 80, 22, 0.18),
    0 18px 48px rgba(26, 58, 82, 0.18);
  --cc-shadow-panel:
    0 1px 0 rgba(45, 80, 22, 0.05),
    0 12px 32px rgba(26, 58, 82, 0.12),
    0 32px 80px rgba(26, 58, 82, 0.18);

  --cc-radius-panel:  18px;
  --cc-radius-chip:   999px;
  --cc-radius-bubble: 14px;

  --cc-font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --cc-font-body:    "Crimson Text", Georgia, "Times New Roman", serif;

  /* Sizing tokens */
  --cc-panel-width:  380px;
  --cc-panel-height: 600px;

  position: fixed;
  inset: auto 0 0 auto;
  z-index: 2147483600; /* above the Chaty floater */
  font-family: var(--cc-font-body);
  color: var(--cc-ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ----------------------------------------------------------------------------
 * Launcher
 * ------------------------------------------------------------------------- */
.cc-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px 14px 18px;
  background: var(--cc-forest);
  color: var(--cc-offwhite);
  font-family: var(--cc-font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: none;
  border-radius: var(--cc-radius-chip);
  cursor: pointer;
  box-shadow: var(--cc-shadow-launcher);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 220ms cubic-bezier(0.4, 0, 0.2, 1),
              opacity 180ms cubic-bezier(0.4, 0, 0.2, 1);
}
.cc-launcher::before {
  /* tiny leaf glyph, drawn in CSS — distinguishes from the generic chat bubble */
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FAFAF9' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M21 4c-7 0-12 4-12 11 0 1.5.3 3 .8 4.4'/><path d='M21 4c0 8-5 13-12 13'/><path d='M3 20c1.4-1.6 3-3 5-4'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
}
.cc-launcher:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(45, 80, 22, 0.08),
    0 10px 24px rgba(45, 80, 22, 0.22),
    0 24px 60px rgba(26, 58, 82, 0.22);
}
.cc-launcher:focus-visible {
  outline: 2px solid var(--cc-sage);
  outline-offset: 3px;
}
.cc-launcher:active {
  transform: translateY(0);
}
.cc-launcher.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

/* ----------------------------------------------------------------------------
 * Panel
 * ------------------------------------------------------------------------- */
.cc-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: var(--cc-panel-width);
  height: var(--cc-panel-height);
  max-height: calc(100vh - 48px);
  background: var(--cc-offwhite);
  border-radius: var(--cc-radius-panel);
  border: 1px solid var(--cc-line-soft);
  box-shadow: var(--cc-shadow-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.985);
  transform-origin: bottom right;
  transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1),
              opacity 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.cc-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* faint paper tone — avoids flat white */
.cc-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(120% 80% at 100% 0%, rgba(139, 168, 136, 0.08), transparent 60%),
    radial-gradient(60% 40% at 0% 100%, rgba(245, 241, 232, 0.6), transparent 70%);
  z-index: 0;
}

.cc-panel > * {
  position: relative;
  z-index: 1;
}

/* ----- header ------------------------------------------------------------- */
.cc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 14px;
  background: var(--cc-navy);
  color: var(--cc-offwhite);
  border-bottom: 1px solid var(--cc-line-soft);
}
.cc-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.cc-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--cc-sage) 0%, var(--cc-forest) 100%);
  font-family: var(--cc-font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--cc-offwhite);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.cc-header__title {
  font-family: var(--cc-font-display);
  font-weight: 500;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--cc-offwhite);
  margin: 0;
}
.cc-header__sub {
  font-family: var(--cc-font-body);
  font-size: 12px;
  font-style: italic;
  color: var(--cc-sage-2);
  margin: 2px 0 0;
  letter-spacing: 0.02em;
}
.cc-close {
  border: none;
  background: transparent;
  color: var(--cc-offwhite);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 160ms ease-out, transform 160ms ease-out;
}
.cc-close:hover { background: rgba(255,255,255,0.12); }
.cc-close:active { transform: scale(0.94); }
.cc-close:focus-visible {
  outline: 2px solid var(--cc-sage-2);
  outline-offset: 2px;
}

/* ----- body / messages ---------------------------------------------------- */
.cc-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 18px 12px;
  scroll-behavior: smooth;
}
.cc-body::-webkit-scrollbar { width: 6px; }
.cc-body::-webkit-scrollbar-thumb {
  background: rgba(45, 80, 22, 0.18);
  border-radius: 4px;
}

.cc-msg {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
  max-width: 88%;
}
.cc-msg__bubble {
  font-family: var(--cc-font-body);
  font-size: 15.5px;
  line-height: 1.55;
  padding: 11px 14px;
  border-radius: var(--cc-radius-bubble);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid transparent;
}
.cc-msg__bubble a {
  color: var(--cc-forest);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.cc-msg__bubble a:hover { color: var(--cc-forest-2); }
.cc-msg__bubble strong { font-weight: 600; }

.cc-msg--assistant {
  align-self: flex-start;
}
.cc-msg--assistant .cc-msg__bubble {
  background: #fff;
  border-color: var(--cc-line);
  color: var(--cc-ink);
  border-top-left-radius: 4px;
  box-shadow: 0 1px 0 rgba(45,80,22,0.04);
}
.cc-msg--user {
  align-self: flex-end;
}
.cc-msg--user .cc-msg__bubble {
  background: var(--cc-forest);
  color: var(--cc-offwhite);
  border-top-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(45,80,22,0.18);
}

/* assistant pre-amble: the intro */
.cc-intro {
  font-family: var(--cc-font-body);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--cc-ink);
  background: #fff;
  border: 1px solid var(--cc-line);
  border-top-left-radius: 4px;
  border-radius: var(--cc-radius-bubble);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 0 rgba(45,80,22,0.04);
}
.cc-intro__greeting {
  font-family: var(--cc-font-display);
  font-size: 22px;
  line-height: 1.18;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--cc-forest);
  margin: 0 0 6px;
}
.cc-intro__line {
  margin: 4px 0;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.cc-intro__line svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  color: var(--cc-sage);
}
.cc-intro__divider {
  height: 1px;
  background: var(--cc-line-soft);
  margin: 10px 0;
}
.cc-intro__prompt {
  font-style: italic;
  color: var(--cc-ink-soft);
}

/* typing indicator */
.cc-typing {
  display: inline-flex;
  gap: 4px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--cc-line);
  border-radius: var(--cc-radius-bubble);
  border-top-left-radius: 4px;
  margin-bottom: 14px;
  align-self: flex-start;
}
.cc-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cc-sage);
  opacity: 0.5;
  animation: cc-typing 1.2s infinite ease-in-out both;
}
.cc-typing span:nth-child(2) { animation-delay: 0.15s; }
.cc-typing span:nth-child(3) { animation-delay: 0.30s; }
@keyframes cc-typing {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1;   }
}

/* ----- chip bar ----------------------------------------------------------- */
.cc-chips {
  padding: 0 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cc-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cc-chip {
  font-family: var(--cc-font-display);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.005em;
  padding: 9px 16px;
  border-radius: var(--cc-radius-chip);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--cc-sage);
  background: var(--cc-offwhite);
  color: var(--cc-forest);
  transition: transform 160ms cubic-bezier(0.4,0,0.2,1),
              background-color 180ms ease-out,
              color 180ms ease-out,
              border-color 180ms ease-out;
}
.cc-chip:hover {
  background: var(--cc-beige);
  border-color: var(--cc-forest);
}
.cc-chip:active { transform: scale(0.97); }
.cc-chip:focus-visible {
  outline: 2px solid var(--cc-forest);
  outline-offset: 2px;
}
.cc-chip--primary {
  background: var(--cc-forest);
  color: var(--cc-offwhite);
  border-color: var(--cc-forest);
  width: 100%;
  justify-content: center;
  padding: 12px 16px;
  font-size: 16px;
  box-shadow: 0 4px 14px rgba(45,80,22,0.18);
}
.cc-chip--primary:hover {
  background: var(--cc-forest-2);
  border-color: var(--cc-forest-2);
  color: var(--cc-offwhite);
}
.cc-chip--small {
  padding: 7px 14px;
  font-size: 14px;
}

/* ----- input -------------------------------------------------------------- */
.cc-input {
  display: flex;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--cc-line-soft);
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(4px);
}
.cc-input__textarea {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid var(--cc-line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--cc-font-body);
  font-size: 15.5px;
  line-height: 1.45;
  color: var(--cc-ink);
  min-height: 40px;
  max-height: 120px;
  transition: border-color 160ms ease-out, box-shadow 160ms ease-out;
}
.cc-input__textarea::placeholder {
  color: var(--cc-ink-soft);
  opacity: 0.7;
  font-style: italic;
}
.cc-input__textarea:focus-visible {
  outline: none;
  border-color: var(--cc-forest);
  box-shadow: 0 0 0 3px rgba(45,80,22,0.12);
}
.cc-input__send {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: none;
  background: var(--cc-forest);
  color: var(--cc-offwhite);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 160ms cubic-bezier(0.4,0,0.2,1),
              background-color 180ms ease-out;
}
.cc-input__send:hover { background: var(--cc-forest-2); }
.cc-input__send:active { transform: scale(0.95); }
.cc-input__send:focus-visible { outline: 2px solid var(--cc-sage); outline-offset: 2px; }
.cc-input__send:disabled { opacity: 0.45; cursor: not-allowed; }

/* ----- mobile drawer ------------------------------------------------------ */
@media (max-width: 640px) {
  .cc-launcher {
    right: 16px;
    bottom: 16px;
    padding: 12px 18px 12px 16px;
    font-size: 15.5px;
  }
  .cc-panel {
    inset: auto 0 0 0;
    width: 100%;
    height: 88vh;
    max-height: 88vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-radius: 18px 18px 0 0;
  }
}

/* ----------------------------------------------------------------------------
 * Sprint 4 — error banner / red-flag callout / booking success affordance
 * ------------------------------------------------------------------------- */

/* Inline error banner (4xx/5xx from /chat). Sits at the top of the body. */
.cc-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff4e8;
  border: 1px solid #d8a45a;
  color: #5a3b14;
  font-family: var(--cc-font-body);
  font-size: 14.5px;
  line-height: 1.5;
}
.cc-error__icon { flex: 0 0 auto; color: #b27226; }
.cc-error__dismiss {
  margin-left: auto;
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: #5a3b14;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background-color 140ms ease-out;
}
.cc-error__dismiss:hover { background: rgba(178, 114, 38, 0.12); }
.cc-error__dismiss:focus-visible {
  outline: 2px solid #b27226;
  outline-offset: 2px;
}

/* Red-flag advisory callout — warm amber on beige, shown once per session. */
.cc-redflag {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff4e0 0%, #f9ecd2 100%);
  border: 1px solid #d8a45a;
  color: #5a3b14;
  font-family: var(--cc-font-body);
  font-size: 14.5px;
  line-height: 1.55;
  box-shadow: 0 2px 8px rgba(178, 114, 38, 0.12);
}
.cc-redflag__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--cc-font-display);
  font-size: 17px;
  font-weight: 600;
  color: #6b3f0d;
  margin: 0 0 6px;
  letter-spacing: -0.005em;
}
.cc-redflag__title svg {
  flex: 0 0 auto;
  color: #b27226;
}
.cc-redflag p { margin: 0; }
.cc-redflag a {
  color: #6b3f0d;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Booking-confirmed metadata — green tick + booking id chip + reset button. */
.cc-msg--assistant.is-booking-confirmed .cc-msg__bubble {
  border-color: rgba(45, 80, 22, 0.35);
  box-shadow: 0 1px 0 rgba(45,80,22,0.06), 0 4px 14px rgba(45,80,22,0.08);
}
.cc-msg__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-left: 2px;
}
.cc-tick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(45, 80, 22, 0.10);
  color: var(--cc-forest);
  font-family: var(--cc-font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.cc-tick svg { flex: 0 0 auto; }
.cc-bookingid {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(139, 168, 136, 0.18);
  color: var(--cc-ink-soft);
  font-family: var(--cc-font-body);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}
.cc-reset {
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px dashed var(--cc-sage);
  background: transparent;
  color: var(--cc-forest);
  font-family: var(--cc-font-display);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  align-self: flex-start;
  transition: transform 160ms cubic-bezier(0.4,0,0.2,1),
              background-color 180ms ease-out,
              border-color 180ms ease-out;
}
.cc-reset:hover {
  background: rgba(139, 168, 136, 0.10);
  border-color: var(--cc-forest);
}
.cc-reset:active { transform: scale(0.97); }
.cc-reset:focus-visible {
  outline: 2px solid var(--cc-forest);
  outline-offset: 2px;
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .cc-launcher, .cc-panel, .cc-chip, .cc-close, .cc-input__send {
    transition: none !important;
  }
  .cc-typing span { animation: none !important; opacity: 0.7; }
}
