@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light;
  --ink: #14233d;
  --muted: #66758c;
  --primary: #1263d6;
  --primary-dark: #0b4ba8;
  --primary-soft: #edf5ff;
  --surface: #fff;
  --background: #edf3fb;
  --line: #dce6f3;
  --success: #22a06b;
  --shadow: 0 24px 70px rgba(35, 67, 112, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 0 0, rgba(133, 195, 255, 0.25), transparent 34%),
    var(--background);
  color: var(--ink);
  font-family: "Be Vietnam Pro", Arial, sans-serif;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(1500px, 100%);
  height: 100vh;
  margin: auto;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.sidebar,
.chat-panel {
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 28px;
}

.brand, .assistant-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand > div:last-child,
.assistant-identity > div:last-child {
  display: grid;
  gap: 3px;
}

.brand strong, .assistant-identity strong { font-size: 14px; }
.brand span, .assistant-identity span { color: var(--muted); font-size: 11px; line-height: 1.45; }

.brand-mark,
.welcome-icon {
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
}

.sidebar-copy { margin: 64px 0 36px; }
.eyebrow, .dialog-eyebrow, .section-label {
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1 {
  margin: 15px 0;
  font-size: clamp(29px, 3vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.045em;
}

.sidebar-copy p, .trust-note span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.suggestions { display: grid; gap: 8px; }
.section-label { margin-bottom: 5px; color: var(--muted); }

.suggestions button {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-size: 12px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.suggestions button:hover {
  transform: translateY(-1px);
  border-color: #9fc5f5;
  box-shadow: 0 8px 20px rgba(38, 96, 169, 0.09);
}

.suggestions button span { color: var(--primary); font-size: 10px; font-weight: 700; }

.trust-note {
  display: grid;
  gap: 7px;
  margin-top: auto;
  padding: 16px;
  border: 1px solid #d7e8fb;
  border-radius: 14px;
  background: var(--primary-soft);
}

.trust-note strong { font-size: 12px; }
.trust-note span { font-size: 11px; }

.chat-panel {
  min-width: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}

.assistant-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #cfe3fa;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
}

.assistant-avatar i {
  position: absolute;
  right: 0;
  bottom: 1px;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--success);
}

.new-chat {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.messages {
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 30px max(24px, calc((100% - 800px) / 2));
  background:
    linear-gradient(rgba(255, 255, 255, 0.86), rgba(249, 252, 255, 0.96)),
    radial-gradient(circle at 100% 0, #dceeff, transparent 30%);
}

.welcome {
  max-width: 580px;
  margin: min(12vh, 100px) auto 0;
  text-align: center;
  animation: rise 0.45s ease both;
}

.welcome-icon {
  width: 50px;
  height: 50px;
  margin: 0 auto 18px;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(18, 99, 214, 0.22);
}

.welcome h2 { margin: 0; font-size: 28px; letter-spacing: -0.035em; }
.welcome p { margin: 10px 0 22px; color: var(--muted); font-size: 13px; }
.welcome-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }

.welcome-actions button {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #fff;
  color: var(--primary-dark);
  font-size: 11px;
}

.message-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  animation: rise 0.3s ease both;
}

.message-row.user { justify-content: flex-end; }

.message-avatar {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  margin-top: 3px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 8px;
  font-weight: 700;
}

.message {
  width: fit-content;
  max-width: min(700px, 88%);
  padding: 15px 17px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.7;
}

.message p { margin: 0 0 10px; }
.message p:last-child { margin-bottom: 0; }
.message ul { margin: 8px 0 12px; padding-left: 20px; }
.message li { margin: 5px 0; padding-left: 2px; }
.message strong { color: #102b51; font-weight: 700; }
.message a { color: var(--primary-dark); overflow-wrap: anywhere; }

.message.assistant {
  border: 1px solid var(--line);
  border-top-left-radius: 5px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(33, 68, 111, 0.06);
}

.message.user {
  border-bottom-right-radius: 5px;
  background: var(--primary);
  color: #fff;
  white-space: pre-wrap;
}

.typing {
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 56px;
  min-height: 40px;
}

.typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7791b1;
  animation: blink 1.1s infinite ease-in-out;
}

.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }

.result-group {
  max-width: 700px;
  margin: -10px 0 22px 38px;
  animation: rise 0.35s ease both;
}

.result-label { margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.product-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }

.product-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}

.product-card:hover { transform: translateY(-1px); border-color: #91bff2; }
.product-card strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 11px; line-height: 1.45; }
.product-card span { color: var(--primary); font-size: 11px; font-weight: 700; }
.product-card i { color: var(--primary); font-size: 18px; font-style: normal; }

.quote-button {
  margin-top: 10px;
  padding: 10px 14px;
  border: 0;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.composer-wrap {
  padding: 12px max(22px, calc((100% - 800px) / 2)) 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  padding: 7px 7px 7px 15px;
  border: 1px solid #cfdcec;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 7px 22px rgba(31, 67, 111, 0.07);
}

.composer:focus-within { border-color: #83b4ed; box-shadow: 0 0 0 3px rgba(18, 99, 214, 0.08); }

.composer textarea {
  max-height: 120px;
  padding: 8px 0;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
}

.composer button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 11px;
  background: var(--primary);
}

.composer button:disabled { cursor: not-allowed; opacity: 0.5; }
.composer svg { width: 18px; fill: none; stroke: #fff; stroke-linecap: round; stroke-width: 2; }
.composer-wrap small { display: block; margin-top: 7px; color: #8390a2; font-size: 9px; text-align: center; }

dialog {
  width: min(620px, calc(100% - 24px));
  max-height: calc(100vh - 30px);
  overflow-y: auto;
  padding: 28px;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  box-shadow: 0 28px 100px rgba(10, 32, 62, 0.3);
}

dialog::backdrop { background: rgba(13, 31, 55, 0.58); backdrop-filter: blur(3px); }
dialog form { position: relative; display: grid; gap: 13px; }
dialog h2, dialog p { margin: 0; }
dialog h2 { font-size: 25px; letter-spacing: -0.035em; }
dialog p { color: var(--muted); font-size: 12px; line-height: 1.6; }

.close { position: absolute; top: -15px; right: -8px; border: 0; background: none; color: var(--muted); font-size: 26px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.form-grid label { display: grid; gap: 6px; color: #43536a; font-size: 10px; font-weight: 600; }
.form-grid .full { grid-column: 1 / -1; }

input, select, dialog textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline-color: var(--primary);
  color: var(--ink);
  font-size: 12px;
}

.submit-lead {
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

#lead-result { color: var(--primary-dark); font-size: 11px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes blink {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

@media (max-width: 980px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; grid-template-columns: 1fr; padding: 0; }
  .sidebar { display: none; }
  .chat-panel { min-height: 100vh; border: 0; border-radius: 0; }
  .messages { min-height: 0; padding: 24px 16px; }
  .composer-wrap { position: sticky; bottom: 0; padding: 10px 12px; }
}

@media (max-width: 560px) {
  .chat-header { padding: 12px 14px; }
  .new-chat { width: 36px; height: 36px; overflow: hidden; padding: 0; color: var(--primary); font-size: 0; }
  .new-chat::after { content: "+"; display: grid; place-items: center; color: var(--primary); font-size: 20px; }
  .welcome { margin-top: 11vh; }
  .welcome h2 { font-size: 23px; }
  .message { max-width: 92%; padding: 13px 14px; font-size: 12px; }
  .result-group { margin-left: 0; }
  .product-links { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  dialog { padding: 24px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; }
}
