/* ============ Chat Box ============ */
:root{
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --in: #eef2ff;       /* incoming bubble */
  --out: #d1fae5;      /* outgoing bubble */
  --ring: #e5e7eb;
  --radius: 16px;
}

* { box-sizing: border-box; }

body{
  margin:0;
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
}

.chat{
  width: min(960px, 100%);
  height: 80vh;
  margin: 24px auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--panel);
  border: 1px solid var(--ring);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(2,6,23,.06);
}

/* Header */
.chat__header{
  padding: 14px 18px;
  border-bottom: 1px solid var(--ring);
  background: linear-gradient(180deg,#ffffff,#fafafa);
}
.chat__title{
  font-weight: 700;
  letter-spacing:.2px;
}

/* Messages */
.chat__messages{
  padding: 16px;
  overflow-y: auto;
  display: grid;
  gap: 0px;
  background:
    radial-gradient(1000px 200px at 50% -40%, #ffffff 30%, transparent 70%),
    var(--bg);
}

/* Message row */
.msg{
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  gap: 10px;
  max-width: 82%;
}

.msg--out{
  justify-self: end;
  grid-template-columns: 1fr;
  text-align: right;
}

/* Avatar (only for incoming) */
.msg__avatar{
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--ring);
}

/* Bubble + meta */
.msg__content{
  display: grid;
  gap: 4px;
}

.msg__bubble{
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--in);
  border: 1px solid #e8eaff;
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  box-shadow: 0 2px 8px rgba(2,6,23,.04);
}

.msg--out .msg__bubble{
  background: var(--out);
  border-color: #c7f0df;
  justify-self: end;
  border-bottom-right-radius: 6px;
}

.msg--in .msg__bubble{
  border-bottom-left-radius: 6px;
}

.msg__meta{
  font-size: 12px;
  color: var(--muted);
}

/* Input bar */
.chat__inputbar{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--ring);
  background: #fff;
}

.chat__input{
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--ring);
  border-radius: var(--radius);
  outline: none;
}
.chat__input:focus{
  border-color: #cbd5e1;
  box-shadow: 0 0 0 4px #eff6ff;
}

.chat__send{
  padding: 0 16px;
  border: 1px solid #1d4ed8;
  background: #2563eb;
  color: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
}
.chat__send:hover{ filter: brightness(.98); }

/* Scrollbar (nice-to-have) */
.chat__messages::-webkit-scrollbar{ width: 10px; }
.chat__messages::-webkit-scrollbar-thumb{
  background: #e5e7eb; border-radius: 999px;
}

/* Mobile tweaks */
@media (max-width: 520px){
  .chat{ height: 90vh; border-radius: 0; }
  .msg{ max-width: 92%; }
}
