/* Summary bar */
.summary-bar {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  padding: 1rem;
  background: var(--pico-card-background-color);
  border-radius: var(--pico-border-radius);
  margin-bottom: 1.5rem;
}

.summary-stat {
  text-align: center;
}

.summary-stat .value {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--pico-primary);
}

.summary-stat .label {
  font-size: 0.85rem;
  opacity: 0.7;
}

/* Table wrappers */
.table-wrapper {
  overflow-x: auto;
}

/* Sortable table headers */
.sortable-table th[data-sort] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sortable-table th[data-sort]::after {
  content: ' \2195';
  opacity: 0.3;
  font-size: 0.8em;
}

.sortable-table th[data-sort].sort-asc::after {
  content: ' \2191';
  opacity: 1;
}

.sortable-table th[data-sort].sort-desc::after {
  content: ' \2193';
  opacity: 1;
}

/* Inline bar chart */
.bar-cell {
  position: relative;
  min-width: 120px;
}

.bar-fill {
  display: inline-block;
  height: 1.2em;
  background: var(--pico-primary);
  border-radius: 2px;
  opacity: 0.6;
  vertical-align: middle;
  margin-right: 0.5em;
  min-width: 2px;
}

/* Frequency color coding */
.freq-high {
  background-color: rgba(76, 175, 80, 0.15);
}

.freq-med {
  background-color: rgba(255, 193, 7, 0.15);
}

.freq-low {
  background-color: rgba(244, 67, 54, 0.1);
}

/* Clickable card names */
.card-link {
  cursor: pointer;
  text-decoration: underline;
  color: var(--pico-primary);
}

.card-link:hover {
  opacity: 0.8;
}

/* Compact table for tech cards */
.compact-table td,
.compact-table th {
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
}

/* Sticky header for scrollable tables */
.sticky-header thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--pico-card-background-color);
}

/* Tab buttons */
#globalCardTabs {
  margin-bottom: 1rem;
}

.tab-btn {
  margin: 0;
}

.tab-btn:not(.active) {
  --pico-background-color: transparent;
  --pico-color: var(--pico-primary);
  border: 1px solid var(--pico-primary);
}

/* Archetype name in table - clickable */
.archetype-link {
  cursor: pointer;
  color: var(--pico-primary);
  text-decoration: underline;
}

.archetype-link:hover {
  opacity: 0.8;
}

/* Filter input for tech cards */
.filter-input {
  margin-bottom: 0.5rem;
  max-width: 300px;
}

/* Deep dive sub-sections */
.deep-dive-section {
  margin-top: 1.5rem;
}

.deep-dive-section h4 {
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
  padding-bottom: 0.3rem;
}

/* Dialog tweaks */
#cardDrilldown article {
  max-width: 900px;
  max-height: 80vh;
  overflow-y: auto;
}

#drilldownCardInfo {
  opacity: 0.7;
}

/* Loading state */
#loadingStatus {
  display: block;
  margin-top: 0.5rem;
  opacity: 0.7;
}

/* Error display */
#errorDisplay {
  padding: 1rem;
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid rgba(244, 67, 54, 0.3);
  border-radius: var(--pico-border-radius);
  margin-bottom: 1rem;
}

/* Small info text */
.info-text {
  font-size: 0.85rem;
  opacity: 0.6;
  margin-bottom: 0.5rem;
}

/* Section nav */
.section-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 0;
  background: var(--pico-background-color);
  border-bottom: 1px solid var(--pico-muted-border-color);
  padding: 0;
  margin: 0 0 1.5rem 0;
}

.section-nav .nav-link {
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--pico-muted-color);
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.section-nav .nav-link:hover {
  color: var(--pico-color);
}

.section-nav .nav-link.active {
  color: var(--pico-primary);
  border-bottom-color: var(--pico-primary);
}

/* Collapsible sections */
details > summary {
  cursor: pointer;
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary h2 {
  display: inline;
  margin: 0;
}

details > summary h2::before {
  content: '\25BC';
  font-size: 0.7em;
  margin-right: 0.5rem;
  opacity: 0.5;
  display: inline-block;
  transition: transform 0.15s;
}

details:not([open]) > summary h2::before {
  transform: rotate(-90deg);
}

details {
  margin-bottom: 1.5rem;
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 20;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Cross-page nav */
.page-nav {
  display: flex;
  gap: 1.5rem;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.page-nav a {
  text-decoration: none;
  color: var(--pico-muted-color);
  font-size: 0.9rem;
}

.page-nav a.active {
  color: var(--pico-primary);
  font-weight: bold;
}

.page-nav a:hover {
  color: var(--pico-color);
}

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-top: 0.5rem;
}

.drop-zone.drag-over {
  border-color: var(--pico-primary);
  background: rgba(76, 175, 80, 0.05);
}

.drop-zone p {
  margin: 0;
  opacity: 0.6;
}

/* Deck grid */
.deck-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.deck-card {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  background: var(--pico-card-background-color);
  border-radius: var(--pico-border-radius);
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 0.15s;
}

.deck-card:hover {
  border-color: var(--pico-primary);
}

.deck-card .card-count {
  background: var(--pico-primary);
  color: var(--pico-primary-inverse);
  border-radius: 50%;
  width: 1.3rem;
  height: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
}

/* Combo builder */
.combo-panel {
  background: var(--pico-card-background-color);
  border-radius: var(--pico-border-radius);
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--pico-muted-border-color);
}

.combo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.combo-header input {
  margin: 0;
  padding: 0.2rem 0.5rem;
  font-size: 0.9rem;
  max-width: 200px;
}

.combo-reqs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  min-height: 2rem;
}

.combo-req {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  background: rgba(76, 175, 80, 0.15);
  border-radius: var(--pico-border-radius);
  font-size: 0.85rem;
}

.combo-req select {
  margin: 0;
  padding: 0.1rem 0.3rem;
  font-size: 0.8rem;
  width: 3rem;
  height: auto;
}

.combo-req .remove-req {
  cursor: pointer;
  opacity: 0.6;
  font-size: 1rem;
  line-height: 1;
  background: none;
  border: none;
  color: inherit;
  padding: 0 0.2rem;
  margin: 0;
  width: auto;
}

.combo-req .remove-req:hover {
  opacity: 1;
}

.combo-add-card {
  margin: 0;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  width: auto;
  height: auto;
}

.remove-combo {
  margin: 0;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  width: auto;
  height: auto;
}

/* Probability display */
.results-display {
  text-align: center;
  padding: 1.5rem;
  background: var(--pico-card-background-color);
  border-radius: var(--pico-border-radius);
}

.probability-main {
  margin-bottom: 1.5rem;
}

.probability-value {
  font-size: 3rem;
  font-weight: bold;
  color: var(--pico-primary);
}

.probability-label {
  font-size: 0.9rem;
  opacity: 0.7;
}

#methodIndicator {
  opacity: 0.5;
  font-size: 0.8rem;
}

.per-combo-table {
  text-align: left;
  margin: 0 auto;
  max-width: 500px;
}

.per-combo-table td {
  padding: 0.3rem 0.8rem;
}

.per-combo-table .combo-prob {
  font-weight: bold;
  text-align: right;
}

/* Import warnings */
#importWarnings {
  padding: 0.5rem 1rem;
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: var(--pico-border-radius);
  margin-top: 0.5rem;
  font-size: 0.85rem;
}
