:root {
  --bg: var(--thm-main-bg, #111022);
  --surface: #17172e;
  --surface-alt: #1f2140;
  --text: #e9ecf5;
  --muted: #a1aac9;
  --primary: var(--thm-base, #ff6c1e);
  --primary-strong: #d95c18;
  --border: rgba(255, 255, 255, 0.06);
  --shadow: 0 18px 48px rgba(4, 7, 30, 0.55);
}

[data-theme="light"] {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-alt: #eef1f5;
  --text: #1d2433;
  --muted: #6b7280;
  --primary: var(--thm-base, #ff6c1e);
  --primary-strong: #d95c18;
  --border: #e5e7eb;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Sora", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.chat-ai-page {
  background: radial-gradient(circle at 10% 20%, rgba(255, 108, 30, 0.06), transparent 25%),
    radial-gradient(circle at 80% 0%, rgba(143, 121, 255, 0.08), transparent 25%),
    linear-gradient(135deg, #0f1126 0%, #0b0f1d 45%, #111022 100%);
}

.chat-ai-section {
  padding: 60px 0 90px;
  position: relative;
  overflow: hidden;
}

.chat-ai-section::before,
.chat-ai-section::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
  z-index: 0;
}

.chat-ai-section::before {
  width: 260px;
  height: 260px;
  background: rgba(255, 108, 30, 0.12);
  top: -80px;
  left: -60px;
}

.chat-ai-section::after {
  width: 320px;
  height: 320px;
  background: rgba(66, 107, 255, 0.12);
  bottom: -120px;
  right: -80px;
}

.chat-shell {
  position: relative;
  z-index: 1;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(12px);
}

.chat-shell__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 6px 20px;
  color: var(--muted);
  font-size: 14px;
}

.chat-shell__meta {
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge {
  background: var(--primary);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 12px 24px rgba(255, 108, 30, 0.35);
}


.app {
  display: flex;
  flex-direction: column;
  min-height: 640px;
  background: radial-gradient(circle at 20% 20%, rgba(255, 108, 30, 0.08), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(64, 94, 255, 0.12), transparent 30%),
    var(--surface);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  max-width: 1040px;
  margin: 0 auto;
}

.sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(255, 108, 30, 0.35);
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.primary,
.ghost {
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.05s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  border-color: var(--primary);
  padding: 12px 14px;
  box-shadow: 0 12px 28px rgba(255, 108, 30, 0.35);
}

.primary:hover {
  background: var(--primary-strong);
  transform: translateY(-1px);
}

.ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-color: var(--border);
  padding: 10px 12px;
}

.ghost:hover {
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.section-title {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--muted);
}

.chat-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-list li {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text);
  transition: background 0.2s ease, border 0.2s ease, transform 0.08s ease;
}

.chat-list li:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(2px);
}

.chat-list li.active {
  border-color: var(--primary);
  background: rgba(255, 108, 30, 0.12);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  cursor: pointer;
  color: var(--text);
}

.toggle input {
  display: none;
}

.toggle .control {
  width: 46px;
  height: 26px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 13px;
  position: relative;
  transition: background 0.2s ease;
}

.toggle .control::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 6px 16px rgba(255, 108, 30, 0.35);
}

.toggle input:checked + .control::after {
  transform: translateX(20px);
}

.toggle .label {
  color: var(--text);
}

.chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0) 100%);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  position: sticky;
  top: 0;
  z-index: 10;
}

.chat-title {
  font-size: 20px;
  font-weight: 700;
  font-family: "Sora", sans-serif;
}

.chat-subtitle {
  color: var(--muted);
  margin-top: 4px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.online {
  background: #10b981;
  box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.2);
}

.message-history {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: flex-start;
}

.message .avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  place-items: center;
  font-size: 20px;
  border: 1px solid var(--border);
}

.message .bubble {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.message .bubble header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.message .name {
  font-weight: 700;
}

.message .timestamp {
  color: var(--muted);
  font-size: 12px;
}

.message.bot .bubble {
  background: linear-gradient(135deg, rgba(255, 108, 30, 0.08), rgba(255, 255, 255, 0.02));
}

.message.user .bubble {
  border-color: rgba(255, 108, 30, 0.35);
}

.composer {
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.composer-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

#message-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#message-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  resize: vertical;
  min-height: 70px;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

#message-input:focus {
  outline: 2px solid var(--primary);
  background: rgba(255, 255, 255, 0.06);
}

.composer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hint {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 960px) {
  .app {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .chat-header,
  .composer {
    padding: 12px;
  }

  .message {
    grid-template-columns: 32px 1fr;
  }
}
