/* =============================================================================
   Tunisian Legal AI Assistant - Stylesheet
   Professional dark theme with Tunisian red (#C8102E) accent
   Full RTL support for Arabic
   ============================================================================= */

/* ---------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   --------------------------------------------------------------------------- */
:root {
  /* Colors — Tunisian palette */
  --color-primary: #c8102e;
  --color-primary-light: #e8334a;
  --color-primary-dark: #9e0c24;
  --color-primary-glow: rgba(200, 16, 46, 0.25);

  /* Neutrals */
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-tertiary: #242836;
  --bg-elevated: #2a2f3e;
  --bg-hover: #323848;

  --text-primary: #f0f2f5;
  --text-secondary: #a0a8b8;
  --text-muted: #6b7280;

  --border-color: #2d3348;
  --border-light: rgba(255, 255, 255, 0.06);

  /* Message colors */
  --msg-user-bg: #c8102e;
  --msg-user-text: #ffffff;
  --msg-assistant-bg: #1e2230;
  --msg-assistant-text: #f0f2f5;

  /* Glassmorphism */
  --glass-bg: rgba(26, 29, 39, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: 16px;

  /* Spacing */
  --sidebar-width: 300px;

  /* Typography */
  --font-main: "Inter", "Noto Sans Arabic", system-ui, sans-serif;
  --font-arabic: "Noto Sans Arabic", "Inter", system-ui, sans-serif;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-smooth: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--color-primary-glow);

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* RTL support */
[dir="rtl"] body {
  font-family: var(--font-arabic);
}

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

/* ---------------------------------------------------------------------------
   Sidebar
   --------------------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-smooth);
  z-index: 100;
}

[dir="rtl"] .sidebar {
  border-right: none;
  border-left: 1px solid var(--border-color);
}

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

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

.logo-icon {
  font-size: 28px;
  line-height: 1;
}

.logo-text h1 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.logo-subtitle {
  font-size: 11px;
  color: var(--color-primary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-close {
  display: none;
}

/* New Chat button */
.btn-new-chat {
  margin: 16px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-normal);
}

.btn-icon-left {
  font-size: 18px;
  font-weight: 300;
}

/* Sidebar sections */
.sidebar-section {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 12px 8px;
}

/* Conversation list */
.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conversation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  group: true;
}

.conversation-item:hover {
  background: var(--bg-hover);
}

.conversation-item.active {
  background: var(--bg-elevated);
  border-left: 3px solid var(--color-primary);
}

[dir="rtl"] .conversation-item.active {
  border-left: none;
  border-right: 3px solid var(--color-primary);
}

.conversation-item-title {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.conversation-item.active .conversation-item-title {
  color: var(--text-primary);
}

.conversation-item-delete {
  opacity: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.conversation-item:hover .conversation-item-delete {
  opacity: 1;
}

.conversation-item-delete:hover {
  color: var(--color-primary);
  background: rgba(200, 16, 46, 0.15);
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-sidebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-family: inherit;
}

.btn-sidebar:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Language selector */
.language-selector {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.lang-btn {
  flex: 1;
  padding: 6px 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--transition-fast);
  font-family: inherit;
}

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

.lang-btn.active {
  background: var(--color-primary);
  color: white;
}

/* ---------------------------------------------------------------------------
   Main Content
   --------------------------------------------------------------------------- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  gap: 12px;
  z-index: 10;
}

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

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

/* ---------------------------------------------------------------------------
   Chat Area
   --------------------------------------------------------------------------- */
.chat-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0;
}

/* Welcome screen */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px 24px;
  text-align: center;
  animation: fadeIn 0.5s ease;
}

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

.welcome-icon {
  font-size: 56px;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px rgba(200, 16, 46, 0.3));
}

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

.welcome-message {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 500px;
  line-height: 1.6;
  margin-bottom: 32px;
}

/* Example questions */
.example-questions h3 {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-weight: 500;
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 560px;
  margin-bottom: 32px;
}

.example-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-align: start;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
}

.example-card:hover {
  background: var(--bg-elevated);
  border-color: var(--color-primary);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.example-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.example-text {
  line-height: 1.4;
}

/* Disclaimer */
.disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 500px;
  padding: 12px 16px;
  background: rgba(200, 16, 46, 0.08);
  border: 1px solid rgba(200, 16, 46, 0.15);
  border-radius: var(--radius-md);
  line-height: 1.5;
}

/* ---------------------------------------------------------------------------
   Messages
   --------------------------------------------------------------------------- */
.messages-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  max-width: 850px;
  width: 100%;
  margin: 0 auto;
}

.message {
  display: flex;
  gap: 12px;
  animation: messageSlide 0.3s ease;
  max-width: 85%;
}

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

.message-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

[dir="rtl"] .message-user {
  flex-direction: row;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

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

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

.message-content {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  line-height: 1.6;
  font-size: 14px;
}

.message-user .message-content {
  background: var(--msg-user-bg);
  color: var(--msg-user-text);
  border-bottom-right-radius: var(--radius-sm);
}

[dir="rtl"] .message-user .message-content {
  border-bottom-right-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-sm);
}

.message-assistant .message-content {
  background: var(--msg-assistant-bg);
  color: var(--msg-assistant-text);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: var(--radius-sm);
  position: relative; /* For copy button positioning */
  padding-right: 32px; /* Make space for copy button */
}

[dir="rtl"] .message-assistant .message-content {
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-sm);
  padding-right: 16px; /* Reset LTR padding */
  padding-left: 32px; /* Space for copy button in RTL */
}

/* Copy button */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.2s ease;
}

[dir="rtl"] .copy-btn {
  right: auto;
  left: 8px;
}

.message-content:hover .copy-btn {
  opacity: 1;
}

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

/* Markdown content in messages */
.message-content p {
  margin-bottom: 8px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content ul,
.message-content ol {
  padding-left: 20px;
  margin-bottom: 8px;
}

[dir="rtl"] .message-content ul,
[dir="rtl"] .message-content ol {
  padding-left: 0;
  padding-right: 20px;
}

.message-content strong {
  color: var(--color-primary-light);
}

.message-content code {
  background: var(--bg-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

/* Source citations */
.message-sources {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.source-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(200, 16, 46, 0.1);
  border: 1px solid rgba(200, 16, 46, 0.2);
  border-radius: var(--radius-full);
  font-size: 11px;
  color: var(--color-primary-light);
  margin: 2px 4px 2px 0;
  cursor: pointer;
  transition: all var(--transition-fast);
}

[dir="rtl"] .source-tag {
  margin: 2px 0 2px 4px;
}

.source-tag:hover {
  background: rgba(200, 16, 46, 0.2);
  transform: scale(1.02);
}

.source-tag-icon {
  font-size: 12px;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  max-width: 850px;
  width: 100%;
  margin: 0 auto;
}

.typing-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.typing-dots {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--msg-assistant-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: var(--radius-full);
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* ---------------------------------------------------------------------------
   Chat Input
   --------------------------------------------------------------------------- */
.chat-input-container {
  padding: 12px 20px 20px;
  background: linear-gradient(to top, var(--bg-primary) 60%, transparent);
}

.chat-input-form {
  max-width: 850px;
  margin: 0 auto;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  transition:
    border-color var(--transition-normal),
    box-shadow var(--transition-normal);
}

.input-wrapper:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  padding: 6px 0;
}

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

.btn-send {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-normal);
}

.btn-send:hover:not(:disabled) {
  background: var(--color-primary-light);
  transform: scale(1.05);
}

.btn-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ---------------------------------------------------------------------------
   Buttons (shared)
   --------------------------------------------------------------------------- */
.btn-primary {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  font-family: inherit;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-light);
  box-shadow: var(--shadow-glow);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-normal);
  font-family: inherit;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  transition: all var(--transition-fast);
  line-height: 1;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* ---------------------------------------------------------------------------
   Modals
   --------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: modalFadeIn 0.2s ease;
}

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

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.3s ease;
}

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

.modal-wide {
  max-width: 700px;
}

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

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  margin-bottom: 20px;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--color-primary);
  background: rgba(200, 16, 46, 0.05);
}

.upload-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.upload-text {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 8px;
}

.upload-text small {
  color: var(--text-muted);
}

.upload-formats {
  color: var(--text-muted);
  font-size: 12px;
}

.upload-zone.has-file {
  border-color: var(--color-primary);
  background: rgba(200, 16, 46, 0.05);
}

/* Form fields */
.upload-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-normal);
}

.form-group input:focus {
  border-color: var(--color-primary);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

/* Progress bar */
.upload-progress {
  margin-top: 16px;
}

.progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-primary-light)
  );
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.3s ease;
  animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.progress-text {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

/* Document list */
.document-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.document-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.document-item:hover {
  border-color: var(--bg-hover);
}

.document-item-info {
  flex: 1;
  min-width: 0;
}

.document-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  gap: 12px;
}

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

.document-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-size: 16px;
}

.document-delete-btn:hover {
  color: var(--color-primary);
  background: rgba(200, 16, 46, 0.1);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-card {
  padding: 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary-light);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------------------------------------------------------------------------
   Responsive Design
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  [dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    transform: translateX(100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: flex;
  }

  .example-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .messages-container {
    padding: 12px;
  }

  .message {
    max-width: 95%;
  }
}

@media (max-width: 480px) {
  .welcome-title {
    font-size: 22px;
  }

  .welcome-message {
    font-size: 14px;
  }

  .chat-input-container {
    padding: 8px 12px 12px;
  }
}
