/* ===== Reset & base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:       #0e273a;
  --navy-light: #163450;
  --green:      #95C222;
  --green-dark: #7da81c;
  --text:       #58595B;
  --text-light: #8a8b8d;
  --bg:         #f4f5f7;
  --white:      #ffffff;
  --radius:     10px;
  --shadow:     0 2px 8px rgba(0, 0, 0, .08);
}

html, body {
  height: 100%;
  font-family: 'Lato', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

/* ===== Header ===== */
.header {
  background: var(--navy);
  color: var(--white);
  padding: 0 1.25rem;
  height: 60px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
}

.header__inner {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  gap: .75rem;
}

.header__brand {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: .3px;
}

.header__subtitle {
  font-size: .85rem;
  font-weight: 300;
  color: var(--green);
}

/* ===== Chat layout ===== */
.chat {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding-top: 60px; /* header height */
}

.chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

/* ===== Messages ===== */
.msg {
  display: flex;
  max-width: 85%;
  animation: fadeIn .25s ease;
}

.msg--user {
  align-self: flex-end;
}

.msg--bot {
  align-self: flex-start;
}

.msg__bubble {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  font-size: .95rem;
}

.msg--user .msg__bubble {
  background: var(--navy);
  color: var(--white);
  border-bottom-right-radius: 2px;
}

.msg--bot .msg__bubble {
  background: var(--white);
  color: var(--text);
  border-bottom-left-radius: 2px;
  border-left: 3px solid var(--green);
}

/* ===== Loading dots ===== */
.msg--loading .msg__bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: .85rem 1.25rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: bounce .6s infinite alternate;
}
.dot:nth-child(2) { animation-delay: .15s; }
.dot:nth-child(3) { animation-delay: .3s; }

@keyframes bounce {
  to { opacity: .3; transform: translateY(-4px); }
}

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

/* ===== Input area ===== */
.chat__form {
  padding: .75rem 1rem 1rem;
  background: var(--bg);
  border-top: 1px solid #dde0e4;
}

.chat__input-row {
  display: flex;
  gap: .5rem;
}

.chat__input {
  flex: 1;
  padding: .7rem 1rem;
  border: 1px solid #cfd2d6;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .95rem;
  outline: none;
  transition: border-color .2s;
}

.chat__input:focus {
  border-color: var(--green);
}

.chat__send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius);
  background: var(--green);
  color: var(--white);
  cursor: pointer;
  transition: background .2s;
  flex-shrink: 0;
}

.chat__send:hover {
  background: var(--green-dark);
}

.chat__send:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ===== Error bubble ===== */
.msg--error .msg__bubble {
  background: #fef2f2;
  color: #b91c1c;
  border-left-color: #ef4444;
}

/* ===== Scrollbar ===== */
.chat__messages::-webkit-scrollbar {
  width: 6px;
}
.chat__messages::-webkit-scrollbar-thumb {
  background: #c4c7cc;
  border-radius: 3px;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .msg { max-width: 92%; }
  .header__brand { font-size: 1.05rem; }
  .chat__messages { padding: 1rem .75rem .75rem; }
}
