:root {
  --bg-gradient: radial-gradient(circle at top left, #2dd4bf 0, #0f172a 38%, #020617 75%);
  --glass-bg: rgba(15, 23, 42, 0.72);
  --glass-border: rgba(148, 163, 184, 0.35);
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.18);
  --accent-strong: rgba(34, 197, 94, 0.24);
  --accent-2: #22d3ee;
  --text-main: #e5e7eb;
  --text-soft: #9ca3af;
  --danger: #f97373;
  --shadow-soft: 0 22px 60px rgba(15, 23, 42, 0.75);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --border-width: 1px;
  --chat-user: #1f2937;
  --chat-assistant: #0b1120;
  --chat-system: #111827;
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif;
  --transition-fast: 150ms ease-out;
  --transition-med: 220ms ease-out;
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #020617;
  color: var(--text-main);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(circle at 0% 0%, rgba(34, 197, 94, 0.12), transparent 55%),
    radial-gradient(circle at 100% 0%, rgba(34, 211, 238, 0.18), transparent 52%),
    radial-gradient(circle at 50% 100%, rgba(56, 189, 248, 0.12), transparent 50%),
    linear-gradient(135deg, #020617, #020617);
  color: var(--text-main);
}

.app-root {
  min-height: 100vh;
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 14px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Glass utility */

.glass {
  background: var(--glass-bg);
  border-radius: 24px;
  border: var(--border-width) solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px) saturate(130%);
}

/* Header */

.app-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 18px;
  background: radial-gradient(circle at 0 0, #22c55e, #16a34a 45%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 30px rgba(16, 185, 129, 0.45);
}

.brand-logo-mark {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.04em;
  color: #ecfdf5;
}

.brand-text h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.04em;
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-soft);
}

/* Weather badge */

.weather-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
  border-radius: 999px;
  background: radial-gradient(circle at 0 0, rgba(34, 197, 94, 0.22), rgba(15, 23, 42, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.5);
  font-size: 12px;
}

.weather-main {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 9px;
  border-right: 1px solid rgba(148, 163, 184, 0.6);
}

.weather-icon {
  font-size: 18px;
}

.weather-temp {
  font-weight: 600;
}

.weather-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.weather-label {
  color: var(--text-soft);
}

/* Layout */

.app-main {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(260px, 1.2fr);
  gap: 16px;
  align-items: flex-start;
}

/* Chat section */

.chat-section {
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  min-height: min(640px, 78vh);
  max-height: 78vh;
}

.chat-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.chat-section h2 {
  margin: 0;
  font-size: 17px;
}

.chat-subtitle {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--text-soft);
}

.chat-window {
  flex: 1;
  min-height: 0;
  border-radius: 18px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 0.98), rgba(3, 7, 18, 0.96));
  padding: 10px 10px 12px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* Scrollbar */

.chat-window::-webkit-scrollbar {
  width: 7px;
}
.chat-window::-webkit-scrollbar-track {
  background: transparent;
}
.chat-window::-webkit-scrollbar-thumb {
  background: rgba(55, 65, 81, 0.9);
  border-radius: 999px;
}

/* Message bubbles */

.message-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 8px;
}

.message-row.assistant {
  animation: fadeInUp var(--transition-med);
}

.message-avatar {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  background: radial-gradient(circle at 0 0, #22c55e, #16a34a 60%, #0f172a 100%);
  color: #ecfdf5;
}

.message-avatar.user {
  background: radial-gradient(circle at 0 0, #22d3ee, #0ea5e9 60%, #0f172a 100%);
}

.message-bubble {
  max-width: 100%;
  padding: 9px 11px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.45;
  border: 1px solid rgba(31, 41, 55, 0.9);
  position: relative;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message-row.user .message-bubble {
  background: radial-gradient(circle at 0 0, rgba(34, 211, 238, 0.16), var(--chat-user));
}

.message-row.assistant .message-bubble {
  background: radial-gradient(circle at 0 0, rgba(34, 197, 94, 0.14), var(--chat-assistant));
}

.message-row.system .message-bubble {
  font-size: 12px;
  color: var(--text-soft);
  background: rgba(15, 23, 42, 0.94);
  border-style: dashed;
}

.message-meta {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-soft);
}

/* Thinking state */

.thinking-dots {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}

.thinking-dots span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(209, 213, 219, 0.9);
  animation: bounce 850ms infinite;
}

.thinking-dots span:nth-child(2) {
  animation-delay: 120ms;
}
.thinking-dots span:nth-child(3) {
  animation-delay: 260ms;
}

/* Input */

.chat-input-container {
  margin-top: 10px;
  border-radius: 18px;
  border: 1px solid rgba(55, 65, 81, 0.85);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(3, 7, 18, 0.98));
  padding: 7px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-input {
  width: 100%;
  resize: none;
  border: none;
  outline: none;
  padding: 6px 6px;
  background: transparent;
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
}

.chat-input::placeholder {
  color: rgba(148, 163, 184, 0.8);
}

.chat-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-hint {
  font-size: 11px;
  color: var(--text-soft);
}

/* Buttons */

.primary-btn,
.ghost-btn,
.chip {
  font-family: inherit;
  font-size: 12px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.primary-btn {
  padding: 6px 16px;
  background: radial-gradient(circle at 0 0, #22c55e, #15803d 55%, #0f172a 100%);
  color: #ecfdf5;
  font-weight: 600;
  border: 1px solid rgba(34, 197, 94, 0.9);
  box-shadow: 0 12px 25px rgba(16, 185, 129, 0.55);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 35px rgba(16, 185, 129, 0.65);
}

.primary-btn:active {
  transform: translateY(0);
  box-shadow: 0 10px 22px rgba(16, 185, 129, 0.48);
}

.ghost-btn {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.7);
  color: var(--text-soft);
}

.ghost-btn:hover {
  background: rgba(30, 64, 175, 0.6);
  color: #e5e7eb;
}

/* Side panel */

.side-panel {
  padding: 14px 14px 12px;
  min-height: min(640px, 78vh);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-panel h3 {
  margin: 0;
  font-size: 15px;
}

.side-subtitle {
  margin: 4px 0 4px;
  font-size: 12px;
  color: var(--text-soft);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  padding: 6px 10px;
  background: radial-gradient(circle at 0 0, rgba(34, 211, 238, 0.24), rgba(15, 23, 42, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.7);
  color: #e5e7eb;
  text-align: left;
}

.chip:hover {
  background: radial-gradient(circle at 0 0, rgba(34, 197, 94, 0.3), rgba(15, 23, 42, 0.96));
  border-color: rgba(34, 197, 94, 0.9);
}

.side-tip {
  margin-top: auto;
  padding: 10px 10px;
  border-radius: 16px;
  background: radial-gradient(circle at 0 0, rgba(34, 197, 94, 0.18), rgba(15, 23, 42, 0.96));
  border: 1px dashed rgba(148, 163, 184, 0.7);
  font-size: 12px;
  color: var(--text-soft);
}

.side-tip h4 {
  margin: 0 0 5px;
  font-size: 13px;
  color: #e5e7eb;
}

/* Footer */

.app-footer {
  font-size: 11px;
  color: var(--text-soft);
  text-align: center;
  padding: 2px 4px 0;
}

/* States */

.error-text {
  color: var(--danger);
  font-size: 12px;
}

/* Animations */

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

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

/* Responsive */

@media (max-width: 880px) {
  .app-root {
    max-width: 100%;
    padding: 12px 10px 16px;
  }

  .app-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .side-panel {
    order: -1;
    min-height: auto;
    max-height: none;
  }

  .chat-section {
    max-height: calc(100vh - 260px);
  }
}

@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
  }

  .weather-badge {
    align-self: flex-start;
  }

  .chat-window {
    max-height: calc(100vh - 330px);
  }
}

@media (max-width: 420px) {
  .brand-text h1 {
    font-size: 18px;
  }

  .brand-text p {
    font-size: 12px;
  }

  .weather-badge {
    width: 100%;
    justify-content: space-between;
  }
}
