/* ── Hero ─────────────────────────────────────────────────────────────── */
.search-hero {
  padding: 72px 0 32px;
  text-align: center;
  transition: padding 0.2s;
}
.search-hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  transition: font-size 0.2s;
}
.search-subtitle {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 24px;
}
.has-results .search-hero {
  padding: 20px 0 16px;
}
.has-results .search-hero h1 {
  font-size: 1.3rem;
}
.has-results .search-subtitle {
  display: none;
}

.search-bar {
  display: flex;
  max-width: 640px;
  margin: 0 auto;
  gap: 8px;
}
.search-bar input {
  flex: 1;
  padding: 13px 18px;
  font-size: 16px;
  font-family: var(--font);
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-bar .btn { white-space: nowrap; }

/* ── Body ─────────────────────────────────────────────────────────────── */
.search-body {
  padding-bottom: 60px;
}

/* ── Toolbar (tabs + mobile filter toggle) ────────────────────────────── */
.search-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.entity-tabs {
  display: flex;
  gap: 0;
}
.tab {
  padding: 12px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
  outline: none;
}
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.filters-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s;
  white-space: nowrap;
}
.filters-toggle:hover { border-color: var(--accent); color: var(--accent); }
.filter-count {
  background: var(--accent);
  color: #0a0a10;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}

/* ── Filter chips ─────────────────────────────────────────────────────── */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0 0;
  min-height: 0;
}
.filter-chips:empty { padding: 0; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text);
  cursor: default;
}
.chip-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition: color 0.15s;
  display: flex;
  align-items: center;
}
.chip-remove:hover { color: var(--accent); }

/* ── Layout: sidebar + main ───────────────────────────────────────────── */
.search-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 28px;
  align-items: start;
  padding-top: 20px;
}

/* ── Sidebar filters ──────────────────────────────────────────────────── */
.search-sidebar {
  position: sticky;
  top: 68px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 14px;
  margin-bottom: 0;
}
.search-sidebar label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.search-sidebar input,
.search-sidebar select {
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}
.search-sidebar input:focus,
.search-sidebar select:focus {
  border-color: var(--accent);
}
.search-sidebar select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%237a7494' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}
.sidebar-clear {
  margin-top: 4px;
  width: 100%;
  font-size: 13px;
}

/* ── Results area ─────────────────────────────────────────────────────── */
.search-main {
  min-width: 0;
}

.results-summary {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
  min-height: 20px;
}
.results-summary strong { color: var(--text); }
.summary-more { color: var(--muted); font-style: italic; }

/* ── Result cards ─────────────────────────────────────────────────────── */
.result-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.result-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.result-item:last-child { border-bottom: none; }
.result-item:hover { background: rgba(255,255,255,0.025); }

.result-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.badge-cat {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
}
.badge-entity {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(245,158,11,0.12);
  color: var(--accent);
}
.badge-source {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
}
.badge-seao {
  background: rgba(96,165,250,0.1);
  color: #60a5fa;
}
.badge-alberta {
  background: rgba(251,191,36,0.1);
  color: #d97706;
}
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}
.badge-open {
  background: rgba(34,197,94,0.12);
  color: #22c55e;
}
.badge-closed {
  background: rgba(239,68,68,0.1);
  color: #f87171;
}
.badge-active {
  background: rgba(59,130,246,0.1);
  color: #60a5fa;
}

.result-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
  margin-bottom: 6px;
  transition: color 0.12s;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.result-item:hover .result-title,
.result-title:hover { color: var(--accent); }

.result-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 0;
  font-size: 12px;
  color: var(--muted);
}
.result-dept a,
.result-vendor a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.12s;
}
.result-dept a:hover,
.result-vendor a:hover { color: var(--accent); text-decoration: underline; }
.meta-sep { padding: 0 6px; color: var(--border-light); }
.result-value {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}
.result-date { margin-left: auto; white-space: nowrap; }
.result-expiry { color: var(--muted); font-size: 11px; margin-left: 8px; }
.result-commodity { font-size: 12px; color: var(--muted); margin: 2px 0 4px; }

/* ── Skeleton loading ─────────────────────────────────────────────────── */
.result-skeleton {
  pointer-events: none;
}
.skeleton-badges { display: flex; gap: 6px; margin-bottom: 8px; }
.skeleton-pill {
  height: 18px;
  width: 60px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--border) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.skeleton-title {
  height: 16px;
  width: 70%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--border) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  margin-bottom: 8px;
}
.skeleton-meta {
  height: 12px;
  width: 50%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--border) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Empty state ──────────────────────────────────────────────────────── */
.results-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}
.results-empty p { margin-bottom: 6px; font-size: 15px; }
.results-hint-sub { font-size: 13px; }

/* ── Pagination ───────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
}
.pagination button {
  padding: 8px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.pagination button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.pagination button:disabled {
  opacity: 0.3;
  cursor: default;
}
.page-info {
  color: var(--muted);
  font-size: 13px;
}

/* ── Nav active state ─────────────────────────────────────────────────── */
.nav-active { color: var(--text) !important; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .search-layout {
    grid-template-columns: 200px 1fr;
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .search-hero { padding: 60px 0 20px; }
  .search-hero h1 { font-size: 1.6rem; }
  .search-bar { flex-direction: column; }
  .search-bar .btn { width: 100%; }

  .search-toolbar { padding: 8px 0; }
  .filters-toggle { display: flex; }

  .search-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 12px;
  }

  .search-sidebar {
    position: static;
    display: none;
    border-radius: 10px;
    margin-bottom: 16px;
  }
  .search-sidebar.open { display: flex; }

  .result-date { margin-left: 0; }
}

/* ── Department autocomplete ──────────────────────────────────────────── */
.dept-wrap { position: relative; }
.dept-suggestions {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 4px 0 0;
  padding: 4px 0;
  list-style: none;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  max-height: 260px;
  overflow-y: auto;
}
.dept-suggestions.open { display: block; }
.dept-suggestions li {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.dept-suggestions li:hover,
.dept-suggestions li.active { background: rgba(255,255,255,0.06); }
.dept-suggestions li .dept-name { flex: 1; min-width: 0; line-height: 1.4; }

@media (max-width: 480px) {
  .entity-tabs { overflow-x: auto; }
  .tab { padding: 10px 14px; font-size: 13px; }
}
