/* ==========================================================================
   Theme Fixes — Cross-theme compatibility patches
   Must load LAST to override component styles where needed.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Input Group Borders — Fix clipping in dark themes (Slate, Quartz)
   --------------------------------------------------------------------------- */

.input-group > .form-control {
  border-right: var(--bs-border-width, 1px) solid var(--app-border-primary) !important;
}

.input-group > .form-control:focus {
  border-right: var(--bs-border-width, 1px) solid var(--app-primary) !important;
  box-shadow: none !important;
}

/* ---------------------------------------------------------------------------
   Search Input Corners — Consistent when clear button is hidden/shown
   --------------------------------------------------------------------------- */

#searchInput {
  border-top-right-radius: var(--bs-border-radius, 0.375rem) !important;
  border-bottom-right-radius: var(--bs-border-radius, 0.375rem) !important;
}

/* When clear button is visible, restore normal input-group styling */
.input-group:has(.clear-search-visible) #searchInput {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

/* ---------------------------------------------------------------------------
   Collapse Button Alignment — Fix vertical centering in Lux and similar
   --------------------------------------------------------------------------- */

#collapseResearchBtn,
#collapseResultsBtn {
  align-self: center !important;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------------
   Header Height Matching — Align recent research header with tab header
   --------------------------------------------------------------------------- */

#recentResearchHeader {
  min-height: 3rem !important;
  padding-top: var(--spacing-sm) !important;
  padding-bottom: var(--spacing-sm) !important;
}

#resultsPanel > .card > .card-header {
  padding-bottom: 0 !important;
}

/* ---------------------------------------------------------------------------
   Tab Styling Fixes
   --------------------------------------------------------------------------- */

#researchTabs.nav-tabs {
  margin-bottom: 0;
}

/* Fix tab puffiness in Quartz theme and similar */
.nav-tabs .nav-link {
  padding: var(--spacing-sm) var(--spacing-md) !important;
  line-height: 1.3 !important;
}

.nav-tabs .nav-link .tab-text {
  margin: 0 !important;
}

/* ---------------------------------------------------------------------------
   Table Contrast — Ensure proper text contrast in dark themes (Darkly, etc.)
   --------------------------------------------------------------------------- */

.table td,
.table th {
  color: var(--app-text-primary) !important;
  border-color: var(--app-border-primary) !important;
  word-wrap: break-word !important;
  word-break: break-word !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
}

.table-hover tbody tr:hover {
  background-color: var(--bs-table-hover-bg, rgba(0, 0, 0, 0.075)) !important;
  color: var(--app-text-primary) !important;
}
