/* ===== Right Panel Layout ===== */
#panel {
  margin-left: auto;
  width: 360px;
  flex: 0 0 360px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  border-left: 1px solid #eee;
  box-sizing: border-box;
  background: #fff;
  position: relative;
  z-index: 2;
}

#panel header {
  padding: 0 10px 8px 10px;
  border-bottom: 1px solid #eee;
  margin-bottom: 8px;
}

#details {
  flex: 1 1 auto;
  min-height: 140px;
  height: auto;
  overflow: auto;
  padding: 0 10px;
}

/* Filter section: tabs + panes + toolbar */
#filter-container {
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  min-height: auto;
  padding-top: 8px;
}

#filter-container>div:first-child {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Tabs */
.tab {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
}

.tab.active {
  background: #f5f5f5;
  border-color: #aaa;
  font-weight: 600;
}

/* Panes */
.pane {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.pane.hidden {
  visibility: hidden;
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pane.active {
  visibility: visible;
  position: relative;
}

/* Toolbar pinned under panes */
#toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid #eee;
  margin-top: 8px;
}

#resetBtn {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
}

/* Legend */
#legend .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: -1px;
}

/* Badges in details panel */
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border: 1px solid var(--brand-accent);
  border-radius: 999px;
  font-size: 11px;
  color: var(--brand-ink);
  background: rgba(0, 229, 255, 0.10);
  box-shadow: 0 0 8px 0 rgba(0, 229, 255, 0.18);
  letter-spacing: 0.03em;
}

.section-title {
  margin: 8px 0 4px;
  font-weight: 600;
  color: #fff;
}

/* Filters layout */
#filters .swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid #ccc;
}

#filters .group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

#filters .group label {
  display: inline-flex;
  align-items: center;
  margin: 2px 0;
  line-height: 1.35;
}

#filters .group label input[type="checkbox"] {
  margin-right: 6px;
}

#filters .group label .swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin: 0 6px 0 0;
  vertical-align: middle;
  border: 1px solid #ccc;
  border-radius: 2px;
  box-sizing: content-box;
}

/* ===== Theming specific to panel/filters ===== */
#panel {
  background: var(--brand-bg);
  border-left: 1px solid var(--brand-border);
  overflow: auto;
}

#panel header h2 {
  color: var(--brand-ink);
}

.tab {
  border: 1px solid var(--brand-border);
}

.tab.active {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.2);
  background: rgba(0, 229, 255, 0.08);
}

button.primary,
#saveBtn,
#loadBtn,
#deleteBtn,
#resetBtn,
#tabSaves,
#tabFilters {
  border: 1px solid rgba(0, 229, 255, 0.5);
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.25), rgba(0, 229, 255, 0.15));
  color: #e6fbff;
}

button.primary:hover,
#saveBtn:hover,
#loadBtn:hover,
#deleteBtn:hover,
#resetBtn:hover,
#tabSaves:hover,
#tabFilters:hover {
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.35), rgba(0, 229, 255, 0.2));
}

#authorFilters label,
#practiceFilters label,
#industryFilters label {
  background: var(--chip-bg);
  border-color: var(--brand-border);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.12) inset;
}

#authorFilters label:hover,
#practiceFilters label:hover,
#industryFilters label:hover {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.3) inset;
}

#legend .swatch {
  border-color: var(--brand-border);
}

/* Accordion styling */
details.accordion {
  border: 1px solid var(--brand-border, #1f2937);
  border-radius: 10px;
  padding: 6px 10px;
  margin: 8px 0;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(2px);
}

details.accordion>summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  user-select: none;
}

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

details.accordion[open] {
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.08), 0 4px 16px rgba(0, 229, 255, 0.06) inset;
}

details.accordion>div {
  margin-top: 8px;
  max-height: 40vh;
  overflow: auto;
}


#histogram-filter {
  background: var(--brand-bg);
  border-top: 1px solid var(--brand-border, #e5e7eb);
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.08), 0 4px 16px rgba(0, 229, 255, 0.06) inset;
  box-sizing: border-box;
  position: relative;
  z-index: 3;
  padding: 10px;
  height: 140px;
}

#histogram {
  display: flex;
  height: 75px;
  width: 80%;
  margin: auto;
}

#histogram-info {
  flex: 1;
}

#histogram-container {
  display: flex;
  align-items: flex-end;
  margin: 8px;
  border-bottom: 1px solid #444;
  box-sizing: border-box;
  position: relative;
  flex: 4;
}

#histogram-title {
  width: 80%;
  margin: 4px auto;
}

#histogram-info {
  padding: 8px;
}

.histogram-axis-label {
  color: #444;
  display: block;
  width: max-content;
  position: absolute;
  font-size: 10px;
  left: 0;
  bottom: -50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.histogram-axis-label-tag {
  border: 1px solid #444;
  height: 8px;
  position: absolute;
  bottom: -8px;
  z-index: -1;
  transform: translate(-50%, 0%);
  pointer-events: none;
}

.histogram-bar {
  height: 100%;
  width: calc(100% / var(--weeks));
  position: relative;
}

.histogram-bar:hover::after {
  content: attr(data-tooltip);
  font-size: 10px;
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 10;
  background: #444;
  border-radius: 10px;
  padding: 4px 5px;
  width: max-content;
  transform: translate(-50%, -50%);
  box-shadow: 1px 1px 5px black;
}

.histogram-bar:hover {
  cursor: pointer;
}

.histogram-column {
  position: absolute;
  width: 100%;
  bottom: 0;
  left: 0;
  height: 105%;
  transition: background-color 0.1s ease-in, opacity 0.1s ease-in;
  border-radius: 5px 5px 0px 0px;
  opacity: 0;
  background-color: white;
  box-shadow: 10px 10px 5px black;
}


.histogram-column:hover {
  background-color: white;
  box-shadow: 1px 1px 5px black;
  opacity: 0.15;
}

.histogram-data-bar {
  background-color: #f9653b;
  position: absolute;
  border-radius: 5px 5px 0px 0px;
  width: 100%;
  bottom: 0;
  left: 0;
}

.histogram-active-bar {
  opacity: 0.35;
}