* {
  box-sizing: border-box;
}

:root {
  --bg: #0f1220;
  --bg-soft: #171b2e;
  --primary: #6c5ce7;
  --primary-2: #a29bfe;
  --accent: #00d2b8;
  --text: #eef0f8;
  --muted: #9aa0b4;
  --bubble-bot: #1f2340;
  --bubble-user: linear-gradient(135deg, #6c5ce7, #8e6cf1);
  --radius: 18px;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Cairo', sans-serif;
  background: radial-gradient(circle at 20% 0%, #232849 0%, #0f1220 55%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.app {
  width: 100%;
  max-width: 560px;
  height: 90vh;
  max-height: 820px;
  background: var(--bg-soft);
  border-radius: 24px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #221f45, #191a35);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

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

.logo {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.brand-text span {
  font-size: 12px;
  color: var(--muted);
}

.status {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  background: #2ecc71;
  border-radius: 50%;
  box-shadow: 0 0 8px #2ecc71;
}

.chat-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 16px 8px;
  gap: 10px;
}

.chat {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-inline-end: 4px;
}

.chat::-webkit-scrollbar {
  width: 6px;
}
.chat::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 6px;
}

.msg {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14.5px;
  line-height: 1.7;
  animation: pop 0.18s ease-out;
  white-space: pre-line;
}

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

.msg.bot {
  align-self: flex-start;
  background: var(--bubble-bot);
  border-bottom-left-radius: 6px;
  color: var(--text);
}

.msg.user {
  align-self: flex-end;
  background: var(--bubble-user);
  border-bottom-right-radius: 6px;
  color: #fff;
}

.msg.bot::before {
  content: "🤖";
  margin-inline-end: 6px;
}

.typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  background: var(--bubble-bot);
  border-radius: var(--radius);
  border-bottom-left-radius: 6px;
}

.typing span {
  width: 7px;
  height: 7px;
  background: var(--muted);
  border-radius: 50%;
  display: inline-block;
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: rgba(108, 92, 231, 0.15);
  border: 1px solid rgba(108, 92, 231, 0.4);
  color: var(--primary-2);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.chip:hover {
  background: var(--primary);
  color: #fff;
}

.input-bar {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.06);
}

.input-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  padding: 6px 8px;
}

.input-bar input::placeholder {
  color: var(--muted);
}

.input-bar button {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease;
  transform: scaleX(-1);
}

.input-bar button:hover {
  transform: scaleX(-1) scale(1.05);
}

.foot-note {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 10px 20px 16px;
}

@media (max-width: 600px) {
  body {
    padding: 0;
  }
  .app {
    width: 100%;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }
}
