/* KGS (Kotnani Global Solutions) website assistant: desktop design mockup, Direction A adapted to the KGS brand.
   Visual reference only, not application code. Brand values taken from kotnaniglobal.com (css/style.css, logo SVGs).
   Structurally responsive: rem/%-based sizing, min()/clamp(), flex/grid. No mobile-specific screens in this phase. */

@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  /* KGS brand (site tokens --kgs-primary, --bg-dark, text #262626, surface #F4F4F4, tint #FFEDEF) */
  --kgs-red: #ce2027;          /* buttons, send, focus: white text 4.9:1 */
  --kgs-red-hover: #b51a21;
  --kgs-red-text: #a3141a;     /* red used as text: 6.9:1 on white, 6.0:1 on the tint */
  --kgs-tint: #ffedef;
  --kgs-dark: #0d0d0d;
  --kgs-header: #141414;

  --ink: #1a1a1a;              /* 17.4:1 */
  --text: #262626;             /* 15.1:1, site body colour */
  --muted: #5c5c5c;            /* 6.6:1 */
  --border: #e5e7eb;
  --border-strong: #cfd3d8;
  --surface: #ffffff;
  --subtle: #f4f4f4;
  --canvas: #eceef1;

  --font: "Montserrat", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;

  --panel-w: min(26.25rem, calc(100vw - 3rem));          /* 420px, never wider than the viewport */
  --panel-h: min(43.75rem, calc(100vh - 6.5rem));        /* 700px, fits shorter laptop screens */
  --r-panel: 1rem;
  --r-card: 0.75rem;
  --r-control: 0.625rem;
  --r-chip: 0.375rem;
  /* the 1px light ring keeps the panel distinct over dark page sections (the KGS hero and navigation) */
  --shadow-panel: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 0.75rem 2rem rgba(13, 13, 13, 0.22), 0 0.125rem 0.375rem rgba(13, 13, 13, 0.08);
}

* { box-sizing: border-box; }
html { font-size: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--canvas); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(206, 32, 39, 0.45); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- review page chrome (not part of the widget) ---------- */
.review { max-width: 75rem; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.review-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem 2rem; margin-bottom: 1.75rem; }
.review-head h1 { margin: 0; font-size: 1.5rem; line-height: 1.3; color: var(--ink); }
.review-head p { margin: 0.375rem 0 0; max-width: 46rem; font-size: 0.9375rem; line-height: 1.6; color: #3f3f3f; }
.review-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.review-nav a { font-size: 0.875rem; padding: 0.5rem 0.75rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: #3f3f3f; }
.review-nav a[aria-current="page"] { background: var(--kgs-dark); border-color: var(--kgs-dark); color: #ffffff; }
.boards { display: flex; flex-wrap: wrap; gap: 2.5rem; justify-content: center; align-items: flex-start; }
.board { width: var(--panel-w); display: flex; flex-direction: column; gap: 0.75rem; }
.board-label { font-size: 0.8125rem; font-weight: 500; color: #3f3f3f; text-align: center; line-height: 1.4; }

/* ---------- widget ---------- */
.kgs-panel {
  width: var(--panel-w);
  height: var(--panel-h);
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
.kgs-panel.expanded { height: auto; }               /* review only: whole exchange without inner scrolling */
.kgs-panel.expanded .kgs-body { overflow: visible; }

.kgs-header { flex: none; display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0.375rem 0.75rem 1.125rem; background: var(--kgs-header); color: #ffffff; }
.kgs-header-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.3125rem; }
.kgs-header-logo { display: block; width: 6.75rem; height: auto; }
.kgs-header-sub { font-size: 0.75rem; line-height: 1rem; color: rgba(255, 255, 255, 0.78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kgs-header .icon-btn { color: #ffffff; }
.kgs-header .icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.icon-btn { width: 2.75rem; height: 2.75rem; flex: none; border: 0; border-radius: var(--r-control); background: transparent; color: #3f3f3f; display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--subtle); }

.kgs-body { flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 1.25rem; scrollbar-width: thin; }

/* welcome */
.kgs-body.welcome { gap: 1.125rem; }
.kgs-welcome h2 { margin: 0 0 0.5rem; font-size: 1.3125rem; line-height: 1.35; font-weight: 700; color: var(--ink); letter-spacing: -0.005em; }
.kgs-welcome p { margin: 0; font-size: 0.875rem; line-height: 1.65; color: var(--text); }
.eyebrow { margin: 0 0 0.625rem; font-size: 0.6875rem; line-height: 1rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.suggestions { display: flex; flex-direction: column; gap: 0.5rem; }
.suggestion { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; width: 100%; min-height: 3rem; padding: 0.75rem 0.875rem; border: 1px solid var(--border); border-radius: var(--r-control); background: var(--surface); text-align: left; font-size: 0.84375rem; line-height: 1.4; font-weight: 500; color: var(--ink); cursor: pointer; }
.suggestion:hover { border-color: rgba(206, 32, 39, 0.4); background: #fff8f8; }
.suggestion svg { flex: none; color: var(--kgs-red-text); }
.notice { margin-top: auto; display: flex; gap: 0.625rem; align-items: flex-start; padding: 0.75rem 0.875rem; border-radius: var(--r-control); background: var(--subtle); font-size: 0.78125rem; line-height: 1.55; color: #3f3f3f; }
.notice svg { flex: none; margin-top: 0.125rem; }

/* messages */
.timestamp { align-self: center; font-size: 0.75rem; color: var(--muted); }
.msg-user { align-self: flex-end; max-width: 86%; padding: 0.625rem 0.875rem; border-radius: 0.875rem 0.875rem 0.25rem 0.875rem; background: var(--subtle); color: var(--ink); font-size: 0.875rem; line-height: 1.6; font-weight: 500; }
.msg-assistant { display: flex; flex-direction: column; gap: 0.75rem; }
.assistant-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; font-weight: 700; color: var(--muted); }
.assistant-mark { width: 1.25rem; height: 1.25rem; border-radius: var(--r-chip); background: var(--kgs-red); color: #ffffff; display: inline-grid; place-items: center; font-size: 0.5625rem; font-weight: 700; letter-spacing: 0.02em; }
.msg-assistant p { margin: 0; font-size: 0.875rem; line-height: 1.7; color: var(--text); }
.msg-assistant .eyebrow { margin: 0 0 0.5rem; font-size: 0.6875rem; line-height: 1rem; color: var(--muted); }

.cite { display: inline-grid; place-items: center; min-width: 1.125rem; height: 1.125rem; margin-left: 0.1875rem; padding: 0 0.25rem; border-radius: 0.3125rem; background: var(--kgs-tint); color: var(--kgs-red-text); font-size: 0.6875rem; font-weight: 700; line-height: 1.125rem; text-decoration: none; vertical-align: 0.125rem; }
.cite:hover { background: var(--kgs-red); color: #ffffff; }

.sources { display: flex; flex-direction: column; gap: 0.5rem; }
.source-card { display: flex; gap: 0.75rem; align-items: center; min-height: 2.75rem; padding: 0.625rem 0.75rem; border: 1px solid var(--border); border-radius: var(--r-control); background: var(--surface); text-decoration: none; }
.source-card:hover { border-color: rgba(206, 32, 39, 0.4); background: #fff8f8; }
.source-num { flex: none; width: 1.375rem; height: 1.375rem; border-radius: var(--r-chip); background: var(--kgs-tint); color: var(--kgs-red-text); font-size: 0.75rem; font-weight: 700; display: grid; place-items: center; }
.source-text { flex: 1; min-width: 0; }
.source-title { display: block; font-size: 0.8125rem; line-height: 1.4; font-weight: 700; color: var(--ink); }
.source-url { display: block; font-size: 0.75rem; line-height: 1.4; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-card > svg { flex: none; color: var(--muted); }

.booking { display: flex; flex-direction: column; gap: 0.75rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--r-card); background: #fafafa; }
.booking-head { display: flex; gap: 0.75rem; align-items: flex-start; }
.booking-icon { flex: none; width: 2.25rem; height: 2.25rem; border-radius: var(--r-control); background: var(--kgs-tint); color: var(--kgs-red-text); display: grid; place-items: center; }
.booking-title { font-size: 0.875rem; line-height: 1.4; font-weight: 700; color: var(--ink); }
.booking-sub { margin-top: 0.125rem; font-size: 0.8125rem; line-height: 1.55; color: #3f3f3f; }
.booking-note { font-size: 0.71875rem; line-height: 1.45; color: var(--muted); }

.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 2.75rem; padding: 0 1rem; border-radius: var(--r-control); border: 1px solid var(--kgs-red); background: var(--kgs-red); color: #ffffff; font-weight: 700; font-size: 0.84375rem; text-decoration: none; cursor: pointer; }
.btn-primary:hover { background: var(--kgs-red-hover); border-color: var(--kgs-red-hover); }

.answer-actions { display: flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; color: var(--muted); }
.answer-actions .icon-btn { width: 2.25rem; height: 2.25rem; color: var(--muted); }

/* composer */
.kgs-composer { flex: none; padding: 0.75rem 0.875rem 0.875rem; border-top: 1px solid var(--border); background: var(--surface); }
.composer-box { display: flex; align-items: flex-end; gap: 0.5rem; padding: 0.25rem 0.25rem 0.25rem 0.875rem; border: 1px solid var(--border-strong); border-radius: 0.75rem; background: var(--surface); }
.composer-box:focus-within { border-color: var(--kgs-red); box-shadow: 0 0 0 3px rgba(206, 32, 39, 0.16); }
.composer-box textarea { flex: 1; min-height: 2.75rem; max-height: 8rem; border: 0; outline: none; resize: none; background: transparent; padding: 0.6875rem 0; font-size: 0.875rem; line-height: 1.5; }
.composer-box textarea::placeholder { color: #6b6b6b; }
.send { width: 2.75rem; height: 2.75rem; flex: none; border: 0; border-radius: var(--r-control); background: var(--kgs-red); color: #ffffff; display: grid; place-items: center; cursor: pointer; }
.send:hover { background: var(--kgs-red-hover); }
.composer-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 0.75rem; margin-top: 0.5rem; font-size: 0.6875rem; line-height: 1.4; color: var(--muted); }
.composer-meta span:last-child { white-space: nowrap; }

/* launcher (minimised) */
.kgs-launcher { display: inline-flex; align-items: center; gap: 0.625rem; min-height: 3.5rem; padding: 0 1.25rem 0 1rem; border: 0; border-radius: 999px; background: var(--kgs-red); color: #ffffff; font-weight: 700; font-size: 0.9375rem; box-shadow: var(--shadow-panel); cursor: pointer; }
.kgs-launcher:hover { background: var(--kgs-red-hover); }
