/* RAG Assistant — Design System (based on PRAXIS) */

:root {
  --navy: #1A1F3A;
  --e-blue: #2B4B9A;
  --e-blue-dark: #1E3A7A;
  --i-blue: #E8EDF8;
  --amber: #F9A825;
  --amber-h: #F59E0B;
  --lgray: #F4F4F4;
  --border: #E2E8F0;
  --slate: #546E7A;
  --text: #374151;
  --color-primary: #2B4B9A;
  --color-primary-dark: #1E3A7A;
  --color-primary-light: #E8EDF8;
  --color-success: #16A34A;
  --color-success-light: #DCFCE7;
  --color-warning: #D97706;
  --color-warning-light: #FEF3C7;
  --color-danger: #DC2626;
  --color-danger-light: #FEE2E2;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--lgray);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---- Navigation ---- */
.praxis-nav {
  background: rgba(26, 31, 58, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  box-shadow: 0 1px 20px rgba(0,0,0,0.18);
}
.praxis-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #fff;
  text-decoration: none;
}
.praxis-logo svg { color: var(--amber); }
.nav-link-light {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s;
  text-decoration: none;
}
.nav-link-light:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-link-light.active { color: #fff; background: rgba(255,255,255,0.12); }
.nav-badge-light {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 3px 10px;
  text-decoration: none;
  transition: all 0.15s;
}
.nav-badge-light:hover { color: #fff; border-color: rgba(255,255,255,0.35); }

/* ---- Buttons ---- */
.btn-amber {
  background: var(--amber);
  color: var(--navy);
  font-weight: 700;
  border-radius: 6px;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}
.btn-amber:hover:not(:disabled) {
  background: var(--amber-h);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(249,168,37,0.35);
}
.btn-amber:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-navy {
  background: var(--e-blue);
  color: #fff;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}
.btn-navy:hover:not(:disabled) { background: var(--e-blue-dark); transform: translateY(-1px); }
.btn-navy:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-ghost-navy {
  background: transparent;
  color: var(--e-blue);
  border: 1.5px solid var(--e-blue);
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.2s;
  cursor: pointer;
}
.btn-ghost-navy:hover { background: var(--e-blue); color: #fff; }

.btn-muted {
  background: #fff;
  color: var(--slate);
  border: 1px solid var(--border);
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.15s;
  cursor: pointer;
}
.btn-muted:hover { background: var(--lgray); color: var(--navy); }

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---- Cards ---- */
.praxis-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ---- Form inputs ---- */
.praxis-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--navy);
  background: #fff;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.praxis-input:focus {
  border-color: var(--e-blue);
  box-shadow: 0 0 0 3px rgba(43,75,154,0.1);
}
.praxis-select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--navy);
  background: #fff;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23546E7A' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.praxis-select:focus {
  border-color: var(--e-blue);
  box-shadow: 0 0 0 3px rgba(43,75,154,0.1);
}

/* ---- Spinner ---- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--e-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
.spinner-sm {
  width: 14px; height: 14px;
  border-width: 2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Upload zone ---- */
.upload-zone {
  border: 2px dashed #CBD5E1;
  transition: border-color 0.15s, background-color 0.15s;
  border-radius: 12px;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--e-blue);
  background-color: var(--i-blue);
}

/* ---- Status badges ---- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}
.status-pending  { background: #F1F5F9; color: var(--slate); }
.status-processing { background: var(--color-warning-light); color: var(--color-warning); }
.status-indexed  { background: var(--color-success-light); color: var(--color-success); }
.status-error    { background: var(--color-danger-light); color: var(--color-danger); }

/* ---- Chat layout ---- */
.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 56px);
  overflow: hidden;
}
.chat-sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  background: #fff;
}

/* ---- Chat messages ---- */
.msg-user {
  align-self: flex-end;
  max-width: 70%;
  background: var(--e-blue);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
}
.msg-assistant {
  align-self: flex-start;
  max-width: 80%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.msg-assistant p { margin: 0 0 8px; }
.msg-assistant p:last-child { margin-bottom: 0; }

.sources-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--slate);
  background: var(--lgray);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  margin: 2px;
  cursor: pointer;
  transition: all 0.15s;
}
.source-chip:hover { background: var(--i-blue); color: var(--e-blue); border-color: var(--e-blue); }

/* ---- Session list ---- */
.session-item {
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-item:hover { background: var(--lgray); }
.session-item.active { background: var(--i-blue); color: var(--e-blue); font-weight: 600; }

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  animation: slideIn 0.25s ease;
  max-width: 340px;
}
.toast-success { background: #fff; border-left: 4px solid var(--color-success); color: var(--text); }
.toast-error   { background: #fff; border-left: 4px solid var(--color-danger); color: var(--text); }
.toast-info    { background: #fff; border-left: 4px solid var(--e-blue); color: var(--text); }
@keyframes slideIn { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform:none; } }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-box {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
