/* ================================================================
   DeepSearch Admin — dashboard.css
   Theme: Google/Apple-inspired clean design
   Primary: #4285f4 (Google Blue)
   ================================================================ */

/* .hidden must come first so it wins over display:flex on .modal etc. */
.hidden { display: none !important; }

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8f9fa;
  color: #202124;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Layout ────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

main {
  flex: 1;
  padding: 1.75rem 2rem;
  overflow-y: auto;
  min-height: 0;
}

/* ── Header ────────────────────────────────────────────────── */
.dashboard-header {
  background: #4285f4;
  color: white;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo h1 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.version {
  background: rgba(255,255,255,0.2);
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.live-indicator {
  color: #81c995;
  font-weight: 600;
  font-size: 0.85rem;
}

.header-user {
  background: rgba(255,255,255,0.15);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid #dadce0;
  padding: 1rem 0;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 0.25rem;
}

.section-title {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #80868b;
  padding: 0.6rem 1.25rem 0.3rem;
}

.sidebar ul {
  list-style: none;
}

.sidebar li {
  padding: 0;
}

.sidebar li a {
  display: block;
  padding: 0.55rem 1.25rem;
  text-decoration: none;
  color: #3c4043;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0 24px 24px 0;
  margin-right: 0.75rem;
  transition: background 0.15s;
}

.sidebar li a:hover {
  background: #f1f3f4;
  color: #202124;
}

.sidebar li.active a {
  background: #e8f0fe;
  color: #1a73e8;
  font-weight: 600;
}

/* ── Footer ────────────────────────────────────────────────── */
.dashboard-footer {
  background: #fff;
  border-top: 1px solid #dadce0;
  padding: 0.6rem 1.5rem;
  text-align: center;
  font-size: 0.78rem;
  color: #80868b;
  flex-shrink: 0;
}

/* ── KPI Cards ─────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid #f1f3f4;
  transition: box-shadow 0.2s;
}

.kpi-card:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.08);
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: #80868b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: #202124;
  letter-spacing: -0.02em;
}

/* ── Charts ────────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.chart-container {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.1);
  height: 280px;
  border: 1px solid #f1f3f4;
}

.chart-container canvas {
  max-height: 230px;
}

/* ── Alerts Panel ──────────────────────────────────────────── */
.alerts-panel {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid #f1f3f4;
  margin-bottom: 1.5rem;
}

.alerts-panel h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #3c4043;
  margin-bottom: 0.75rem;
}

.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.alert-item {
  padding: 0.75rem 1rem;
  border-left: 4px solid;
  border-radius: 0 6px 6px 0;
  background: #f8f9fa;
  font-size: 0.85rem;
}

.alert-item.severity-info     { border-color: #4285f4; }
.alert-item.severity-warning  { border-color: #fbbc04; }
.alert-item.severity-critical { border-color: #ea4335; }
.alert-item.severity-emergency{ border-color: #6a0000; background: #fce8e6; }

/* ── Tables ────────────────────────────────────────────────── */
table {
  width: 100%;
  background: #fff;
  border-collapse: collapse;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid #f1f3f4;
}

th {
  background: #f8f9fa;
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #80868b;
  border-bottom: 1px solid #dadce0;
}

td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #f1f3f4;
  font-size: 0.875rem;
  color: #3c4043;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: #f8f9fa;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
}

/* ── Buttons ───────────────────────────────────────────────── */
button, .btn {
  background: #4285f4;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  transition: background 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

button:hover, .btn:hover {
  background: #1a73e8;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.btn-primary { background: #4285f4; }
.btn-primary:hover { background: #1a73e8; }

.btn-success { background: #34a853; }
.btn-success:hover { background: #1e8e3e; }

.btn-danger { background: #ea4335; }
.btn-danger:hover { background: #c5221f; }

.btn-secondary {
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
}

.btn-secondary:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

button.btn-icon {
  background: transparent;
  color: white;
  font-size: 1.2rem;
  padding: 0.25rem 0.5rem;
  box-shadow: none;
}

button.btn-icon:hover {
  background: rgba(255,255,255,0.15);
  box-shadow: none;
}

.ack-btn {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  background: transparent;
  color: #4285f4;
  border: 1px solid #4285f4;
  border-radius: 4px;
}

.ack-btn:hover { background: #e8f0fe; box-shadow: none; }

/* ── Forms ─────────────────────────────────────────────────── */
input, select, textarea {
  padding: 0.5rem 0.75rem;
  border: 1px solid #dadce0;
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: inherit;
  color: #202124;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: #4285f4;
  box-shadow: 0 0 0 3px rgba(66,133,244,0.15);
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid #f1f3f4;
  margin-bottom: 1.5rem;
}

/* ── Job Cards ─────────────────────────────────────────────── */
.jobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.job-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid #f1f3f4;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.job-card h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #202124;
  margin-bottom: 0.25rem;
  word-break: break-all;
}

.job-card div {
  font-size: 0.85rem;
  color: #5f6368;
}

.job-card button {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
}

/* ── Modals ────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.modal-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #202124;
}

.close {
  float: right;
  font-size: 1.4rem;
  cursor: pointer;
  color: #80868b;
  line-height: 1;
  margin-top: -0.2rem;
}

.close:hover { color: #202124; }

#job-seeds {
  width: 100%;
  min-height: 100px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  resize: vertical;
}

.form-actions { margin-top: 1rem; }

/* ── Result Box (Eval pages) ───────────────────────────────── */
.result-box {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.7;
}

.result-box.error-box {
  background: #fef2f2;
  border-color: #fca5a5;
}

/* ── Page headers ──────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.page-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #202124;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ── Live Log ──────────────────────────────────────────────── */
.live-log {
  background: #1e293b;
  color: #94a3b8;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  margin-top: 1rem;
  max-height: 280px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
}

.live-log h3 {
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Status colours ────────────────────────────────────────── */
.status-running   { color: #34a853; font-weight: 600; }
.status-stopped   { color: #ea4335; }
.status-pending   { color: #fbbc04; }
.status-completed { color: #34a853; }
.status-failed    { color: #ea4335; }
.status-paused    { color: #9aa0a6; }
.status-cancelled { color: #9aa0a6; }

.status-200       { color: #34a853; }
.status-301, .status-302 { color: #fbbc04; }
.status-404       { color: #ea4335; }
.status-500       { color: #c5221f; }

/* ── Utility ───────────────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 3rem;
  color: #80868b;
  font-size: 0.9rem;
}

.error {
  color: #ea4335;
  text-align: center;
  padding: 2rem;
  font-size: 0.875rem;
}

.no-data {
  color: #80868b;
  text-align: center;
  padding: 2rem;
  font-size: 0.875rem;
}

/* input-group used in eval-jobs */
.input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.auto-refresh {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: #5f6368;
  margin-left: 0.5rem;
}

/* Crawled pages table */
.url-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* Controls row */
.controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Additional crawl summary row (dashboard.html) */
#crawl-summary {
  margin-top: 1rem;
}

/* Eval-cycle textarea */
#eval-body {
  width: 100%;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  border: 1px solid #dadce0;
  border-radius: 6px;
  padding: 0.75rem;
  resize: vertical;
  min-height: 200px;
  color: #202124;
}

#eval-body:focus {
  border-color: #4285f4;
  box-shadow: 0 0 0 3px rgba(66,133,244,0.15);
  outline: none;
}

/* Eval status classes */
.status-pending   { color: #fbbc04; }
.status-running   { color: #4285f4; }
.status-completed { color: #34a853; }
.status-failed    { color: #ea4335; }

/* Logout button in header */
.btn-logout {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-logout:hover {
  background: rgba(255,255,255,0.25);
  box-shadow: none;
}
