/* ========================================
   SPARK BENCH — Admin-only styles
   Frontend pages use Tailwind CDN
   ======================================== */

:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-50: #eff6ff;
  --accent-light: #fbbf24;
  --bg: #f8fafc;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --surface-hover: #f1f5f9;
  --surface-active: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

/* ---- FORM COMPONENTS ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.form-input {
  width: 100%; padding: 9px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  font-size: 14px; font-family: inherit; color: var(--text); background: white;
  transition: all .15s; box-sizing: border-box;
}
.form-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
textarea.form-input { resize: vertical; min-height: 80px; }
.form-error { color: var(--danger); font-size: 13px; margin-top: 6px; font-weight: 500; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm); border: none;
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-secondary { background: var(--surface-hover); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-active); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ---- ADMIN TABLES ---- */
.admin-table-wrap {
  background: white; border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); overflow-x: auto;
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  background: #0f172a; color: white; padding: 10px 14px;
  text-align: left; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.admin-table th:first-child { border-radius: var(--radius) 0 0 0; }
.admin-table th:last-child { border-radius: 0 var(--radius) 0 0; }
.admin-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--primary-50); }

.status-badge {
  display: inline-block; padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
}
.status-live { background: #dcfce7; color: #166534; }
.status-draft { background: #fef3c7; color: #92400e; }

.admin-actions { display: flex; gap: 5px; }

/* ---- ADMIN TABS ---- */
.admin-tabs {
  display: flex; gap: 0; margin-bottom: 24px; border-bottom: 2px solid var(--border);
}
.admin-tab {
  padding: 10px 24px; font-weight: 600; font-size: 14px; border: none; background: none;
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  color: var(--muted); transition: all .15s; font-family: inherit;
}
.admin-tab:hover { color: var(--primary); }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- ADMIN FILTERS ---- */
.admin-filters {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center;
}
.admin-filter-search {
  flex: 1; min-width: 160px; max-width: 260px;
  padding: 7px 14px; font-size: 13px; border-radius: var(--radius-full);
  border: 1px solid var(--border); font-weight: 500;
}
.admin-filter-search:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.admin-filter-select {
  padding: 7px 12px; font-size: 12px; min-width: 110px;
  border-radius: var(--radius-full); border: 1px solid var(--border);
  font-weight: 500; cursor: pointer; background: white; color: var(--text-secondary);
}
.admin-filter-select:hover { border-color: var(--primary-light); }
.admin-filter-select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

/* ---- MODAL ---- */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.6);
  backdrop-filter: blur(4px);
  z-index: 200; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: white; border-radius: var(--radius-lg); padding: 28px;
  max-width: 600px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-xl); animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal h3 { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 20px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ---- TAG SUGGESTIONS ---- */
.tag-suggestions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.tag-suggestion {
  font-size: 11px; padding: 3px 10px; border-radius: var(--radius-full); cursor: pointer;
  background: var(--surface-hover); color: var(--text-secondary); border: 1px solid var(--border);
  transition: all .15s; user-select: none; font-weight: 500;
}
.tag-suggestion:hover { background: var(--primary-50); border-color: var(--primary-light); color: var(--primary); }
.tag-suggestion.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ---- SECTION BUILDER (collection modal) ---- */
.section-builder { margin-top: 16px; }
.section-item {
  background: var(--border-light); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
.section-item-header { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.section-item-header input { flex: 1; }
.section-item .sim-checklist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sim-check-item {
  display: flex; align-items: center; gap: 4px; font-size: 12px;
  padding: 4px 10px; border-radius: var(--radius-sm); background: white;
  border: 1px solid var(--border);
  cursor: pointer; user-select: none; transition: all .15s;
}
.sim-check-item:hover { background: var(--primary-50); border-color: var(--primary-light); }
.sim-check-item.checked { background: var(--primary); color: white; border-color: var(--primary); }
.sim-check-item input { display: none; }

/* ---- SPINNER ---- */
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .admin-filters { flex-direction: row; }
  .admin-filter-search { max-width: 100%; }
}
