/* ============================================================
   MCP PDF Assistant — Complete Application Styles
   Dark theme · Modern UI · Desktop + Mobile Responsive
   ============================================================ */

:root {
  /* Core palette */
  --accent:        #6C63FF;
  --accent-light:  #8B85FF;
  --accent-dark:   #5A52E0;
  --accent-glow:   rgba(108, 99, 255, 0.35);
  --accent-dim:    rgba(108, 99, 255, 0.15);

  /* Surfaces */
  --bg-app:        #0F0F1A;
  --bg-sidebar:    #161625;
  --bg-card:       #1E1E32;
  --bg-card-hover: #26264A;
  --bg-input:      #1A1A2E;
  --bg-overlay:    rgba(10, 10, 20, 0.80);
  --surface-card:  var(--bg-card);
  --surface-elevated: var(--bg-card-hover);

  /* Text */
  --text-primary:   #E8E8F0;
  --text-secondary: #A0A0B8;
  --text-muted:     #6E6E88;
  --text-inverse:   #0F0F1A;

  /* Semantic */
  --success:  #34D399;
  --warning:  #FBBF24;
  --error:    #F87171;
  --info:     #60A5FA;

  /* Borders */
  --border:       rgba(255, 255, 255, 0.06);
  --border-focus: rgba(108, 99, 255, 0.5);

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

  /* 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 30px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Layout */
  --sidebar-w:  280px;
  --header-h:   56px;
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --duration:   200ms;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

code, pre, .mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { color: var(--accent); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; font-size: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; border: none; outline: none; background: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }

/* ── App Shell ── */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.35s var(--ease-out);
}

.sidebar-header {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
}

.logo svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.sidebar-section {
  padding: 8px 12px;
  flex-shrink: 0;
}

.sidebar-section h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 0 4px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Sessions ── */
.session-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 200px;
  overflow-y: auto;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  transition: all var(--duration) ease;
  position: relative;
}

.session-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.session-item.active {
  background: var(--accent-dim);
  color: var(--accent-light);
}

.session-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.session-item span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-delete {
  display: none;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all 150ms ease;
}

.session-item:hover .btn-delete { display: flex; }
.btn-delete:hover { color: var(--error); background: rgba(248,113,113,0.15); }
.btn-edit {
  display: none;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all 150ms ease;
  flex-shrink: 0;
}
.session-item:hover .btn-edit { display: flex; }
.btn-edit:hover { color: var(--cyan); background: rgba(93,231,255,.14); }
.session-title-input {
  min-width: 0;
  flex: 1;
  width: 100%;
  padding: 3px 7px;
  border: 1px solid var(--cyan);
  border-radius: 8px;
  background: rgba(5,8,25,.6);
  color: var(--text-primary);
  outline: none;
  box-shadow: 0 0 14px rgba(93,231,255,.2);
  direction: rtl;
  text-align: right;
}

/* ── Files ── */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  transition: all var(--duration) ease;
}

.file-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.file-item.empty {
  cursor: default;
  color: var(--text-muted);
  font-style: italic;
}

.file-item.private { color: var(--warning); }
.file-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.badge-private {
  font-size: 10px;
  margin-left: auto;
}

/* ── User Profile ── */
.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--duration) ease;
}

.user-profile:hover {
  background: var(--bg-card);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), #9B59FF);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

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

.user-info .username {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.user-info .tokens {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Main Chat Area ── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  background: var(--bg-app);
}

.chat-header {
  height: var(--header-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-title {
  flex: 1;
  min-width: 0;
}

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

.chat-status {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
}

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

/* ── Icon Buttons ── */
.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all 150ms ease;
}

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

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.mobile-only {
  display: none;
}

/* ── Chat Messages ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Welcome */
.welcome-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  flex: 1;
  gap: 16px;
}

.welcome-icon {
  color: var(--accent);
  margin-bottom: 8px;
}

.welcome-message h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.welcome-message p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 500px;
  line-height: 1.7;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.quick-btn {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  transition: all 150ms ease;
}

.quick-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-light);
}

/* Message Bubbles */
.message-bubble {
  animation: messageIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
}

.message-bubble.user {
  background: linear-gradient(135deg, var(--accent), #8B5CF6);
  color: white;
  align-self: flex-end;
  border-radius: 16px 16px 4px 16px;
  max-width: 75%;
  padding: 12px 16px;
  word-break: break-word;
}

.message-bubble.assistant {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px;
  align-self: flex-start;
  max-width: 85%;
  padding: 12px 16px;
  word-break: break-word;
}

.message-content {
  line-height: 1.6;
}

.message-content code {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(0,0,0,0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

.message-content strong { font-weight: 600; }
.message-content br { display: block; margin: 4px 0; }

.message-time {
  font-size: 0.7em;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.message-bubble:hover .message-time { opacity: 1; }

/* Tool result styling */
.tool-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--accent);
}

.tool-header svg { width: 16px; height: 16px; }

.tool-header .badge {
  font-size: 0.7em;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

.tool-header .badge.error {
  background: rgba(239, 68, 68, 0.2);
  color: #EF4444;
}

.tool-body {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82em;
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  max-height: 400px;
  overflow-y: auto;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: typingDot 1.4s infinite ease-in-out;
}

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

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

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* ── Chat Input ── */
.chat-input-area {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  transition: border-color 150ms ease;
}

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

#messageInput {
  flex: 1;
  resize: none;
  min-height: 24px;
  max-height: 160px;
  padding: 4px 0;
  line-height: 1.5;
  color: var(--text-primary);
  font-size: 14px;
}

#messageInput::placeholder {
  color: var(--text-muted);
}

.btn-send {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: white;
  flex-shrink: 0;
  transition: all 150ms ease;
}

.btn-send:hover {
  background: var(--accent-light);
  box-shadow: var(--shadow-glow);
}

.btn-send svg {
  width: 18px;
  height: 18px;
}

.input-hints {
  display: flex;
  gap: 16px;
  margin-top: 6px;
  padding: 0 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.input-hints code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-card);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  color: var(--accent-light);
}

/* ── Modals ── */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-overlay);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 90%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-content.wide {
  max-width: 600px;
}

.modal-content h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.modal-content > p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 150ms ease;
  text-align: center;
}

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

.tab.active {
  background: var(--accent);
  color: white;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

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

.form-group input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 150ms ease;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

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

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  margin-top: 4px;
}

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

.btn-secondary {
  width: 100%;
  padding: 8px 16px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
  margin-top: 8px;
}

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

.btn-demo {
  width: 100%;
  padding: 8px 16px;
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  transition: all 150ms ease;
  margin-top: 12px;
}

.btn-demo:hover {
  color: var(--accent-light);
  border-color: var(--accent);
}

/* Profile Modal */
.profile-details {
  margin: 20px 0;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.profile-row:last-child { border-bottom: none; }

.profile-row label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.profile-row span {
  font-size: 13px;
  color: var(--text-primary);
}

.profile-row code {
  font-size: 11px;
  color: var(--accent-light);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

/* Tools Modal */
.tools-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
  max-height: 60vh;
  overflow-y: auto;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.tool-card h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-light);
  margin-bottom: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.tool-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.tool-params {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.param {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  color: var(--text-secondary);
}

.param.required {
  color: var(--accent-light);
  background: var(--accent-dim);
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
  height: 20px;
  margin: 8px 0;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── Toast Notifications ── */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  animation: toastIn 0.3s ease-out;
  box-shadow: var(--shadow-md);
}

.toast-info {
  background: var(--info);
  color: #000;
}

.toast-error {
  background: var(--error);
  color: #fff;
}

.toast-success {
  background: var(--success);
  color: #000;
}

.toast.fade-out {
  animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

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

/* ── Responsive ── */
@media (max-width: 768px) {
  .mobile-only { display: flex; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }

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

  .chat-main { width: 100%; }

  .message-bubble.user,
  .message-bubble.assistant {
    max-width: 90%;
  }

  .input-hints { display: none; }
}

/* ============================================================
   Dreamy RTL Glass / Glossy Neon skin
   ============================================================ */
:root {
  --accent: #b46cff;
  --accent-light: #e4b7ff;
  --accent-dark: #7040c6;
  --accent-glow: rgba(180, 108, 255, .42);
  --cyan: #5de7ff;
  --pink: #ff75c3;
  --bg-app: #080a19;
  --bg-sidebar: rgba(14, 16, 38, .72);
  --bg-card: rgba(31, 27, 67, .56);
  --bg-card-hover: rgba(73, 47, 119, .58);
  --bg-input: rgba(15, 20, 51, .74);
  --text-primary: #f7f1ff;
  --text-secondary: #c6c2dc;
  --text-muted: #8d89ab;
  --border: rgba(255,255,255,.12);
  --border-focus: rgba(93,231,255,.64);
  --shadow-glow: 0 0 28px rgba(180,108,255,.26), inset 0 1px 0 rgba(255,255,255,.08);
  --glass: blur(24px) saturate(145%);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --duration: 280ms;
}

html, body { direction: rtl; }
body {
  font-family: 'Vazirmatn', 'Inter', sans-serif;
  background: #080a19;
  background-image: radial-gradient(circle at 12% 12%, rgba(93,231,255,.11), transparent 28%),
                    radial-gradient(circle at 88% 84%, rgba(255,117,195,.11), transparent 30%),
                    linear-gradient(135deg, #080a19, #11102b 52%, #0a0c20);
}

.app-container {
  position: relative;
  isolation: isolate;
  flex-direction: row-reverse;
  gap: 14px;
  padding: 14px;
}
.app-container::before {
  content: '';
  position: fixed;
  inset: -25%;
  z-index: -1;
  pointer-events: none;
  background: conic-gradient(from 180deg at 50% 50%, rgba(180,108,255,.08), transparent 28%, rgba(93,231,255,.08), transparent 65%, rgba(255,117,195,.08));
  filter: blur(70px);
  animation: aurora 18s ease-in-out infinite alternate;
}
.app-container::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .48;
  background: radial-gradient(420px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(93,231,255,.09), transparent 68%);
  transition: opacity .5s ease;
}
.sidebar {
  order: 2;
  height: calc(100vh - 28px);
  border: 1px solid var(--border);
  border-radius: 26px;
  background: linear-gradient(160deg, rgba(28,31,70,.78), rgba(12,14,34,.73));
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  box-shadow: 0 18px 50px rgba(0,0,0,.28), 0 0 34px rgba(180,108,255,.09), inset 0 1px 0 rgba(255,255,255,.1);
}
.sidebar-header { padding: 22px 20px 16px; }
.logo { font-size: 17px; }
.logo svg { color: var(--cyan); filter: drop-shadow(0 0 9px rgba(93,231,255,.7)); }
.sidebar-section h3 { text-align: right; color: #aca6d0; letter-spacing: .02em; }
.session-item, .file-item { text-align: right; border: 1px solid transparent; }
.session-item:hover, .file-item:hover { transform: translateX(-4px); background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.12); }
.session-item.active { background: linear-gradient(90deg, rgba(180,108,255,.12), rgba(93,231,255,.16)); border-color: rgba(180,108,255,.34); box-shadow: inset -3px 0 0 var(--cyan), 0 0 18px rgba(180,108,255,.12); }
.sidebar-footer { border-top-color: var(--border); padding: 16px; }
.user-profile { border: 1px solid transparent; transition: all var(--duration) var(--ease-out); }
.user-profile:hover { background: rgba(255,255,255,.07); border-color: var(--border); box-shadow: var(--shadow-glow); }
.avatar { background: linear-gradient(135deg, var(--cyan), var(--accent), var(--pink)); box-shadow: 0 0 18px rgba(180,108,255,.5); }
.chat-main { order: 1; min-width: 0; border: 1px solid var(--border); border-radius: 26px; overflow: hidden; background: rgba(10,12,31,.48); box-shadow: 0 18px 50px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.07); }
.chat-header { min-height: 72px; padding: 14px 24px; background: rgba(17,19,47,.52); border-bottom-color: var(--border); backdrop-filter: blur(20px); }
.chat-title h2 { font-size: 17px; }
.chat-title { display: flex; align-items: center; gap: 12px; }
.site-brand { display: inline-flex; align-items: center; gap: 7px; padding-left: 12px; border-left: 1px solid var(--border); color: var(--accent-light); font-size: 13px; font-weight: 700; white-space: nowrap; }
.site-brand-mark { width: 24px; height: 24px; color: var(--cyan); filter: drop-shadow(0 0 8px rgba(93,231,255,.65)); }
.brand-logo { width: 34px; height: 34px; flex: 0 0 34px; object-fit: contain; border-radius: 50%; filter: drop-shadow(0 0 10px rgba(93,231,255,.5)); }
.site-brand-logo { width: 30px; height: 30px; object-fit: contain; border-radius: 50%; filter: drop-shadow(0 0 10px rgba(93,231,255,.55)); }
.chat-status { color: var(--cyan); }
.chat-actions { gap: 10px; }
.llm-status { margin-left: 0; margin-right: auto; padding: 7px 12px; border: 1px solid rgba(93,231,255,.2); background: rgba(93,231,255,.07); border-radius: 999px; }
.btn-icon { border: 1px solid transparent; border-radius: 12px; transition: all var(--duration) var(--ease-out); }
.btn-icon:hover { transform: translateY(-2px); color: var(--cyan); border-color: rgba(93,231,255,.35); background: rgba(93,231,255,.09); box-shadow: 0 0 18px rgba(93,231,255,.18); }
.chat-messages { padding: 34px clamp(18px, 6vw, 90px); scroll-behavior: smooth; }
.welcome-message { max-width: 760px; padding: 42px 32px; border: 1px solid var(--border); border-radius: 30px; background: linear-gradient(145deg, rgba(39,31,82,.64), rgba(16,25,56,.5)); backdrop-filter: blur(18px); box-shadow: var(--shadow-glow); animation: floatIn .8s var(--ease-out) both; }
.welcome-icon { width: 84px; height: 84px; display: grid; place-items: center; margin-bottom: 20px; border-radius: 26px; color: var(--cyan); background: linear-gradient(135deg, rgba(93,231,255,.16), rgba(180,108,255,.22)); border: 1px solid rgba(93,231,255,.3); box-shadow: 0 0 30px rgba(93,231,255,.2), inset 0 0 22px rgba(180,108,255,.18); }
.welcome-logo { width: 150px; height: 150px; object-fit: contain; border-radius: 30px; margin-bottom: 4px; filter: drop-shadow(0 0 22px rgba(93,231,255,.3)) drop-shadow(0 0 34px rgba(180,108,255,.2)); animation: welcomeLogoFloat 5s ease-in-out infinite; }
.welcome-icon svg { width: 46px; height: 46px; filter: drop-shadow(0 0 8px rgba(93,231,255,.72)); }
.welcome-message h2 { background: linear-gradient(90deg, #fff, var(--accent-light), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome-message p { color: var(--text-secondary); }
.quick-actions { gap: 10px; }
.quick-btn, .btn-primary, .btn-demo { border: 1px solid rgba(180,108,255,.35); background: linear-gradient(135deg, rgba(180,108,255,.24), rgba(93,231,255,.13)); box-shadow: 0 8px 24px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.12); transition: all var(--duration) var(--ease-out); }
.quick-btn:hover, .btn-primary:hover, .btn-demo:hover { transform: translateY(-3px); border-color: rgba(93,231,255,.6); box-shadow: 0 0 24px rgba(93,231,255,.2), inset 0 1px 0 rgba(255,255,255,.2); }
.message-bubble { border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,.13); backdrop-filter: blur(12px); animation: messageIn .4s var(--ease-out) both; }
.message-bubble.user { background: linear-gradient(135deg, rgba(180,108,255,.25), rgba(93,231,255,.12)); border-color: rgba(180,108,255,.32); }
.message-bubble.assistant { background: rgba(29,31,64,.64); }
.message-content { line-height: 2; }
.chat-input-area { padding: 14px clamp(18px, 6vw, 90px) 20px; background: linear-gradient(180deg, transparent, rgba(7,9,25,.85) 28%); }
.input-wrapper { border: 1px solid rgba(180,108,255,.34); border-radius: 22px; background: rgba(15,19,48,.82); box-shadow: 0 0 28px rgba(180,108,255,.1), inset 0 1px 0 rgba(255,255,255,.1); transition: all var(--duration) var(--ease-out); }
.input-wrapper:focus-within { border-color: rgba(93,231,255,.7); box-shadow: 0 0 30px rgba(93,231,255,.17), inset 0 1px 0 rgba(255,255,255,.16); transform: translateY(-2px); }
#messageInput { direction: rtl; text-align: right; }
.btn-send { background: linear-gradient(135deg, var(--accent), var(--pink)); box-shadow: 0 0 20px rgba(180,108,255,.42); transition: all var(--duration) var(--ease-out); }
.btn-send:hover { transform: scale(1.08) rotate(-5deg); box-shadow: 0 0 30px rgba(255,117,195,.6); }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; background: rgba(255,255,255,.42); transform: scale(0); animation: ripple .65s ease-out; }
.input-hints { text-align: right; color: #8884a7; }
.modal { background: rgba(5,7,20,.7); backdrop-filter: blur(16px); }
.modal-content { border: 1px solid rgba(180,108,255,.32); border-radius: 28px; background: linear-gradient(145deg, rgba(33,28,74,.9), rgba(12,18,43,.9)); box-shadow: 0 24px 80px rgba(0,0,0,.5), 0 0 34px rgba(180,108,255,.17), inset 0 1px 0 rgba(255,255,255,.12); animation: modalIn .45s var(--ease-out) both; }
.modal-content h2, .tool-card h4 { color: var(--accent-light); }
.form-group label, .profile-row label { text-align: right; }
.form-group input { direction: rtl; text-align: right; border: 1px solid var(--border); border-radius: 13px; background: rgba(0,0,0,.17); }
.form-group input:focus { border-color: var(--cyan); box-shadow: 0 0 18px rgba(93,231,255,.14); }
.agentic-step { border-color: rgba(180,108,255,.25); background: rgba(62,42,109,.18); }
.agentic-step .step-header { flex-direction: row-reverse; }
.agentic-step .chevron { margin-left: 0; margin-right: auto; }
.chat-messages { direction: ltr; }
.chat-messages > .message-bubble,
.chat-messages > .agentic-step,
.chat-messages > .welcome-message { direction: rtl; text-align: right; }
.chat-messages > .message-bubble.user { align-self: flex-end; margin-left: 0; margin-right: 0; }
.chat-messages > .message-bubble.assistant { align-self: flex-start; margin-left: 0; margin-right: 0; }
.chat-messages > .agentic-step { align-self: stretch; }
.llm-info { justify-content: center; border: 1px solid rgba(93,231,255,.16); background: rgba(93,231,255,.06); }

@keyframes aurora { from { transform: rotate(-8deg) scale(1); } to { transform: rotate(12deg) scale(1.08); } }
@keyframes floatIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes messageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes ripple { to { opacity: 0; transform: scale(4); } }
@keyframes welcomeLogoFloat { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-7px) rotate(1deg); } }

@media (max-width: 768px) {
  .app-container { padding: 0; gap: 0; }
  .sidebar { right: 0; left: auto; transform: translateX(105%); height: 100vh; border-radius: 0 24px 24px 0; }
  .sidebar.open { transform: translateX(0); }
  .chat-main { border-radius: 0; border-left: 0; border-right: 0; }
  .chat-header { padding: 12px 16px; }
  .welcome-message { padding: 30px 20px; border-radius: 24px; }
  .chat-messages { padding: 24px 14px; }
  .chat-input-area { padding: 12px 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
