/* ============================================================
   Chatbot FB AI — Base styles
   ============================================================ */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #1a1a2e;
  background: #f5f6fa;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: #4361ee; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar */
.navbar {
  background: #1a1a2e;
  color: #fff;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand a { color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.navbar-nav { display: flex; align-items: center; gap: 20px; }
.navbar-nav a { color: #c8c8e0; font-size: 0.9rem; }
.navbar-nav a:hover { color: #fff; text-decoration: none; }
.navbar-user { color: #a0a0c0; font-size: 0.85rem; }

/* Container */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 20px;
  flex: 1;
}

/* Footer */
.footer {
  text-align: center;
  padding: 16px;
  color: #999;
  font-size: 0.8rem;
  border-top: 1px solid #e0e0e0;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}
.alert-error   { background: #fce4e4; color: #c0392b; border: 1px solid #f5b0b0; }
.alert-success { background: #e4fce8; color: #1e7c34; border: 1px solid #a8e6b0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 20px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
  text-decoration: none;
}
.btn-primary { background: #4361ee; color: #fff; }
.btn-primary:hover { background: #3451d1; color: #fff; text-decoration: none; }
.btn-outline { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.4); }
.btn-outline:hover { background: rgba(255,255,255,0.1); text-decoration: none; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* Forms */
.form-group {
  margin-bottom: 18px;
  flex: 1;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d0d0e0;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fff;
  color: #1a1a2e;
  transition: border-color 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67,97,238,0.12);
}
.form-hint { font-size: 0.78rem; color: #888; margin-top: 4px; display: block; }
.form-row { display: flex; gap: 16px; }
.form-group-sm { max-width: 110px; flex: 0 0 110px; }

/* Auth */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: 32px 16px;
}
.auth-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #4361ee;
  margin-bottom: 4px;
}
.auth-subtitle {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 28px;
}

/* Setup */
.setup-wrapper {
  max-width: 680px;
  margin: 40px auto;
  padding: 0 16px;
}
.setup-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.setup-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 8px;
}
.setup-desc { color: #666; margin-bottom: 32px; }
.setup-section {
  border: 1px solid #e8e8f0;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}
.setup-section legend {
  font-size: 0.95rem;
  font-weight: 700;
  color: #4361ee;
  padding: 0 8px;
}
.section-note { font-size: 0.83rem; color: #888; margin-bottom: 16px; }

/* Dashboard */
.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 1.7rem; margin-bottom: 4px; }
.text-muted { color: #666; }

.dashboard-placeholder {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}
.placeholder-card {
  background: #fff;
  border-radius: 12px;
  padding: 48px;
  text-align: center;
  max-width: 480px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.placeholder-icon { font-size: 3rem; margin-bottom: 20px; }
.placeholder-card h2 { margin-bottom: 12px; color: #1a1a2e; }
.placeholder-card p { color: #666; margin-bottom: 16px; }
.placeholder-card ul { text-align: left; color: #555; padding-left: 20px; line-height: 2; }

/* ── Phase 2: Chatbots & KB ──────────────────────────────────────────────── */

/* Card */
.card {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}
.card.danger-zone {
  border: 1px solid #fad0d0;
  background: #fffafa;
}

/* Table */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.data-table thead tr { background: #f0f1f9; }
.data-table th { padding: 12px 16px; text-align: left; font-size: 0.82rem; font-weight: 700; color: #555; text-transform: uppercase; letter-spacing: 0.03em; }
.data-table td { padding: 12px 16px; border-top: 1px solid #f0f0f8; font-size: 0.9rem; vertical-align: middle; }
.data-table tbody tr:hover { background: #f9f9ff; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-openrouter { background: #e8f4fd; color: #1a6fa8; }
.badge-claude     { background: #fff3e0; color: #e65100; }
.badge-text       { background: #e8f5e9; color: #2e7d32; }
.badge-product    { background: #fce4ec; color: #c62828; }
.badge-gray       { background: #f0f0f0; color: #777; }

/* Action cell */
.action-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.btn-xs { padding: 3px 10px; font-size: 0.78rem; border-radius: 5px; }
.btn-outline-dark { background: transparent; color: #333; border: 1px solid #ccc; }
.btn-outline-dark:hover { background: #f5f5f5; color: #111; text-decoration: none; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; color: #fff; text-decoration: none; }

/* Filter bar & tabs */
.tab-group { display: flex; gap: 4px; background: #f0f1f9; border-radius: 8px; padding: 4px; }
.tab-btn { padding: 5px 14px; border-radius: 6px; font-size: 0.85rem; color: #555; text-decoration: none; transition: background 0.15s; }
.tab-btn.active { background: #fff; color: #4361ee; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.tab-btn:hover:not(.active) { background: rgba(255,255,255,0.6); text-decoration: none; }

/* Empty state */
.empty-state {
  padding: 48px;
  text-align: center;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  color: #666;
}

/* Prompt preview */
.prompt-preview {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
  background: #f5f6fa;
  border-radius: 6px;
  padding: 12px;
  color: #333;
  max-height: 200px;
  overflow-y: auto;
  font-family: inherit;
}

/* Reply box (LLM test) */
.reply-box {
  background: #f0f7ff;
  border-left: 3px solid #4361ee;
  border-radius: 0 6px 6px 0;
  padding: 14px 16px;
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: #1a1a2e;
}

/* Radio group */
.radio-group { display: flex; gap: 20px; flex-wrap: wrap; }
.radio-label { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 0.9rem; }
.radio-label input[type=radio] { accent-color: #4361ee; width: 16px; height: 16px; }

/* Required marker */
.required { color: #e74c3c; }

/* Mono text */
.text-mono { font-family: 'Courier New', monospace; font-size: 0.82rem; }
.text-sm { font-size: 0.82rem; }

/* Module list */
.module-list { list-style: none; padding: 0; }
.module-list li { padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; display: flex; align-items: center; justify-content: space-between; }
.module-list li:last-child { border-bottom: none; }

/* Error page */
.error-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 16px;
  text-align: center;
}
.error-wrapper h1 { font-size: 2rem; margin-bottom: 12px; color: #c0392b; }
.error-message { color: #555; margin-bottom: 24px; }
