/* Duhovnicul AI — Premium Monastic Theme v2 */
/* Fixed media queries + premium redesign */

:root {
  /* Premium Color Palette */
  --bg-primary: #08090c;
  --bg-secondary: #0e1117;
  --bg-tertiary: #161b26;
  --bg-elevated: #1c2333;
  
  --accent-gold: #c9a84c;
  --accent-gold-rgb: 201, 168, 76;
  --accent-gold-hover: #dabb62;
  --accent-gold-light: rgba(201, 168, 76, 0.06);
  --accent-gold-glow: rgba(201, 168, 76, 0.12);
  
  --accent-warm: #a67c52;
  --accent-warm-rgb: 166, 124, 82;
  
  --text-primary: #eef0f4;
  --text-secondary: #8e99ab;
  --text-muted: #4f5b6e;
  --text-gold: #d4b85c;
  
  --border-subtle: rgba(201, 168, 76, 0.08);
  --border-medium: rgba(201, 168, 76, 0.15);
  --border-strong: rgba(201, 168, 76, 0.3);
  
  --bubble-user: linear-gradient(135deg, #1a2236 0%, #1e2740 100%);
  --bubble-ai: linear-gradient(135deg, #0f1420 0%, #141b28 100%);
  
  --glass-bg: rgba(14, 17, 23, 0.75);
  --glass-border: rgba(201, 168, 76, 0.1);
  
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-gold: 0 4px 20px rgba(201, 168, 76, 0.15);
  
  --transition-smooth: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  
  --sidebar-width: 300px;
  --header-height: 68px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

h1, h2, h3, h4, .brand-text h2, .chat-title {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* Premium Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(201, 168, 76, 0.12);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(201, 168, 76, 0.25);
}

/* ═══════════════════════════════════════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  transition: var(--transition-smooth);
  z-index: 100;
  position: relative;
}

/* Subtle sidebar top glow */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(180deg, rgba(var(--accent-gold-rgb), 0.04) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

.sidebar-header {
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 1;
}

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

.cross-icon {
  background: radial-gradient(circle, rgba(var(--accent-gold-rgb), 0.15) 0%, transparent 70%);
  border: 1px solid rgba(var(--accent-gold-rgb), 0.35);
  color: var(--accent-gold);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1rem;
  box-shadow: 0 0 16px rgba(var(--accent-gold-rgb), 0.1);
  flex-shrink: 0;
}

.brand-text h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.brand-text span {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
}

/* Buttons */
.btn {
  font-family: 'Outfit', sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
  font-size: 0.87rem;
  letter-spacing: 0.01em;
}

.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #b8943a 100%);
  color: #0a0c10;
  box-shadow: var(--shadow-gold);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-gold-hover) 0%, var(--accent-gold) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(var(--accent-gold-rgb), 0.25);
}

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

/* Sessions Section */
.sessions-section {
  flex: 1;
  padding: 16px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.sessions-section h3 {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0 4px;
  margin-bottom: 2px;
}

.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sessions-loading {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.text-danger {
  color: #ef4444 !important;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background-color: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
}

.session-item:hover {
  background-color: rgba(var(--accent-gold-rgb), 0.04);
  border-color: rgba(var(--accent-gold-rgb), 0.1);
}

.session-item.active {
  background-color: rgba(var(--accent-gold-rgb), 0.07);
  border-color: rgba(var(--accent-gold-rgb), 0.2);
}

.session-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  flex: 1;
}

.session-info i {
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.session-item.active .session-info i {
  color: var(--accent-gold);
}

.session-details {
  overflow: hidden;
  text-align: left;
}

.session-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.session-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: var(--transition-fast);
  opacity: 0;
  font-size: 0.8rem;
}

.session-item:hover .session-delete-btn {
  opacity: 0.6;
}

.session-delete-btn:hover {
  opacity: 1 !important;
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.08);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

.footer-layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.online {
  background-color: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 4px rgba(52, 211, 153, 0.3); }
  50% { box-shadow: 0 0 10px rgba(52, 211, 153, 0.6); }
}

.settings-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-btn:hover {
  color: var(--accent-gold);
  background-color: rgba(var(--accent-gold-rgb), 0.06);
  transform: rotate(45deg);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHAT AREA
   ═══════════════════════════════════════════════════════════════════════════ */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

/* Subtle ambient background glow */
.chat-area::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(var(--accent-gold-rgb), 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Header */
.chat-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  position: relative;
}

.sidebar-toggle-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.15rem;
  cursor: pointer;
  margin-right: 14px;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.sidebar-toggle-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.active-chat-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-container {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Subtle halo around avatar */
.avatar-container::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid rgba(var(--accent-gold-rgb), 0.08);
}

.duhovnic-avatar {
  color: var(--accent-gold);
  font-size: 1.1rem;
}

.chat-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chat-subtitle {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 1px;
}

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

.header-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.header-action-btn:hover {
  color: var(--text-secondary);
  background-color: rgba(255, 255, 255, 0.04);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SAFETY BANNER
   ═══════════════════════════════════════════════════════════════════════════ */
.safety-banner {
  background: linear-gradient(90deg, rgba(var(--accent-gold-rgb), 0.04) 0%, rgba(var(--accent-gold-rgb), 0.02) 100%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary);
  position: relative;
  z-index: 5;
}

.safety-banner strong {
  color: var(--accent-gold);
}

.safety-icon {
  color: var(--accent-gold);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.safety-text {
  flex: 1;
}

.safety-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  transition: var(--transition-fast);
  font-size: 0.85rem;
}

.safety-close-btn:hover {
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MESSAGES CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */
.messages-container {
  flex: 1;
  padding: 24px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   WELCOME SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
.welcome-container {
  max-width: 560px;
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 20px;
}

.welcome-logo {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--accent-gold);
  background: radial-gradient(circle, rgba(var(--accent-gold-rgb), 0.08) 0%, var(--bg-secondary) 70%);
  box-shadow: 0 0 30px rgba(var(--accent-gold-rgb), 0.08), var(--shadow-md);
  position: relative;
}

/* Animated halo ring */
.welcome-logo::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(var(--accent-gold-rgb), 0.1);
  animation: halo-breathe 4s ease-in-out infinite;
}

@keyframes halo-breathe {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

.welcome-container h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: 'Playfair Display', serif;
  letter-spacing: -0.01em;
}

.welcome-container > p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 440px;
}

.welcome-suggestions {
  margin-top: 32px;
  width: 100%;
  text-align: left;
}

.welcome-suggestions h3 {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 700;
  padding-left: 2px;
}

.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
}

.suggestion-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-secondary);
  position: relative;
  overflow: hidden;
}

/* Subtle shine effect on hover */
.suggestion-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(var(--accent-gold-rgb), 0.03) 50%, transparent 100%);
  transition: left 0.6s ease;
}

.suggestion-card:hover::before {
  left: 100%;
}

.suggestion-card i {
  color: var(--accent-gold);
  font-size: 1rem;
  opacity: 0.8;
}

.suggestion-card span {
  font-size: 0.83rem;
  line-height: 1.4;
  font-weight: 500;
}

.suggestion-card:hover {
  border-color: var(--border-medium);
  background: var(--bg-tertiary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
}

.suggestion-card:hover i {
  opacity: 1;
}

.suggestion-card:active {
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHAT BUBBLES
   ═══════════════════════════════════════════════════════════════════════════ */
.message-wrapper {
  display: flex;
  width: 100%;
  gap: 12px;
  max-width: 760px;
  margin: 0 auto;
  animation: none;
}

.message-wrapper.fade-in {
  animation: msg-fade-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes msg-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-wrapper.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.8rem;
  margin-top: 4px;
}

.message-wrapper.user .message-avatar {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #b8943a 100%);
  color: #0a0c10;
  border: none;
  box-shadow: var(--shadow-xs);
}

.message-wrapper.assistant .message-avatar {
  background: var(--bg-tertiary);
  color: var(--accent-gold);
  border: 1px solid var(--border-subtle);
}

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  max-width: calc(100% - 56px);
  line-height: 1.65;
  font-size: 0.9rem;
  position: relative;
  word-break: break-word;
}

.message-wrapper.user .message-bubble {
  background: var(--bubble-user);
  color: var(--text-primary);
  border-bottom-right-radius: 4px;
  box-shadow: var(--shadow-xs);
}

.message-wrapper.assistant .message-bubble {
  background: var(--bubble-ai);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
}

.message-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
  opacity: 0.7;
}

/* Citation Tags */
.citation-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(var(--accent-gold-rgb), 0.08);
  border: 1px solid rgba(var(--accent-gold-rgb), 0.2);
  color: var(--accent-gold);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin: 2px 4px;
  cursor: pointer;
  transition: var(--transition-fast);
  vertical-align: middle;
}

.citation-tag:hover {
  background: rgba(var(--accent-gold-rgb), 0.15);
  border-color: rgba(var(--accent-gold-rgb), 0.4);
  box-shadow: 0 0 8px rgba(var(--accent-gold-rgb), 0.1);
}

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

.typing-indicator span {
  width: 6px;
  height: 6px;
  background-color: var(--text-muted);
  border-radius: 50%;
  display: inline-block;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   REFERENCES PANEL
   ═══════════════════════════════════════════════════════════════════════════ */
.references-panel {
  position: absolute;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 760px;
  background: var(--bg-secondary);
  border: 1px solid rgba(var(--accent-gold-rgb), 0.3);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(var(--accent-gold-rgb), 0.05);
  z-index: 100;
  display: flex;
  flex-direction: column;
  max-height: 260px;
  transition: var(--transition-smooth);
}

.references-panel.hidden {
  opacity: 0;
  transform: translate(-50%, 16px) scale(0.97);
  pointer-events: none;
}

.references-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.references-header h4 {
  font-size: 0.85rem;
  color: var(--accent-gold);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

#close-references-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition-fast);
  padding: 4px;
}

#close-references-btn:hover {
  color: var(--text-primary);
}

.references-content {
  padding: 14px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reference-card {
  background: rgba(255, 255, 255, 0.015);
  border-left: 2px solid var(--accent-gold);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.reference-title {
  font-weight: 600;
  color: var(--accent-gold);
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.reference-text {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-secondary);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHAT INPUT AREA
   ═══════════════════════════════════════════════════════════════════════════ */
.chat-input-container {
  padding: 14px 24px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 10;
}

/* RAG Source Filter Bar */
.rag-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.filter-buttons {
  display: flex;
  gap: 6px;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  letter-spacing: 0.02em;
}

.filter-btn:hover {
  background: rgba(var(--accent-gold-rgb), 0.04);
  border-color: rgba(var(--accent-gold-rgb), 0.2);
  color: var(--text-secondary);
}

.filter-btn.active {
  background: rgba(var(--accent-gold-rgb), 0.1);
  border-color: rgba(var(--accent-gold-rgb), 0.4);
  color: var(--accent-gold);
}

/* Chat Form */
.chat-form {
  display: flex;
  align-items: flex-end;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 8px 6px 14px;
  transition: var(--transition-smooth);
  gap: 8px;
}

.chat-form:focus-within {
  border-color: rgba(var(--accent-gold-rgb), 0.4);
  box-shadow: 0 0 16px rgba(var(--accent-gold-rgb), 0.06);
}

.chat-form textarea {
  flex: 1;
  background: none;
  border: none;
  resize: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  max-height: 120px;
  padding: 8px 4px;
  overflow-y: auto;
}

.chat-form textarea::placeholder {
  color: var(--text-muted);
}

.send-btn {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #b8943a 100%);
  color: #0a0c10;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  flex-shrink: 0;
  margin-bottom: 2px;
  box-shadow: var(--shadow-xs);
  font-size: 0.85rem;
}

.send-btn:hover {
  background: linear-gradient(135deg, var(--accent-gold-hover) 0%, var(--accent-gold) 100%);
  transform: scale(1.05);
  box-shadow: var(--shadow-gold);
}

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

.send-btn:disabled {
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SETTINGS MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.modal-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  width: 90%;
  max-width: 480px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(1);
  transition: var(--transition-bounce);
}

.modal-backdrop.hidden .modal-card {
  transform: scale(0.92);
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.05rem;
  color: var(--text-primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h3 i {
  color: var(--accent-gold);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.08);
}

.modal-body {
  padding: 22px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.form-group input {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition-fast);
}

.form-group input:focus {
  border-color: rgba(var(--accent-gold-rgb), 0.4);
  box-shadow: 0 0 8px rgba(var(--accent-gold-rgb), 0.1);
}

.form-help {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(0, 0, 0, 0.1);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  .sidebar {
    position: absolute;
    left: calc(-1 * var(--sidebar-width));
    top: 0;
    bottom: 0;
    box-shadow: none;
  }
  
  .sidebar.open {
    left: 0;
    box-shadow: var(--shadow-lg);
  }
  
  .sidebar-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .suggestions-grid {
    grid-template-columns: 1fr;
  }

  .welcome-container {
    padding: 20px 16px;
  }

  .welcome-container h2 {
    font-size: 1.4rem;
  }
  
  .messages-container {
    padding: 16px;
  }
  
  .chat-input-container {
    padding: 12px 16px 14px;
  }

  .chat-header {
    padding: 0 16px;
  }

  .message-wrapper {
    gap: 8px;
  }

  .message-bubble {
    max-width: calc(100% - 46px);
    padding: 10px 14px;
    font-size: 0.87rem;
  }

  .rag-filter-bar {
    overflow-x: auto;
  }

  .references-panel {
    width: 95%;
    bottom: 120px;
  }
}

@media (max-width: 480px) {
  .welcome-container h2 {
    font-size: 1.25rem;
  }

  .avatar-container {
    width: 36px;
    height: 36px;
  }

  .chat-title {
    font-size: 0.95rem;
  }

  .filter-label {
    display: none;
  }
}
