/* Claude-inspired Minimal Aesthetic */
:root {
  --bg-main: #191918;
  --bg-card: #222220;
  --bg-card-hover: #2a2926;
  --bg-input: #262522;
  --bg-thinking: #201f1c;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-focus: rgba(217, 119, 6, 0.4);

  --text-main: #ebebeb;
  --text-muted: #9e9c96;
  --text-dim: #6d6b65;

  --accent-warm: #d97706; /* Claude warm amber */
  --accent-terracotta: #c26138;
  --accent-thinking: #b45309;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.65;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 820px;
  margin: 0 auto;
  position: relative;
}

/* Navbar */
.navbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-main);
  z-index: 10;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  color: #f3f3f2;
  letter-spacing: -0.01em;
}

.icon-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-action-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

/* Chat Main Viewport */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px 32px 16px;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}

/* Empty State */
.empty-hero {
  margin: auto 0;
  text-align: center;
  padding: 40px 16px;
}

.hero-logo {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-warm);
  margin-bottom: 16px;
}

.hero-heading {
  font-size: 26px;
  font-weight: 500;
  color: #f5f5f4;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.hero-sub {
  font-size: 14px;
  color: var(--text-muted);
}

/* Conversation Thread */
.conversation {
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: 100%;
}

/* User Message */
.user-row {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.user-bubble {
  background-color: var(--bg-card);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 18px 18px 4px 18px;
  font-size: 14.5px;
  max-width: 80%;
  line-height: 1.55;
  word-break: break-word;
  border: 1px solid var(--border-subtle);
}

/* Assistant Message */
.assistant-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  animation: fadeIn 0.2s ease-out;
}

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

/* Claude-style Thinking Accordion */
.thinking-box {
  background-color: var(--bg-thinking);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 12.5px;
  margin-bottom: 4px;
}

.thinking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  color: var(--text-muted);
  transition: background 0.15s ease;
}

.thinking-header:hover {
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--text-main);
}

.thinking-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.thinking-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-warm);
}

.thinking-dot.pulsing {
  animation: pulseDot 1.4s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0.5; }
}

.thinking-title {
  font-weight: 500;
  color: var(--text-muted);
}

.thinking-chevron {
  font-size: 11px;
  transition: transform 0.2s ease;
  color: var(--text-dim);
}

.thinking-box.collapsed .thinking-chevron {
  transform: rotate(-90deg);
}

.thinking-body {
  padding: 8px 14px 12px 26px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-dim);
  font-family: var(--font-sans);
  line-height: 1.5;
}

.thinking-box.collapsed .thinking-body {
  display: none;
}

.thinking-step {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.thinking-step::before {
  content: "•";
  color: var(--text-dim);
}

.thinking-step.highlight {
  color: var(--text-muted);
}

/* Assistant Markdown Response */
.assistant-response {
  font-size: 14.5px;
  line-height: 1.7;
  color: #e3e3e0;
  word-break: break-word;
}

.assistant-response p {
  margin-bottom: 0.85em;
}

.assistant-response p:last-child {
  margin-bottom: 0;
}

.assistant-response h1,
.assistant-response h2,
.assistant-response h3,
.assistant-response h4 {
  color: #ffffff;
  font-weight: 600;
  margin-top: 1.2em;
  margin-bottom: 0.5em;
}

.assistant-response h1 { font-size: 20px; }
.assistant-response h2 { font-size: 17px; }
.assistant-response h3 { font-size: 15px; }

.assistant-response ul,
.assistant-response ol {
  margin-bottom: 0.85em;
  padding-left: 20px;
}

.assistant-response li {
  margin-bottom: 4px;
}

.assistant-response pre {
  background-color: #121212;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  margin: 1em 0;
}

.assistant-response code {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.assistant-response table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 13.5px;
}

.assistant-response th,
.assistant-response td {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.assistant-response th {
  background-color: rgba(255, 255, 255, 0.03);
  color: #f1f1ef;
}

.assistant-response a {
  color: #93c5fd;
  text-decoration: none;
}

.assistant-response a:hover {
  text-decoration: underline;
}

/* Input Region */
.input-region {
  padding: 12px 16px 20px 16px;
  background-color: var(--bg-main);
}

.input-card {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 14px 10px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}

.input-card:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

#userInput {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  resize: none;
  max-height: 160px;
}

#userInput::placeholder {
  color: var(--text-dim);
}

.input-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

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

.send-button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background-color: #ffffff;
  color: #191918;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.send-button:disabled {
  background-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
}

.send-button:not(:disabled):hover {
  transform: scale(1.06);
}

/* Mobile Tweak */
@media (max-width: 640px) {
  .chat-container {
    padding: 16px 12px;
  }
  .input-region {
    padding: 10px 12px 16px 12px;
  }
  .hero-heading {
    font-size: 22px;
  }
  .user-bubble {
    max-width: 88%;
  }
}
