/* Nansana Municipal Council – Virtual Assistant widget. All selectors are prefixed .nmc- to avoid clashing with the site theme. */
.nmc-chat {
  --nmc-primary: #f57c00;
  --nmc-primary-2: #e65100;
  --nmc-accent: #f2b705;
  --nmc-bg: #ffffff;
  --nmc-surface: #f3f6fa;
  --nmc-border: #dbe3ec;
  --nmc-text: #1c2733;
  --nmc-muted: #5b6b7c;
  --nmc-user: #0b3c68;
  --nmc-radius: 16px;
  position: fixed; bottom: 20px; left: 20px; z-index: 2147483000;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--nmc-text);
}
.nmc-chat.nmc-pos-left { right: auto; left: 20px; }
.nmc-chat *, .nmc-chat *::before, .nmc-chat *::after { box-sizing: border-box; }
.nmc-chat button { font: inherit; cursor: pointer; margin: 0; }

/* Launcher */
.nmc-launcher {
  display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 20px 0 16px;
  border: 0; border-radius: 28px; color: #fff; background: var(--nmc-primary);
  box-shadow: 0 8px 24px rgba(11, 60, 104, .35); font-weight: 600; font-size: 15px;
  transition: transform .15s ease, background .15s ease;
}
.nmc-launcher:hover { background: var(--nmc-primary-2); transform: translateY(-1px); }
.nmc-launcher:focus-visible, .nmc-chat button:focus-visible, .nmc-chat a:focus-visible, .nmc-input:focus-visible {
  outline: 3px solid var(--nmc-accent); outline-offset: 2px;
}
.nmc-launcher svg { width: 24px; height: 24px; }
.nmc-open .nmc-launcher { display: none; }

/* Panel */
.nmc-panel {
  width: 390px; height: min(640px, calc(100vh - 40px)); display: flex; flex-direction: column;
  background: var(--nmc-bg); border-radius: var(--nmc-radius); overflow: hidden;
  box-shadow: 0 18px 48px rgba(16, 32, 56, .28), 0 2px 6px rgba(16, 32, 56, .12);
  border: 1px solid var(--nmc-border);
}
.nmc-panel[hidden] { display: none; }

.nmc-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px;
  background: linear-gradient(135deg, var(--nmc-primary), var(--nmc-primary-2)); color: #fff;
  border-bottom: 3px solid var(--nmc-accent);
}
.nmc-badge {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  background: #fff; color: var(--nmc-primary); font-weight: 800; font-size: 12px; letter-spacing: .5px;
}
.nmc-badge img { display: block; width: 100%; height: 100%; padding: 2px; object-fit: contain; }
.nmc-titles { flex: 1; min-width: 0; }
.nmc-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
.nmc-sub { font-size: 12.5px; opacity: .85; }
.nmc-icon-btn {
  width: 34px; height: 34px; border: 0; border-radius: 8px; display: grid; place-items: center;
  background: transparent; color: #fff; opacity: .9;
}
.nmc-icon-btn:hover { background: rgba(255, 255, 255, .15); opacity: 1; }

/* Messages */
.nmc-log { flex: 1; overflow-y: auto; padding: 14px 12px 6px; background: var(--nmc-surface); overscroll-behavior: contain; }
.nmc-msg { max-width: 88%; margin: 0 0 10px; padding: 10px 13px; border-radius: 14px; word-wrap: break-word; overflow-wrap: anywhere; }
.nmc-bot { background: #fff; border: 1px solid var(--nmc-border); border-top-left-radius: 4px; }
.nmc-user { margin-left: auto; background: var(--nmc-user); color: #fff; border-top-right-radius: 4px; white-space: pre-wrap; }
.nmc-msg p { margin: 0 0 8px; }
.nmc-msg p:last-child, .nmc-msg ul:last-child, .nmc-msg ol:last-child { margin-bottom: 0; }
.nmc-msg ul, .nmc-msg ol { margin: 0 0 8px; padding-left: 20px; }
.nmc-msg li { margin: 2px 0; }
.nmc-msg a { color: var(--nmc-primary-2); text-decoration: underline; text-underline-offset: 2px; }
.nmc-msg strong { font-weight: 650; }

.nmc-links { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--nmc-border); display: flex; flex-wrap: wrap; gap: 6px; }
.nmc-links-h { width: 100%; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--nmc-muted); }
.nmc-msg a.nmc-link {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; text-decoration: none;
  background: #e8f0f9; color: var(--nmc-primary); border: 1px solid #cddcee;
}
.nmc-msg a.nmc-link:hover { background: #d9e7f6; }
.nmc-msg a.nmc-link::after { content: " ↗"; font-size: 11px; opacity: .7; }

.nmc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 12px; }
.nmc-chip {
  padding: 6px 12px; border-radius: 999px; background: #fff; color: var(--nmc-primary);
  border: 1px solid var(--nmc-primary); font-size: 13px; line-height: 1.3;
}
.nmc-chip:hover { background: var(--nmc-primary); color: #fff; }

.nmc-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0 0 12px; }
.nmc-q {
  display: flex; align-items: center; gap: 7px; padding: 8px 9px; text-align: left;
  background: #fff; border: 1px solid var(--nmc-border); border-radius: 10px; color: var(--nmc-text);
  font-size: 13px; line-height: 1.25;
}
.nmc-q:hover { border-color: var(--nmc-primary-2); background: #f7fafd; }
.nmc-q-i { font-size: 16px; flex: none; }

.nmc-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.nmc-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--nmc-muted); animation: nmc-b 1s infinite ease-in-out; }
.nmc-typing span:nth-child(2) { animation-delay: .15s; }
.nmc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes nmc-b { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Input */
.nmc-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px; border-top: 1px solid var(--nmc-border); background: #fff; margin: 0; }
.nmc-input {
  flex: 1; resize: none; min-height: 42px; max-height: 120px; padding: 10px 12px; margin: 0;
  border: 1px solid var(--nmc-border); border-radius: 12px; font: inherit; color: var(--nmc-text); background: #fff;
  line-height: 1.4;
}
.nmc-input:focus { border-color: var(--nmc-primary-2); outline: none; box-shadow: 0 0 0 3px rgba(18, 84, 145, .15); }
.nmc-send {
  width: 42px; height: 42px; flex: none; border: 0; border-radius: 12px; display: grid; place-items: center;
  background: var(--nmc-primary); color: #fff;
}
.nmc-send:hover { background: var(--nmc-primary-2); }
.nmc-send:disabled { opacity: .5; cursor: default; }
.nmc-foot { padding: 6px 12px 8px; font-size: 11px; color: var(--nmc-muted); background: #fff; text-align: center; line-height: 1.35; }

@media (prefers-reduced-motion: reduce) { .nmc-typing span { animation: none; } .nmc-launcher { transition: none; } }

/* Phones: full-screen panel, icon-only launcher */
@media (max-width: 520px) {
  .nmc-chat { bottom: 16px; right: 16px; }
  .nmc-chat.nmc-pos-left { left: 16px; }
  .nmc-launcher { width: 56px; padding: 0; justify-content: center; }
  .nmc-launcher-label { display: none; }
  .nmc-open.nmc-chat { inset: 0; }
  .nmc-panel { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .nmc-input { font-size: 16px; } /* prevents iOS zoom */
}
