@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0f1115;
  --panel: #0e1016;
  --panel-2: #181b24;
  --panel-3: #212530;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #f0f2f5;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #ff6a00;
  --accent-hover: #ff7d1a;
  --accent-glow: rgba(255, 106, 0, 0.25);
  --accent-2: #fbbf24;
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.25);
  --success: #22c55e;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body,
html {
  min-height: 100%;
  width: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 106, 0, 0.12), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(251, 191, 36, 0.08), transparent 35%),
    linear-gradient(145deg, #090b0f 0%, #141821 50%, #0b0d12 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Container ─── */
.chat-container {
  width: min(1200px, 100%);
  height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ─── Header ─── */
.chat-header {
  background: linear-gradient(90deg, #12151c 0%, #1a1f2b 100%);
  padding: 16px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  gap: 14px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.header-avatar {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.header-info {
  min-width: 0;
}

.header-info h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.header-info .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  font-weight: 400;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── Buttons ─── */
.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 16px;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  line-height: 1;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  transform: translateY(-1px);
}

.btn-icon:active {
  transform: translateY(0);
}

/* ─── Chat Content ─── */
.chat-content {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 15%),
    radial-gradient(circle at 100% 0%, rgba(255, 106, 0, 0.03), transparent 30%),
    var(--panel-2);
  scroll-behavior: smooth;
}

.chat-content::-webkit-scrollbar {
  width: 5px;
}

.chat-content::-webkit-scrollbar-track {
  background: transparent;
}

.chat-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

.chat-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ─── Welcome / Intro ─── */
.intro {
  max-width: 700px;
  margin: 20px auto;
  text-align: center;
  padding: 40px 20px;
}

.intro-icon {
  font-size: 56px;
  margin-bottom: 18px;
  filter: drop-shadow(0 8px 24px rgba(255, 106, 0, 0.3));
}

.intro h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.intro p {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 15px;
  max-width: 520px;
  margin: 0 auto 20px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  padding: 9px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  user-select: none;
}

.chip:hover {
  background: rgba(255, 106, 0, 0.12);
  border-color: var(--accent);
}

/* ─── Messages ─── */
.message {
  margin-bottom: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  max-width: 78%;
  word-wrap: break-word;
  line-height: 1.6;
  font-size: 15px;
  opacity: 0;
  animation: msgIn 0.35s ease forwards;
  position: relative;
}

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

.user-message {
  background: linear-gradient(135deg, var(--accent), #ff8a1f);
  margin-left: auto;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bot-message {
  background: rgba(255, 255, 255, 0.04);
  margin-right: auto;
  color: var(--text);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.bot-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.bot-content {
  min-width: 0;
  flex: 1;
}

.bot-content ul,
.bot-content ol {
  margin: 6px 0;
  padding-left: 22px;
}

.bot-content li {
  margin: 4px 0;
}

.bot-content strong {
  color: var(--accent-2);
}

.bot-content a {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.bot-content a:hover {
  color: var(--accent);
}

.message-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  display: block;
}

.user-message .message-time {
  color: rgba(255, 255, 255, 0.6);
  text-align: right;
}

.bot-message .message-time {
  text-align: left;
  padding-left: 44px;
}

/* ─── Error message ─── */
.message-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #fca5a5;
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.message-error .bot-avatar {
  background: var(--danger);
}

/* ─── Typing Indicator ─── */
.typing-indicator {
  display: none;
  margin-bottom: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  max-width: 80px;
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.typing-indicator.active {
  display: flex;
  gap: 5px;
  animation: msgIn 0.3s ease forwards;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: dotBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* ─── Quick replies ─── */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 14px 6px;
  animation: msgIn 0.3s ease forwards;
}

.quick-chip {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid rgba(255, 106, 0, 0.3);
  background: rgba(255, 106, 0, 0.07);
  color: var(--accent-2);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  user-select: none;
}

.quick-chip:hover {
  background: rgba(255, 106, 0, 0.15);
  border-color: var(--accent);
}

/* ─── Footer / Input ─── */
.chat-footer {
  display: flex;
  padding: 14px 18px;
  background: rgba(10, 12, 17, 0.95);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  gap: 10px;
  align-items: center;
}

.input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0 6px 0 16px;
  transition: border-color var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--accent);
}

.input-wrapper input[type="text"] {
  flex: 1;
  padding: 13px 8px 13px 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

.input-wrapper input[type="text"]::placeholder {
  color: var(--text-muted);
}

.btn-send {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #111827;
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform var(--transition), filter var(--transition);
  flex-shrink: 0;
}

.btn-send:hover {
  transform: scale(1.05);
  filter: brightness(1.08);
}

.btn-send:active {
  transform: scale(0.95);
}

.btn-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

/* ─── Modal ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-box {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-box h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.modal-box p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 22px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-modal {
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform var(--transition), filter var(--transition);
}

.btn-modal:hover {
  transform: translateY(-1px);
}

.btn-modal:active {
  transform: translateY(0);
}

.btn-modal.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #111827;
}

.btn-modal.secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--text);
}

/* ─── Responsive ─── */
@media (max-width: 720px) {
  body,
  html {
    padding: 0;
  }

  .chat-container {
    height: 100vh;
    border-radius: 0;
    border: none;
  }

  .chat-header {
    padding: 12px 14px;
  }

  .header-avatar {
    width: 38px;
    height: 38px;
  }

  .header-info h1 {
    font-size: 17px;
  }

  .message {
    max-width: 92%;
    font-size: 14px;
    padding: 12px 14px;
  }

  .bot-message {
    gap: 10px;
  }

  .bot-avatar {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .chat-footer {
    padding: 10px 12px;
  }

  .input-wrapper input[type="text"] {
    font-size: 16px;
  }

  .intro {
    padding: 24px 16px;
  }

  .intro-icon {
    font-size: 44px;
  }

  .intro h2 {
    font-size: 22px;
  }
}
