/* ============================================
   QuestionAI Clone - Main Stylesheet
   Color: #3B82F6 accent, #f5f7fa sidebar
   Fonts: Inter (body), Georgia (headings)
   ============================================ */

/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --primary-light: #EFF6FF;
  --primary-dark: #1D4ED8;
  --bg: #ffffff;
  --bg-secondary: #f5f7fa;
  --bg-tertiary: #f0f2f5;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f0f0f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.03);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --sidebar-width: 260px;
  --features-width: 300px;
  --topbar-height: 56px;
  --input-area-height: 140px;
  --transition: 0.2s ease;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg);
  overflow: hidden;
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.3;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* === Layout === */
body {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  transition: transform 0.3s ease, width 0.3s ease;
  z-index: 100;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  flex-shrink: 0;
}

.logo-text {
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-close {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background var(--transition);
}
.sidebar-close:hover {
  background: var(--bg-tertiary);
}

.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 16px 8px;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  transition: background var(--transition), transform var(--transition);
}
.new-chat-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}
.new-chat-btn:active {
  transform: translateY(0);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

.nav-section-title {
  display: block;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px;
  max-height: 240px;
  overflow-y: auto;
}

.history-section {
  width: 100%;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.history-header span {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.clear-history-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-muted);
  transition: all var(--transition);
}
.clear-history-btn:hover {
  background: #FEE2E2;
  color: #EF4444;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-item {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.history-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* === Main Content === */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  position: relative;
}

.top-bar {
  display: flex;
  align-items: center;
  height: var(--topbar-height);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--transition);
  margin-right: 8px;
}
.menu-btn:hover {
  background: var(--bg-secondary);
}

.top-bar-title {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-bar-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.icon-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* === Chat Area === */
.chat-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}

/* Welcome Screen */
.welcome-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.welcome-content {
  max-width: 640px;
  text-align: center;
}

.welcome-icon {
  margin-bottom: 24px;
  opacity: 0.8;
}

.welcome-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.welcome-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 36px;
  line-height: 1.6;
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.suggestion-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  white-space: nowrap;
}
.suggestion-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Messages */
.messages-container {
  flex: 1;
  padding: 24px 0;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.message {
  padding: 16px 24px;
  animation: messageSlideIn 0.3s ease;
  position: relative;
}

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

.message-bubble {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
}

.message.user .message-avatar {
  background: var(--primary);
  color: #fff;
}

.message.assistant .message-avatar {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--primary);
}

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

.message-text {
  font-size: 15px;
  line-height: 1.7;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message.user .message-text {
  color: var(--text-primary);
}

.message.assistant .message-text {
  color: var(--text-primary);
}

.message-timestamp {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.message-actions {
  display: flex;
  gap: 2px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity var(--transition);
}
.message:hover .message-actions {
  opacity: 1;
}

.msg-action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-muted);
  transition: all var(--transition);
}
.msg-action-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* User message bubble styling */
.message.user .message-body {
  background: var(--primary);
  color: #fff;
  padding: 12px 18px;
  border-radius: 18px 18px 4px 18px;
  max-width: 75%;
  margin-left: auto;
}
.message.user .message-body .message-text {
  color: #fff;
}
.message.user .message-body .message-timestamp {
  color: rgba(255,255,255,0.6);
}
.message.user .message-body .message-actions .msg-action-btn {
  color: rgba(255,255,255,0.7);
}
.message.user .message-body .message-actions .msg-action-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* Assistant message - no bubble background, left-aligned */
.message.assistant .message-body {
  background: transparent;
  padding: 0;
}

/* Streaming cursor */
.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--primary);
  margin-left: 2px;
  animation: blink 1s infinite;
  vertical-align: text-bottom;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 0;
  align-items: center;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 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 typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Markdown Styling */
.message-text h1, .message-text h2, .message-text h3,
.message-text h4, .message-text h5, .message-text h6 {
  font-family: Georgia, serif;
  margin: 16px 0 8px 0;
  color: var(--text-primary);
}
.message-text h1 { font-size: 22px; }
.message-text h2 { font-size: 19px; }
.message-text h3 { font-size: 17px; }

.message-text p {
  margin: 0 0 10px 0;
}
.message-text p:last-child {
  margin-bottom: 0;
}

.message-text ul, .message-text ol {
  margin: 8px 0;
  padding-left: 24px;
}
.message-text li {
  margin: 4px 0;
}

.message-text strong {
  font-weight: 600;
  color: var(--text-primary);
}

.message-text em {
  font-style: italic;
  color: var(--text-secondary);
}

.message-text blockquote {
  border-left: 3px solid var(--primary);
  padding: 8px 16px;
  margin: 12px 0;
  background: var(--primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.message-text a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-color: rgba(59,130,246,0.3);
  transition: text-decoration-color var(--transition);
}
.message-text a:hover {
  text-decoration-color: var(--primary);
}

/* Inline code */
.message-text code:not(pre code) {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  color: #e11d48;
  border: 1px solid var(--border);
}

/* Code blocks */
.code-block-wrapper {
  position: relative;
  margin: 12px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fafbfc;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.copy-code-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-muted);
  transition: all var(--transition);
}
.copy-code-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}
.copy-code-btn.copied {
  color: #10B981;
}

.code-block-wrapper pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}

.code-block-wrapper code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  background: transparent;
  padding: 0;
  border: none;
  color: var(--text-primary);
}

/* KaTeX */
.message-text .katex-display {
  margin: 12px 0;
  overflow-x: auto;
  padding: 8px 0;
}

.message-text .katex {
  font-size: 1.1em;
}

/* Tables */
.message-text table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
}
.message-text th, .message-text td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.message-text th {
  background: var(--bg-tertiary);
  font-weight: 600;
}
.message-text tr:nth-child(even) {
  background: var(--bg-secondary);
}

/* Horizontal rule */
.message-text hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* Image in messages */
.message-text img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 8px 0;
}

.message-image {
  max-width: 200px;
  border-radius: var(--radius-sm);
  margin: 8px 0;
  cursor: pointer;
  transition: transform var(--transition);
}
.message-image:hover {
  transform: scale(1.02);
}

/* === Input Area === */
.input-area {
  padding: 0 24px 16px;
  background: linear-gradient(transparent, var(--bg) 20%);
  flex-shrink: 0;
}

.input-wrapper {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-md);
}
.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12), var(--shadow-md);
}

.chat-input {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  min-height: 24px;
  max-height: 160px;
  padding: 6px 8px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: transparent;
}
.chat-input::placeholder {
  color: var(--text-muted);
}

.input-actions-left,
.input-actions-right {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.input-icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition);
  position: relative;
}
.input-icon-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.send-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  transition: all var(--transition);
  opacity: 0.5;
  pointer-events: none;
}
.send-btn.active {
  opacity: 1;
  pointer-events: auto;
}
.send-btn.active:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.stop-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: #EF4444;
  color: #fff;
  transition: all var(--transition);
}
.stop-btn:hover {
  background: #DC2626;
  transform: scale(1.05);
}

.mic-btn {
  position: relative;
}

.mic-btn.recording {
  color: #EF4444;
  animation: micPulse 1.5s ease-in-out infinite;
}

.tutor-toggle { color: #6b7280; transition: all 0.2s; }
.tutor-toggle:hover { color: #3B82F6; background: #eff6ff; }
.tutor-toggle.active { color: white; background: linear-gradient(135deg, #3B82F6, #8B5CF6); }

@keyframes micPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.recording-indicator {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: #EF4444;
  border-radius: 50%;
  animation: recordingPulse 1s ease-in-out infinite;
}
.recording-indicator.active {
  display: block;
}

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

.input-footer {
  max-width: 800px;
  margin: 6px auto 0;
  text-align: center;
}

.shortcut-hint {
  font-size: 11px;
  color: var(--text-muted);
}
.shortcut-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
}

/* === Features Panel === */
.features-panel {
  width: var(--features-width);
  min-width: var(--features-width);
  height: 100vh;
  background: var(--bg);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  transition: width 0.3s ease, min-width 0.3s ease, opacity 0.3s ease;
  display: flex;
  flex-direction: column;
}
.features-panel.hidden {
  width: 0;
  min-width: 0;
  opacity: 0;
  overflow: hidden;
  border-left: none;
}

.features-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.features-panel-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.features-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.features-section-title {
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  transition: all var(--transition);
}
.quick-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.lang-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}
.lang-select:focus {
  border-color: var(--primary);
}

.writing-tools-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.writing-tool-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  text-align: left;
}
.writing-tool-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.voice-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.toggle-label input {
  display: none;
}

.toggle-switch {
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 10px;
  position: relative;
  transition: background var(--transition);
}
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle-label input:checked + .toggle-switch {
  background: var(--primary);
}
.toggle-label input:checked + .toggle-switch::after {
  transform: translateX(16px);
}

.recent-conversations {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recent-conv-item {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-conv-item:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

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

.modal-content {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 24px;
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-content h3 {
  font-size: 18px;
  margin-bottom: 16px;
}

.edit-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
}
.edit-textarea:focus {
  border-color: var(--primary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.modal-btn {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}
.modal-btn.cancel {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}
.modal-btn.cancel:hover {
  background: var(--border);
}
.modal-btn.confirm {
  color: #fff;
  background: var(--primary);
}
.modal-btn.confirm:hover {
  background: var(--primary-hover);
}

/* === Mobile Overlay === */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 90;
}

/* === Scrollbar Styling === */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* === Responsive === */
@media (max-width: 1100px) {
  .features-panel {
    display: none;
  }
  .features-panel.mobile-open {
    display: flex;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 100;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: flex;
  }

  .mobile-overlay.active {
    display: block;
  }

  .menu-btn {
    display: flex;
  }

  .main-content {
    width: 100%;
  }

  .message {
    padding: 12px 16px;
  }

  .input-area {
    padding: 0 12px 12px;
  }

  .welcome-title {
    font-size: 24px;
  }

  .suggestion-chips {
    flex-direction: column;
    align-items: center;
  }
  .suggestion-chip {
    width: 100%;
    max-width: 320px;
    justify-content: center;
  }

  .top-bar-title {
    font-size: 14px;
  }

  .features-panel.mobile-open {
    width: 100%;
    min-width: 100%;
  }
}

@media (max-width: 480px) {
  .message.user .message-body {
    max-width: 85%;
  }

  .welcome-content {
    padding: 0 8px;
  }

  .input-wrapper {
    padding: 6px 8px;
  }
}

/* === Print === */
@media print {
  .sidebar, .features-panel, .top-bar, .input-area {
    display: none !important;
  }
  .main-content {
    width: 100% !important;
  }
  .message {
    page-break-inside: avoid;
  }
}
