/* admin-search.css — Universal search + bulk action styles for admin portal */

:root {
  --search-bg: #0d1117;
  --search-surface: #161b22;
  --search-border: #30363d;
  --search-text: #c9d1d9;
  --search-muted: #8b949e;
  --search-accent: #58a6ff;
  --search-success: #3fb950;
  --search-danger: #f85149;
  --search-warning: #d29922;
}

/* ── Search modal overlay ─────────────────────────────────────────────── */

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  animation: fadeIn 0.15s ease;
}

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

.search-modal {
  background: var(--search-surface);
  border: 1px solid var(--search-border);
  border-radius: 12px;
  width: 640px;
  max-width: 95vw;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
  animation: slideDown 0.15s ease;
}

@keyframes slideDown { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--search-border);
}

.search-input-wrap .search-icon {
  color: var(--search-muted);
  font-size: 18px;
  flex-shrink: 0;
}

#search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--search-text);
  font-family: inherit;
  line-height: 1.5;
}

#search-input::placeholder { color: var(--search-muted); }

.search-kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--search-muted);
  background: var(--search-bg);
  border: 1px solid var(--search-border);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}

.search-close-btn {
  background: transparent;
  border: none;
  color: var(--search-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.1s, background 0.1s;
}
.search-close-btn:hover { color: var(--search-text); background: var(--search-border); }

.search-results-container {
  overflow-y: auto;
  flex: 1;
}

.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--search-muted);
  text-align: center;
  gap: 8px;
}

.search-empty .empty-icon { font-size: 32px; opacity: 0.5; }
.search-empty .empty-title { font-size: 15px; font-weight: 600; color: var(--search-text); }
.search-empty .empty-sub { font-size: 13px; }

.search-hint {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--search-border);
  color: var(--search-muted);
  font-size: 13px;
}
.search-hint kbd {
  background: var(--search-bg);
  border: 1px solid var(--search-border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
  font-family: monospace;
}

/* ── Result groups ─────────────────────────────────────────────────────── */

.result-group { border-bottom: 1px solid var(--search-border); }
.result-group:last-child { border-bottom: none; }

.result-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 8px;
  position: sticky;
  top: 0;
  background: var(--search-surface);
  z-index: 1;
}

.result-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--search-muted);
}

.result-group-count {
  font-size: 11px;
  color: var(--search-muted);
  background: var(--search-bg);
  border: 1px solid var(--search-border);
  border-radius: 99px;
  padding: 1px 7px;
}

.result-items { padding: 4px 12px 8px; }

.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--search-text);
  cursor: pointer;
  transition: background 0.1s;
  border: 1px solid transparent;
}

.result-item:hover, .result-item:focus {
  background: var(--search-bg);
  border-color: var(--search-border);
  outline: none;
}

.result-item .item-icon {
  font-size: 16px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--search-bg);
  border-radius: 6px;
  flex-shrink: 0;
}

.result-item .item-body { flex: 1; min-width: 0; }
.result-item .item-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-item .item-sub { font-size: 12px; color: var(--search-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Match highlight */
.mark {
  background: rgba(88, 166, 255, 0.25);
  color: var(--search-accent);
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Loading state ─────────────────────────────────────────────────────── */

.search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--search-muted);
  gap: 10px;
  font-size: 14px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--search-border);
  border-top-color: var(--search-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.search-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid var(--search-border);
  font-size: 12px;
  color: var(--search-muted);
}
.search-footer .footer-stats { display: flex; gap: 16px; }

/* ── Bulk action toolbar ──────────────────────────────────────────────── */

.bulk-toolbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--search-warning);
  color: #0d1117;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  animation: slideDown 0.15s ease;
}

.bulk-toolbar.visible { display: flex; }

.bulk-count {
  background: rgba(0,0,0,0.2);
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 12px;
}

.bulk-select-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.bulk-select-actions button {
  background: rgba(0,0,0,0.2);
  border: none;
  color: #0d1117;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s;
}
.bulk-select-actions button:hover { background: rgba(0,0,0,0.35); }

.bulk-danger { background: #f85149; color: #fff; margin-left: 4px; }
.bulk-danger:hover { background: #da3633; }

/* Table checkboxes */
.row-cb { width: 16px; height: 16px; cursor: pointer; accent-color: var(--search-accent); }
.select-all-cb { cursor: pointer; accent-color: var(--search-accent); }

/* Bulk confirm dialog */
.bulk-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bulk-confirm-modal {
  background: var(--search-surface);
  border: 1px solid var(--search-border);
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 24px 48px rgba(0,0,0,0.5);
}
.bulk-confirm-modal h3 { font-size: 17px; margin-bottom: 12px; color: var(--search-text); }
.bulk-confirm-modal p { font-size: 14px; color: var(--search-muted); margin-bottom: 24px; line-height: 1.5; }
.bulk-confirm-actions { display: flex; gap: 12px; justify-content: flex-end; }
.bulk-confirm-actions .btn-cancel {
  background: var(--search-bg);
  border: 1px solid var(--search-border);
  color: var(--search-text);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.bulk-confirm-actions .btn-confirm {
  background: #f85149;
  border: none;
  color: #fff;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.bulk-confirm-actions .btn-confirm:hover { background: #da3633; }

/* Progress toast */
.bulk-progress-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--search-surface);
  border: 1px solid var(--search-border);
  border-radius: 10px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--search-text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 10002;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Success/error toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--search-surface);
  border: 1px solid var(--search-border);
  border-radius: 10px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  z-index: 10003;
  animation: slideUp 0.2s ease;
  max-width: 360px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.toast.success { border-color: var(--search-success); color: var(--search-success); }
.toast.error { border-color: var(--search-danger); color: var(--search-danger); }