/* SmartSearchBar — built to play nice with themes (uses CSS variables with fallbacks) */

:root {
  --sw-panel-bg: rgba(7, 10, 14, 0.88);
  --sw-panel-border: rgba(255, 255, 255, 0.14);
  --sw-panel-bg-2: rgba(8, 11, 18, 0.95);
  --sw-chip-bg: rgba(255, 255, 255, 0.08);
  --sw-text: rgba(255, 255, 255, 0.92);
  --sw-muted: rgba(255, 255, 255, 0.6);
  --sw-hover: rgba(255, 255, 255, 0.08);
  --sw-danger: #ff6b6b;
}

body[data-theme="blue"] {
  --sw-panel-bg: rgba(6, 10, 22, 0.86);
  --sw-panel-border: rgba(56, 189, 248, 0.45);
  --sw-panel-bg-2: rgba(5, 7, 15, 0.97);
  --sw-chip-bg: rgba(56, 189, 248, 0.18);
  --sw-text: #e3f3ff;
  --sw-muted: rgba(226, 239, 255, 0.82);
  --sw-hover: rgba(56, 189, 248, 0.15);
}

body[data-theme="light"] {
  --sw-panel-bg: rgba(255, 255, 255, 0.92);
  --sw-panel-border: rgba(148, 163, 184, 0.72);
  --sw-panel-bg-2: rgba(255, 255, 255, 0.98);
  --sw-chip-bg: rgba(148, 163, 184, 0.2);
  --sw-text: #0b1220;
  --sw-muted: rgba(91, 103, 122, 0.85);
  --sw-hover: rgba(15, 23, 42, 0.08);
}

.sw-search {
  position: relative;
  width: min(580px, 100%);
  max-width: 580px;
  flex: 1 1 auto;
  min-width: 0;
}

.sw-search-row{
  display: flex;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
}

.sw-search__side{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 14px;
  background: var(--sw-panel-bg, rgba(15, 18, 28, 0.62));
  border: 1px solid var(--sw-panel-border, rgba(255, 255, 255, 0.10));
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.sw-search__bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;

  border-radius: 14px;
  padding: 8px 10px;

  background: var(--sw-panel-bg, rgba(15, 18, 28, 0.62));
  border: 1px solid var(--sw-panel-border, rgba(255, 255, 255, 0.10));
  backdrop-filter: blur(10px);
}

.sw-search__bar{
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}
.sw-search__side{
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
  box-shadow: inset 1px 0 0 rgba(255,255,255,0.08);
}

.sw-search__bar{
  border-right: 1px solid rgba(255,255,255,0.18);
}

.sw-search__input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;

  color: var(--sw-text, rgba(255,255,255,0.92));
  font-size: 14px;
  padding: 2px 4px;
}

.sw-search__input::placeholder {
  color: var(--sw-muted, rgba(255,255,255,0.55));
}

.sw-search__clearBtn {
  border: 0;
  outline: 0;
  cursor: pointer;
  background: transparent;
  color: var(--sw-muted, rgba(255,255,255,0.60));
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.sw-search__clearBtn:hover {
  color: var(--sw-text, rgba(255,255,255,0.92));
}

.sw-search__clearBtn:active {
  transform: scale(0.95);
}

.sw-search__icons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: -6px;
}

.sw-search__icons .sw-search__iconBtn:first-child{
  margin-left: -2px;
}

.sw-search__iconBtn {
  border: 0;
  outline: 0;
  cursor: pointer;

  width: 34px;
  height: 34px;
  border-radius: 12px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: var(--sw-chip-bg, rgba(255,255,255,0.08));
  color: var(--sw-text, rgba(255,255,255,0.92));
}

.sw-search__iconBtn.is-active {
  background: linear-gradient(135deg, rgba(56,189,248,0.9), rgba(34,211,238,0.9));
  color: #0b1220;
}

.sw-search__iconBtn:active {
  transform: translateY(1px);
}

.sw-search__dropdown {
  position: absolute;
  z-index: 9999;
  left: 0;
  right: 0;
  margin-top: 8px;

  border-radius: 14px;
  overflow: hidden;

  background: var(--sw-panel-bg-2, rgba(12, 14, 22, 0.80));
  border: 1px solid var(--sw-panel-border, rgba(255, 255, 255, 0.10));
  backdrop-filter: blur(12px);

  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.sw-search__dropdown::-webkit-scrollbar {
  width: 6px;
}

.sw-search__dropdown::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
}

.sw-search__row {
  padding: 10px 12px;
  text-align: left;
}

.sw-search__item {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.sw-search__item:hover,
.sw-search__item.is-active {
  background: var(--sw-hover, rgba(255,255,255,0.08));
}

.sw-search__title {
  color: var(--sw-text, rgba(255,255,255,0.92));
  font-size: 13.5px;
  line-height: 1.2;
}

.sw-search__sub {
  margin-top: 2px;
  color: var(--sw-muted, rgba(255,255,255,0.60));
  font-size: 12px;
}
.sw-search__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.sw-search__tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.88);
  letter-spacing: 0.2px;
}

.sw-search__muted {
  color: var(--sw-muted, rgba(255,255,255,0.60));
  font-size: 12.5px;
}

.sw-search__error {
  color: var(--sw-danger, #ff6b6b);
  font-size: 12.5px;
}

/* Time filter chips */
.sw-time-chips {
  display: flex;
  gap: 3px;
}

.sw-time-chip {
  border: none;
  outline: none;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--sw-chip-bg, rgba(255,255,255,0.08));
  color: var(--sw-muted, rgba(255,255,255,0.7));
  font-size: 11px;
  font-weight: 700;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.sw-time-chip:hover {
  background: rgba(59, 130, 246, 0.25);
  color: var(--sw-text, #fff);
}

.sw-time-chip.is-active {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.sw-time-chip:active {
  transform: scale(0.95);
}

body[data-theme="light"] .sw-time-chip {
  background: rgba(148, 163, 184, 0.2);
  color: #475569;
}

body[data-theme="light"] .sw-time-chip:hover {
  background: rgba(59, 130, 246, 0.15);
  color: #1e40af;
}

body[data-theme="light"] .sw-time-chip.is-active {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
}
