/* =============================================================================
   1) COMPONENTS (shared across the search UI)
============================================================================= */

/* Card */
.card {
  border: 1px solid #d1d7db;
}

/* Buttons */
.btn-light-grey {
  background-color: #f8f9fa;
  color: #212529;
  border: 1px solid #ced4da;
}

.btn-light-grey:hover {
  background-color: #e2e6ea;
  border-color: #bfc5ca;
  color: #212529;
}

.btn-light-grey:active { background-color: #ced4da !important; }

.btn-light-grey:focus,
.btn-light-grey:active,
.btn-light-grey.active {
  z-index: auto !important;
  border: 1px solid #ced4da !important;
}

.btn-outline-primary.soft-hover:hover,
.btn-outline-primary.soft-hover.show,
.btn-outline-primary.soft-hover:active,
.btn-outline-primary.soft-hover:focus-visible {
  background-color: #e7f1ff !important;
  color: #0d6efd !important;
  border-color: #0d6efd !important;
}

.btn-outline-danger.soft-hover:hover,
.btn-outline-danger.soft-hover.show,
.btn-outline-danger.soft-hover:active,
.btn-outline-danger.soft-hover:focus-visible {
  background-color: #fcebea !important;
  color: #dc3545 !important;
  border-color: #dc3545 !important;
}

.btn-outline-secondary.soft-hover:hover,
.btn-outline-secondary.soft-hover.show,
.btn-outline-secondary.soft-hover:active,
.btn-outline-secondary.soft-hover:focus-visible {
  background-color: #f2f2f2 !important;
  color: #6c757d !important;
  border-color: #6c757d !important;
}


.btn-active {
  background-color: #ced4da !important;
  color: #000 !important;
  border-color: #ced4da !important;
}

/* Forms & dropdowns */
#searchInput::placeholder { color: #6c757d; opacity: 0.6; }
.form-control::placeholder { color: #212529; opacity: 1; }

.dropdown-menu {
  z-index: 1050 !important;
}

.autocomplete-suggestions {
  background-color: #fff;
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
  z-index: 1050;
  box-sizing: border-box;
}

.list-group-item.active,
.dropdown-item:hover,
.dropdown-item:focus,
.dropdown-item:focus-visible,
.dropdown-item:active {
  color: #212529;
  background-color: #f8f9fa;
  box-shadow: none !important;
  outline: none !important;
  border-color: #dee2e6 !important;
}

/* Tables (used by result_detail_template) */
.rounded-table {
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  overflow: hidden;
  margin: 0;
  padding: 0;
  background: #fff;
}

.rounded-table table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin: 0;
  table-layout: fixed;
}

.rounded-table th,
.rounded-table td {
  width: 50%;
  padding: 0.375rem 0.75rem;
  vertical-align: top;
  word-break: break-word;
}

.rounded-table thead th {
  background-color: #f8f9fa;
  color: #212529;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid #dee2e6;
  border-right: 1px solid #dee2e6;
}

.rounded-table thead th:last-child { border-right: none; }
.rounded-table tbody td:first-child {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #212529;
  border-right: 1px solid #dee2e6;
}

.rounded-table tbody td:last-child { word-break: break-word; }
.rounded-table tbody tr:last-child td,
.rounded-table tbody tr:last-child th { border-bottom: none; }

.rhetoric-value-cell a {
  display: inline-block;
  max-width: 30ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  text-decoration: none;
}

.rhetoric-value-cell a:hover {
  color: #0d6efd;
  text-decoration: underline;
}

/* Charts */
canvas { cursor: pointer; }
#partyShareBar { border-radius: 6px; }
.rounded-bar-container { border-radius: 6px; overflow: hidden; height: 20px; }
.histogram-canvas-container { height: 300px; }
.party-share-bar-container { height: 20px; }

/* Selection popover */
.selection-actions { z-index: 10; }

/* Little interaction helpers */
[role="button"] { cursor: pointer; transition: all 0.12s ease-in-out; }


/* =============================================================================
   2) index.html (search page)
============================================================================= */

/* Search cards strip */
.search-cards-strip {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 4px 2px;
  scroll-snap-type: none;
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}

.search-cards-strip::-webkit-scrollbar { display: none; }

.sc-item { flex: 0 0 260px; width: 260px; }

.search-card {
  cursor: pointer;
  height: 100px; /* Was 135px, change back to show tags */
  transition: box-shadow .15s, transform .15s;
  background-color: #fff;
}

.search-card:hover {
  box-shadow: 0 .5rem 1rem rgba(0,0,0,.08);
  transform: translateY(-1px);
}

.search-card .card-body {
  height: 100%;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
}

.sc-title {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.sc-title-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-subtitle {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
  margin-bottom: 8px;
  min-height: calc(1em * 1.35 * 2);
}

/* .sc-tags {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 64px;
  overflow: hidden;
} */

/* .search-card .badge {
  display: inline-block;
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: .6rem;
  padding: .35rem .6rem;
  font-size: .825rem;
  font-weight: 600;
  white-space: nowrap;
} */

/* Search info panel + cards */
.small-card,
.card.search,
#chartsPanel,
#searchInfoPanel {
  background-color: #fff;
  transition: box-shadow 0.3s ease, opacity 0.4s ease, transform 0.4s ease;
}

.card.selected {
  box-shadow: 0 0 0 1px #0d6efd, 0 0 6px 2px rgba(13,110,253,0.2) !important;
  z-index: 1;
}

.fade-in { opacity: 0; transform: translateY(20px); }
.fade-in.show { opacity: 1; transform: none; }

/* Badges & triggers */
.badge:hover { filter: brightness(1.08); }
.badge.bg-light:hover { filter: brightness(0.96); }
.badge.bg-dark:hover { filter: brightness(1.12); }

.badge.fix-icon {
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.badge.fix-icon i { font-size: 0.9em; line-height: 1; }
.inline-check-icon { position: relative; top: 0.0375rem; }

.btn-group .badge { border-radius: 0 !important; }
.btn-group .badge:first-child {
  border-top-left-radius: 0.375rem !important;
  border-bottom-left-radius: 0.375rem !important;
  margin-right: -1px !important;
}

.btn-group .badge:last-child {
  border-top-right-radius: 0.375rem !important;
  border-bottom-right-radius: 0.375rem !important;
}

/* Custom Bootstrap tooltip styling for rhetoric badges */
.tooltip {
  font-size: 0.875rem;
}

.tooltip-inner {
  padding: 10px !important;
  line-height: 1.3 !important;
  max-width: 220px;
  text-align: center;
}

.search-filter-trigger:not(.badge),
.action-link,
span[data-copy-target] { 
  text-decoration: none; 
  color: inherit;
}

.search-filter-trigger:not(.badge):hover,
.action-link:hover,
span[data-copy-target]:hover { 
  text-decoration: underline !important; 
  color: inherit !important;
}

/* Optional typography for card headers only (avoid global heading overrides) */
.card-head { font-size: 1.2rem; }

/* Ensure chart titles match filter headers exactly - no overrides */
#histogramSection h6.fw-semibold,
#partyShareSection h6.fw-semibold {
  font-size: inherit !important;
  font-weight: 600 !important;
  line-height: inherit !important;
  color: inherit !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Improved disabled button styling for history navigation */
.btn-light-grey:disabled,
.btn-light-grey.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #f8f9fa;
  border-color: #ced4da;
  color: #6c757d;
}



/* =============================================================================
   3) Templates
   - result_card_template.html
   - result_detail_template.html
   - search_card_template.html
============================================================================= */


.table-url { word-break: break-all; text-decoration: none; }
.table-url:hover { text-decoration: underline; }


/* =============================================================================
   Header & Footer (header.html + footer.html)
   Scoped tweaks to preserve original UIkit look and your typography.
============================================================================= */

/* navbar items (header + footer) */
.site-header .uk-navbar-item,
.site-header .uk-navbar-nav > li > a,
.site-footer .uk-navbar-item,
.site-footer .uk-navbar-nav > li > a {
  font: inherit;
  text-transform: none;
}

.uk-navbar-nav > li > a,
.uk-navbar-item {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  text-transform: none;
  font-size: 17px;
}

/* h5 sizing (header + footer) */
.site-header .uk-h5,
.site-header h5,
.site-footer .uk-h5,
.site-footer h5 {
  font-size: 16px;
  line-height: 1.4;
  font-weight: 400;
}

/* links (header + footer) */
.site-header .uk-link,
.site-header a,
.site-footer .uk-link,
.site-footer a {
  text-decoration: none;
}

/* removed-inline helpers (header) */
.site-header .site-logo { height: 45px; }
.site-header .mobile-subitem { padding-left: 15px; }

/* footer layout/typography */
.site-footer { margin-top: 45vh; } /* probably not the best way to do this */
.site-footer .uk-grid.uk-grid-large { line-height: 1.5; }
.site-footer h5 { margin-bottom: 20px; }
.site-footer p { margin: 0 0 20px; }

/* footer social icon color + svg inheritance */
.site-footer .footer-social a.uk-icon-button { color: #ffffff80; }
.site-footer .footer-social svg path { fill: currentColor; }

/* footer link hover underline */
.site-footer a.uk-link-muted:hover,
.site-footer .footer-aux-links a:hover {
  text-decoration: underline;
}

/* =============================================================================
   LOADING SCREEN
============================================================================= */

.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
}

.loading-content .spinner-border {
  width: 3rem;
  height: 3rem;
}

/* =============================================================================
   FILTER ANIMATIONS
============================================================================= */

.filter-updated {
  background-color: #e3f2fd !important;
  border-color: #2196f3 !important;
  transition: background-color 0.6s ease, border-color 0.6s ease;
}

.filter-updated.fade-out {
  background-color: transparent !important;
  border-color: #dee2e6 !important;
}

/* =============================================================================
  NOTIFICATIONS
============================================================================= */

#backToTopBtn {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1050;
}

#exportNotification {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 1050;
}

.dartmouth-notification {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 1050;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  cursor: pointer;
  user-select: none;
}

.dartmouth-notification .btn {
  background-color: #00693e;
  border-color: #00693e;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dartmouth-notification .btn:hover {
  background-color: #004d2a;
  border-color: #004d2a;
  color: #ffffff;
}

.dartmouth-notification.show {
  opacity: 1;
  transform: translateY(0);
}

.dartmouth-notification.hide {
  opacity: 0;
  transform: translateY(-20px);
}
