/* ─── Top bar ─── */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.top-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-logo {
  height: 40px;
  width: auto;
  border-radius: 4px;
}

.site-title-lockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

#topbar h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #a0a0a0 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.program-updated-label {
  font-size: 0.56rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(214, 225, 241, 0.72);
  white-space: nowrap;
}

.clearable-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.input-clear-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: none;
  background: rgba(159, 179, 206, 0.14);
  color: rgba(223, 232, 246, 0.78);
  font-size: 0.58rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .15s, visibility .15s, background .15s, color .15s;
}

.clearable-input-wrap.has-value .input-clear-btn {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.input-clear-btn:hover {
  background: rgba(255, 95, 5, 0.18);
  color: #fff;
}

/* ─── Topbar search separator ─── */
.topbar-sep {
  width: 1px;
  height: 18px;
  background: rgba(159, 179, 206, 0.25);
  flex-shrink: 0;
}

/* ─── Search results cap ─── */
#search-results {
  max-width: min(66vw, 680px);
}

/* ─── Footer ─── */
#app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 20px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  font-size: .68rem;
  color: var(--text-dim);
  z-index: 800;
  gap: 4px;
  pointer-events: none;
}

#app-footer a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color .15s;
  pointer-events: all;
}

#app-footer a:hover {
  color: var(--text);
}

/* ─── Consistent close buttons ─── */
#panel-close, #ride-close, #book-panel-close,
#meetup-close, #modal-close, #concurrent-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  font-size: .75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}

#panel-close:hover, #ride-close:hover, #book-panel-close:hover,
#meetup-close:hover, #modal-close:hover, #concurrent-close:hover {
  background: rgba(255, 95, 5, 0.12);
  color: var(--accent);
}

/* ─── Primary / ghost button utilities ─── */
.btn-primary,
#ride-save-btn, #meetup-add-cluster-btn, #tut-next-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .15s;
}

.btn-primary:hover,
#ride-save-btn:hover, #meetup-add-cluster-btn:hover, #tut-next-btn:hover {
  opacity: .88;
  transform: translateY(-1px);
}

.btn-ghost,
#book-download-btn, #tut-skip-btn, #tut-prev-btn, #meetup-navigate-btn {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 13px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.btn-ghost:hover,
#book-download-btn:hover, #tut-skip-btn:hover, #tut-prev-btn:hover, #meetup-navigate-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  background: rgba(255, 95, 5, 0.15);
  color: var(--accent);
  border-radius: 6px;
  border: 1px solid rgba(255, 95, 5, 0.2);
}

/* ─── Domain filter bar ─── */
#domain-filter-area {
  flex: 1;
  margin: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#topic-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}

#topic-input {
  width: 100%;
  padding: 6px 24px 8px 2px;
  border: none;
  border-bottom: 2px solid rgba(159, 179, 206, 0.35);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: .78rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}

#topic-input:focus {
  border-color: var(--accent);
  box-shadow: inset 0 -1px 0 rgba(255, 95, 5, 0.18);
}

#topic-input.has-selection {
  border-color: var(--accent);
  box-shadow: inset 0 -1px 0 rgba(255, 95, 5, 0.18);
}

#topic-input::placeholder {
  color: var(--text-dim);
}

#domain-dropdown {
  position: fixed;
  top: 0;
  left: 0;
  width: min(380px, calc(100vw - 16px));
  max-height: 340px;
  display: none;
  flex-direction: column;
  background: rgba(19, 41, 75, 0.6);
  border: 1px solid rgba(44, 78, 138, 0.4);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 2100;
  overflow: hidden;
}

#domain-dropdown.open {
  display: flex;
}

#domain-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(44, 78, 138, 0.3);
  background: rgba(19, 41, 75, 0.5);
  flex-shrink: 0;
}

#domain-count-label {
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-dim);
  transition: color .15s;
}

#domain-status-bar.has-selection #domain-count-label {
  color: var(--accent);
}

#domain-clear-btn {
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: .65rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

#domain-clear-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 95, 5, .06);
}

#domain-list {
  overflow-y: auto;
  padding: 4px 8px 8px;
  flex: 1;
}

#domain-list::-webkit-scrollbar {
  width: 4px;
}

#domain-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.domain-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .12s;
}

.domain-check-item:hover {
  background: var(--surface-2);
}

.domain-check-item.auto-matched {
  background: rgba(255, 95, 5, .07);
}

.domain-check-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border: 1.5px solid rgba(100, 140, 200, 0.3);
  border-radius: 3px;
  background: rgba(29, 59, 107, 0.3);
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: all .15s;
}

.domain-check-item input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.domain-check-item input[type="checkbox"]:checked::after {
  content: '\2713';
  position: absolute;
  top: -2px;
  left: 1px;
  font-size: 9px;
  color: #fff;
  line-height: 1;
  font-weight: 700;
}

.domain-check-item label {
  cursor: pointer;
  font-size: .72rem;
  color: var(--text);
  flex: 1;
  line-height: 1.3;
}

.domain-check-item .domain-label-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.domain-days {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.domain-day-pill {
  font-size: .55rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(44, 78, 138, .45);
  color: var(--text-dim);
  white-space: nowrap;
  letter-spacing: .02em;
}
