

/* ==========================================================================
   NUCOAT SOLUTIONS — FLOATING CHATBOT
   All selectors are namespaced under #nucoat-chat-root / .nc-*
   No global element, body, header or theme styles are modified.
   ========================================================================== */

/* ---------- OPTIONAL STANDALONE PAGE SHELL (safe to delete when embedding) ---------- */
html.nc-standalone, body.nc-standalone { margin: 0; padding: 0; min-height: 100%; }
body.nc-standalone {
  background: #eef3f1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body.nc-standalone .nc-demo-note {
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 24px;
  color: #10231f;
  font-size: 15px;
  line-height: 1.7;
}
body.nc-standalone .nc-demo-note h1 { font-size: 22px; margin: 0 0 10px; }
body.nc-standalone .nc-demo-note p { margin: 0 0 10px; color: #4b5f5b; }
/* ------------------------------------------------------------------------------------ */

#nucoat-chat-root,
#nucoat-chat-root *,
#nucoat-chat-root *::before,
#nucoat-chat-root *::after { box-sizing: border-box; }

#nucoat-chat-root {
  /* ---- namespaced design tokens ---- */
  --nc-accent: #da251d;
  --nc-accent-2: #da251d;
  --nc-accent-dark: #da251d;
  --nc-accent-soft: #e6f5f1;
  --nc-ink: #10231f;
  --nc-ink-soft: #4b5f5b;
  --nc-surface: #ffffff;
  --nc-surface-alt: #f5f8f7;
  --nc-border: #dbe5e2;
  --nc-danger: #b3261e;
  --nc-danger-soft: #fdecea;
  --nc-radius: 16px;
  --nc-shadow: 0 18px 48px rgba(8, 41, 34, 0.18), 0 2px 6px rgba(8, 41, 34, 0.08);
  --nc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  font-family: var(--nc-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--nc-ink);
  text-align: left;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#nucoat-chat-root [hidden] { display: none !important; }

#nucoat-chat-root button,
#nucoat-chat-root input,
#nucoat-chat-root select,
#nucoat-chat-root textarea { font: inherit; color: inherit; margin: 0; }

#nucoat-chat-root .nc-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ============================ RIGHT-EDGE TAB ============================ */
#nucoat-chat-root .nc-tab {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  pointer-events: auto;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 20px 11px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-right: 0;
  border-radius: 14px 0 0 14px;
  background: linear-gradient(180deg, var(--nc-accent-2) 0%, var(--nc-accent-dark) 100%);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: -8px 10px 26px rgba(8, 41, 34, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
#nucoat-chat-root .nc-tab:hover { transform: translateY(-50%) translateX(-3px); box-shadow: -11px 12px 30px rgba(8, 41, 34, 0.34); }
#nucoat-chat-root .nc-tab:focus-visible { outline: 3px solid #ffffff; outline-offset: -4px; }
#nucoat-chat-root .nc-tab.nc-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-50%) translateX(14px);
}

/* ============================== PANEL ================================== */
#nucoat-chat-root .nc-panel {
  position: absolute;
  right: 22px;
  bottom: 22px;
  pointer-events: auto;
  width: 384px;
  max-width: calc(100vw - 44px);
  height: 618px;
  max-height: calc(100vh - 44px);
  max-height: calc(100dvh - 44px);
  display: flex;
  flex-direction: column;
  background: var(--nc-surface);
  border: 1px solid var(--nc-border);
  border-radius: var(--nc-radius);
  box-shadow: var(--nc-shadow);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}
#nucoat-chat-root .nc-panel.nc-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
#nucoat-chat-root .nc-panel:focus { outline: none; }

/* ------------------------------ HEADER --------------------------------- */
#nucoat-chat-root .nc-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  background: #da251d;
  color: #ffffff;
}
#nucoat-chat-root .nc-header-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
#nucoat-chat-root .nc-logo {
  flex: 0 0 auto;
  width: 80px; height: 55px;
  border-radius: 10px;
  background: rgb(255, 255, 255);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; letter-spacing: 0.03em;
}
#nucoat-chat-root .nc-header-text { min-width: 0; }
#nucoat-chat-root .nc-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#nucoat-chat-root .nc-subtitle {
  margin: 1px 0 0;
  font-size: 11.5px;
  font-weight: 500;
  opacity: 0.88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#nucoat-chat-root .nc-close {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.16s ease;
}
#nucoat-chat-root .nc-close:hover { background: rgba(255, 255, 255, 0.24); }
#nucoat-chat-root .nc-close:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
#nucoat-chat-root .nc-close svg { width: 17px; height: 17px; display: block; }

/* --------------------------- QUICK ACTION BAR -------------------------- */
#nucoat-chat-root .nc-quickbar {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #ffffff;
  border-bottom: 1px solid var(--nc-border);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
#nucoat-chat-root .nc-quickbar::-webkit-scrollbar { display: none; }
#nucoat-chat-root .nc-quick {
  flex: 0 0 auto;
  border: 1px solid var(--nc-border);
  background: var(--nc-surface-alt);
  color: var(--nc-ink);
  border-radius: 999px;
  padding: 8px 13px;
  min-height: 34px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
#nucoat-chat-root .nc-quick:hover { background: var(--nc-accent-soft); border-color: var(--nc-accent); color: var(--nc-accent-dark); }
#nucoat-chat-root .nc-quick:focus-visible { outline: 2px solid var(--nc-accent-dark); outline-offset: 2px; }
#nucoat-chat-root .nc-quick:active { transform: scale(0.98); }

/* ------------------------------- BODY ---------------------------------- */
#nucoat-chat-root .nc-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--nc-surface);
}
#nucoat-chat-root .nc-view { min-height: 100%; }

/* ----------------------------- MESSAGES -------------------------------- */
#nucoat-chat-root .nc-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 14px 20px;
  scroll-behavior: smooth;
}
#nucoat-chat-root .nc-msg { display: flex; align-items: flex-end; gap: 8px; }
#nucoat-chat-root .nc-msg-user { justify-content: flex-end; }
#nucoat-chat-root .nc-avatar {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--nc-accent-2), var(--nc-accent-dark));
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  display: flex; align-items: center; justify-content: center;
  user-select: none;
}
#nucoat-chat-root .nc-bubble {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  background: var(--nc-surface-alt);
  border: 1px solid var(--nc-border);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--nc-ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}
#nucoat-chat-root .nc-msg-bot .nc-bubble { border-bottom-left-radius: 4px; }
#nucoat-chat-root .nc-msg-user .nc-bubble {
  background: linear-gradient(180deg, var(--nc-accent-2), var(--nc-accent));
  border-color: transparent;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
#nucoat-chat-root .nc-p { margin: 0; }
#nucoat-chat-root .nc-p + .nc-p { margin-top: 8px; }
#nucoat-chat-root .nc-p strong { font-weight: 700; }
#nucoat-chat-root .nc-link { color: var(--nc-accent-dark); font-weight: 700; text-decoration: underline; overflow-wrap: anywhere; }
#nucoat-chat-root .nc-msg-user .nc-link { color: #ffffff; }

/* ------------------------------- CHIPS --------------------------------- */
#nucoat-chat-root .nc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 36px;
  scroll-behavior: smooth;
}
#nucoat-chat-root .nc-chip {
  border: 1px solid var(--nc-accent);
  background: #ffffff;
  color: var(--nc-accent-dark);
  border-radius: 999px;
  padding: 8px 13px;
  min-height: 34px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}
#nucoat-chat-root .nc-chip:hover { background: var(--nc-accent-soft); }
#nucoat-chat-root .nc-chip:active { transform: scale(0.97); }
#nucoat-chat-root .nc-chip:focus-visible { outline: 2px solid var(--nc-accent-dark); outline-offset: 2px; }
#nucoat-chat-root .nc-chip[disabled] { opacity: 0.4; cursor: default; transform: none; }

/* ------------------------------ SUMMARY -------------------------------- */
#nucoat-chat-root .nc-summary {
  border: 1px dashed var(--nc-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #ffffff;
  font-size: 12.5px;
  line-height: 1.6;
}
#nucoat-chat-root .nc-summary-row { display: flex; gap: 8px; }
#nucoat-chat-root .nc-summary-row + .nc-summary-row { margin-top: 4px; }
#nucoat-chat-root .nc-summary-key { flex: 0 0 auto; font-weight: 800; color: var(--nc-accent-dark); min-width: 82px; }
#nucoat-chat-root .nc-summary-val { flex: 1 1 auto; color: var(--nc-ink); overflow-wrap: anywhere; }

/* ------------------------------- FOOTER -------------------------------- */
#nucoat-chat-root .nc-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--nc-border);
  background: #ffffff;
  padding: 10px 12px;
}
#nucoat-chat-root .nc-inputbar { display: flex; align-items: center; gap: 8px; }
#nucoat-chat-root .nc-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--nc-border);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 13.5px;
  background: var(--nc-surface-alt);
  color: var(--nc-ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
#nucoat-chat-root .nc-input::placeholder { color: #8ba19c; }
#nucoat-chat-root .nc-input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--nc-accent);
  box-shadow: 0 0 0 3px rgba(15, 138, 114, 0.16);
}
#nucoat-chat-root .nc-send {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--nc-accent-2), var(--nc-accent));
  color: #ffffff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: filter 0.16s ease, transform 0.16s ease;
}
#nucoat-chat-root .nc-send:hover { filter: brightness(1.06); }
#nucoat-chat-root .nc-send:active { transform: scale(0.96); }
#nucoat-chat-root .nc-send:focus-visible { outline: 2px solid var(--nc-accent-dark); outline-offset: 2px; }
#nucoat-chat-root .nc-send svg { width: 18px; height: 18px; display: block; }

/* ============================== FORM =================================== */
#nucoat-chat-root .nc-form-head { padding: 14px 16px 4px; }
#nucoat-chat-root .nc-back {
  border: 0;
  background: none;
  padding: 4px 0;
  color: var(--nc-accent-dark);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}
#nucoat-chat-root .nc-back:hover { text-decoration: underline; }
#nucoat-chat-root .nc-back:focus-visible { outline: 2px solid var(--nc-accent-dark); outline-offset: 2px; border-radius: 4px; }
#nucoat-chat-root .nc-form-title { margin: 8px 0 3px; font-size: 15.5px; font-weight: 800; letter-spacing: 0.01em; }
#nucoat-chat-root .nc-form-sub { margin: 0; font-size: 12.5px; color: var(--nc-ink-soft); }

#nucoat-chat-root .nc-form {
  display: grid;
  gap: 12px;
  padding: 14px 16px 22px;
}
#nucoat-chat-root .nc-field { display: grid; gap: 5px; }
#nucoat-chat-root .nc-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--nc-ink);
}
#nucoat-chat-root .nc-req { color: var(--nc-danger); }
#nucoat-chat-root .nc-optional { font-weight: 600; color: var(--nc-ink-soft); }

#nucoat-chat-root .nc-control {
  width: 100%;
  border: 1px solid var(--nc-border);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 13.5px;
  background: #ffffff;
  color: var(--nc-ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
#nucoat-chat-root .nc-control::placeholder { color: #9aada8; }
#nucoat-chat-root .nc-control:focus {
  outline: none;
  border-color: var(--nc-accent);
  box-shadow: 0 0 0 3px rgba(15, 138, 114, 0.16);
}
#nucoat-chat-root .nc-control[aria-invalid="true"] { border-color: var(--nc-danger); }
#nucoat-chat-root .nc-control[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.14); }
#nucoat-chat-root .nc-textarea { min-height: 78px; resize: vertical; }
#nucoat-chat-root select.nc-control {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b6b59' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
  padding-right: 34px;
}
#nucoat-chat-root .nc-error {
  margin: 0;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--nc-danger);
}

#nucoat-chat-root .nc-turnstile-wrap { min-height: 66px; }

#nucoat-chat-root .nc-hp {
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#nucoat-chat-root .nc-status {
  margin: 0;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
}
#nucoat-chat-root .nc-status-error { background: var(--nc-danger-soft); color: #8e2b20; border: 1px solid #f3c3bd; }
#nucoat-chat-root .nc-status-ok { background: var(--nc-accent-soft); color: var(--nc-accent-dark); border: 1px solid #b9e3d8; }
#nucoat-chat-root .nc-status-info { background: var(--nc-surface-alt); color: var(--nc-ink-soft); border: 1px solid var(--nc-border); }

#nucoat-chat-root .nc-submit {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #ffffff;
  background: linear-gradient(180deg, var(--nc-accent-2), var(--nc-accent-dark));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: filter 0.16s ease, opacity 0.16s ease;
}
#nucoat-chat-root .nc-submit:hover:not([disabled]) { filter: brightness(1.06); }
#nucoat-chat-root .nc-submit:focus-visible { outline: 3px solid var(--nc-accent-dark); outline-offset: 2px; }
#nucoat-chat-root .nc-submit[disabled] { opacity: 0.68; cursor: progress; }
#nucoat-chat-root .nc-spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: nc-spin 0.7s linear infinite;
}
@keyframes nc-spin { to { transform: rotate(360deg); } }

#nucoat-chat-root .nc-form-note {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--nc-ink-soft);
}

/* ------------------------------ SUCCESS -------------------------------- */
#nucoat-chat-root .nc-success { padding: 26px 20px 30px; text-align: center; }
#nucoat-chat-root .nc-success-icon {
  width: 54px; height: 54px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--nc-accent-soft);
  border: 1px solid #b9e3d8;
  display: flex; align-items: center; justify-content: center;
  color: var(--nc-accent-dark);
}
#nucoat-chat-root .nc-success-icon svg { width: 26px; height: 26px; display: block; }
#nucoat-chat-root .nc-success-title { margin: 0 0 8px; font-size: 16px; font-weight: 800; }
#nucoat-chat-root .nc-success-text { margin: 0 0 6px; font-size: 13px; line-height: 1.6; color: var(--nc-ink-soft); }
#nucoat-chat-root .nc-success-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 18px; }
#nucoat-chat-root .nc-btn-secondary {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--nc-accent);
  border-radius: 10px;
  background: #ffffff;
  color: var(--nc-accent-dark);
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.16s ease;
}
#nucoat-chat-root .nc-btn-secondary:hover { background: var(--nc-accent-soft); }
#nucoat-chat-root .nc-btn-secondary:focus-visible { outline: 3px solid var(--nc-accent-dark); outline-offset: 2px; }

/* ============================ RESPONSIVE =============================== */
@media (max-width: 640px) {
  #nucoat-chat-root .nc-panel {
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
    bottom: 40px;
    height: min(78vh, 640px);
    max-height: calc(100vh - 30px - env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 30px - env(safe-area-inset-bottom, 0px));
    border-radius: 16px;
    transform-origin: bottom center;
  }
  #nucoat-chat-root .nc-tab {
    padding: 16px 9px;
    font-size: 11.5px;
    letter-spacing: 0.14em;
  }
  #nucoat-chat-root .nc-bubble { max-width: 88%; }
  #nucoat-chat-root .nc-chips { padding-left: 0; }
}

@media (max-width: 360px) {
  #nucoat-chat-root .nc-panel { left: 6px; right: 6px; bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
  #nucoat-chat-root .nc-quick { font-size: 11.5px; padding: 7px 11px; }
}

@media (max-height: 520px) {
  #nucoat-chat-root .nc-panel { height: calc(100vh - 24px); max-height: calc(100vh - 24px); bottom: 12px; top: 12px; }
}

/* ============================ REDUCED MOTION =========================== */
@media (prefers-reduced-motion: reduce) {
  #nucoat-chat-root *,
  #nucoat-chat-root *::before,
  #nucoat-chat-root *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
