:root{
  --bg:linear-gradient(160deg,#f7f9fc 0%,#eef2f9 100%);
  --card:#ffffff;
  --user:#0b93f6;
  --user-text:#fff;
  --bot:#e6e9ee;
  --muted:#6b7280;
  --accent:#111827;
}

html,body{
  height:100%;
  margin:0;
  padding:0;
  touch-action: manipulation;
  font-family:'Inter',system-ui,Segoe UI,Roboto,"Helvetica Neue",Arial;
  background:var(--bg);
}

input, textarea { font-size:16px !important; }

body{display:flex;align-items:center;justify-content:center;}

.container {
  width: 100vw;
  height: 100dvh;
  background: var(--card);
  box-shadow: 0 2px 12px rgba(15,23,42,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

header{
  padding:12px 18px 8px 18px;border-bottom:1px solid #f0f1f3;
  display:flex;align-items:center;justify-content:space-between;
}

.logo-wrap{display:flex;align-items:center;gap:10px;}
.logo{height:28px;}
header h1{margin:0;font-size:16px;color:var(--accent);}
.meta{font-size:13px;color:var(--muted);display:flex;align-items:center;gap:12px;}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: radial-gradient(1200px 1200px at 100% 0%,
             rgba(11,147,246,0.03), transparent 6%);
}

.msg-wrap{display:flex;align-items:flex-end;gap:6px;}
.msg-wrap.user{flex-direction:row-reverse;}

.msg-avatar{
  width:28px;height:28px;border-radius:50%;
  background-size:cover;background-position:center;
  flex-shrink:0;
}

.msg{
  max-width:75%;padding:10px 14px;border-radius:18px;
  line-height:1.5;word-break:break-word;
  box-shadow:0 2px 6px rgba(0,0,0,0.05);
  font-size:15px;animation:bubbleIn 0.25s ease-out;
}

.msg.user{
  background:var(--user);color:var(--user-text);
  border-bottom-right-radius:8px;
  box-shadow:0 2px 6px rgba(11,147,246,0.25);
}

.msg.bot{
  background:var(--bot);color:#111827;
  border-bottom-left-radius:8px;
}

@keyframes bubbleIn{
  from{transform:scale(0.96) translateY(4px);opacity:0;}
  to{transform:scale(1) translateY(0);opacity:1;}
}

.time{
  font-size:11px;opacity:0.8;margin-top:3px;text-align:right;
}
.msg.user .time{color:rgba(255,255,255,0.85);}

/* Giao diện composer mới giống Telegram */
.composer {
  padding: 6px 10px;
  border-top: 1px solid #f0f1f3;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
}
.input-wrap{flex:1;display:flex;flex-direction:column;position:relative;}

textarea {
  resize: none;
  border-radius: 15px;
  border: 1px solid #e6e9ee;
  padding: 4px 10px;       /* Giảm padding để không bị thành 2 dòng */
  font-size: 15px;
  min-height: 20px;        /* Chiều cao nhỏ nhất */
  max-height: 100px;
  line-height: 1.2;        /* Chiều cao 1 dòng */
  height: 28px !important;   /* Dòng này đảm bảo 1 dòng */
}

textarea:focus {
  outline: none; /* quan trọng nhất */
  border-color: #5aa7ff;
  box-shadow: 0 0 0 0.5px rgba(90, 167, 255, 0.35);
}


/* Ẩn bộ đếm khi chiều cao quá thấp hoặc muốn giống Telegram */
.char-count {
  bottom: -16px;
  right: 6px;
  font-size: 11px;
  opacity: 0.6;
}

button{
  background:var(--user);
  color:var(--user-text);
  border:none;
  padding:10px 18px;
  height:44px;
  display:flex;
  align-items:center;
  border-radius:12px;
}

button:hover{opacity:0.9;}
button:disabled{opacity:0.6;cursor:not-allowed;}

.banner{
  background:#fde68a;color:#92400e;font-size:13px;text-align:center;
  padding:4px;position:absolute;top:0;left:0;width:100%;
  transform:translateY(-100%);transition:transform 0.4s ease;
}
.banner.show{transform:translateY(0);}

#loginBox{
  position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);
  width:380px;max-width:90%;background:white;padding:28px 24px;
  border-radius:16px;box-shadow:0 8px 28px rgba(0,0,0,0.08);
  text-align:left;
}
#loginBox input{
  width:100%;
  box-sizing:border-box;
  margin-bottom:12px;
  padding:12px;
  border-radius:10px;
  border:1px solid #e2e8f0;
  font-size:15px;
}
#loginBox button{
  width:100%;
  display:block;
  margin-top:4px;
  padding:12px;
  border-radius:10px;
}

.typingIndicator{
  font-style:italic;
  color:var(--muted);
  opacity:0.9;
}

.dot{
  display:inline-block;
  width:6px;
  height:6px;
  background:#9aa6b2;
  border-radius:50%;
  margin:0 2px;
  animation: blink 1.2s infinite;
}
.dot:nth-child(2){ animation-delay:.15s }
.dot:nth-child(3){ animation-delay:.3s }

@keyframes blink {
  0%,80%,100%{opacity:.15}
  40%{opacity:1}
}

/* ==============================
   CHANGE PASSWORD BOX — giống loginBox
============================== */
#changePassBox {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 380px;
  max-width: 90%;
  background: white;
  padding: 28px 24px;
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.08);
  text-align: left;
}

#changePassBox input {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  font-size: 15px;
}

#changePassBox button {
  width: 100%;
  display: block;
  margin-top: 4px;
  padding: 12px;
  border-radius: 10px;
  background: var(--user);
  color: var(--user-text);
}

#changePassBox button:hover {
  opacity: 0.9;
}

#changePassBox a {
  color: #0b93f6;
  text-decoration: none;
}

#changePassBox h1 {
  font-size: 22px;
  margin-top: 0;
  margin-bottom: 16px;
  text-align: center;
}
