/* dash-tabs.css — VERBATIM port of legacy panel selector + global search.
   Sources:
     legacy dashboard-layout.css :67-95    (.dash-tabs / .dash-tab)
     legacy components-misc.css  :310-328  (.dash-tab extras + tab-panel anim)
     legacy responsive.css       :1-126    (mobile dash-tabs + dropdown)
     legacy dashboard-widgets.css :3-70    (.dash-search + results dropdown)
   Variables (--white, --gray-100, --text-light, --primary, --primary-light,
   --bg-hover, --warning-bg) are aliased in tokens.css to the new tokens,
   so the legacy property values are reproduced exactly without rewrites. */

/* ===== Global search box (.dash-search) ===== */
.dash-search {
  position: relative;
  margin: 0 1.5rem;
  flex: 1;
  max-width: 360px;
}
.dash-search input {
  width: 100%;
  padding: 0.45rem 0.9rem 0.45rem 2.2rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
  font-size: 0.85rem;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
  font-family: inherit;
}
.dash-search input::placeholder { color: rgba(255, 255, 255, 0.6); }
.dash-search input:focus {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}
.dash-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  pointer-events: none;
}
.search-results-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  max-height: 320px;
  overflow-y: auto;
  z-index: 1100;
  margin-top: 0.3rem;
}
.search-results-dropdown.active { display: block; }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--gray-100);
  color: var(--text);
  font-size: 0.85rem;
  width: 100%;
  text-align: left;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}
.search-result-item:hover { background: var(--primary-light); }
.search-result-item:last-child { border-bottom: none; }
.search-result-type {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  white-space: nowrap;
}
.search-result-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-text mark {
  background: rgba(243, 156, 18, 0.25);
  color: var(--text);
  border-radius: 2px;
  padding: 0 1px;
}
.search-no-results {
  padding: 0.8rem 1rem;
  color: var(--text-light);
  font-size: 0.85rem;
  text-align: center;
}
.search-result-answer {
  padding: 0.9rem 1rem;
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.5;
}
.search-result-sources {
  padding: 0.5rem 1rem 0.9rem;
  font-size: 0.72rem;
  color: var(--text-light);
}
.search-score {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
}


/* ===== Tab strip ===== */
.dash-tabs {
  margin-top: 64px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: center;
  gap: 0;
  position: sticky;
  top: 64px;
  z-index: 999;
}

.dash-tab {
  position: relative;
  padding: 0.9rem 1.5rem;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-light);
  border-bottom: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s, background 0.15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}

.dash-tab:hover { color: var(--primary); }

.dash-tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  border-radius: 4px 4px 0 0;
}

.dash-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
  background: var(--primary-light);
}

/* ===== Panel fade-in animation when switching tabs ===== */
.tab-panel,
.panel {
  animation: tabFadeIn 0.25s ease;
}
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Mobile tab dropdown (port of responsive.css :73-126) ===== */
.dash-tabs-mobile-toggle { display: none; }

@media (max-width: 768px) {
  .dash-tabs-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0;
    padding: 0.75rem 1rem;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    position: sticky;
    top: 0;
    z-index: 1000;
  }
  .dash-tabs-mobile-toggle svg {
    transition: transform 0.2s;
    flex-shrink: 0;
    margin-left: 0.5rem;
  }

  .dash-tabs {
    display: none;
    flex-direction: column;
    background: var(--white);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 999;
    margin-top: 0;
    border-bottom: 1px solid var(--gray-100);
    max-height: 60vh;
    overflow-y: auto;
    position: sticky;
    top: 46px;
  }
  .dash-tabs.mobile-open { display: flex; }

  .dash-tab {
    white-space: nowrap;
    padding: 0.75rem 1.25rem;
    text-align: left;
    border-bottom: none;
    border-left: 3px solid transparent;
    font-size: 0.88rem;
  }
  .dash-tab:hover { background: var(--bg-hover); }
  .dash-tab.active {
    border-bottom: none;
    border-left-color: var(--primary);
    background: var(--primary-light);
  }
}
