/* =====================================================
   10. Projektübersicht / Statistikfenster
===================================================== */

.project-stats-panel {
  position: absolute;
  z-index: 1300;
  top: 80px;
  left: 55px;
  width: 360px;
  max-width: calc(100vw - 75px);
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.28);
  border: 1px solid #d9e2ec;
  overflow: hidden;
  display: none;
}

.project-stats-panel.open {
  display: block;
}

.project-stats-header {
  background: #1961ac;
  color: white;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.project-stats-title {
  font-weight: bold;
  font-size: 15px;
}

.project-stats-subtitle {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 2px;
}

.project-stats-header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.project-stats-pdf-button {
  min-width: 44px;
  height: 28px;
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 5px;
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  padding: 0 9px;
}

.project-stats-pdf-button:hover,
.project-stats-pdf-button:focus-visible {
  background: rgba(255,255,255,.28);
  outline: none;
}

.project-stats-pdf-button:disabled {
  opacity: .5;
  cursor: wait;
}

.project-stats-body {
  padding: 10px;
  max-height: 520px;
  overflow: auto;
}

.project-stats-date {
  font-size: 11px;
  font-weight: normal;
  opacity: 0.9;
  margin-left: 6px;
}


.stats-section {
  border: 1px solid #d8e4f0;
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.stats-section-title {
  background: #f5f9fd;
  color: #1961ac;
  font-weight: bold;
  padding: 8px 10px;
  border-bottom: 1px solid #d8e4f0;
}

.stats-section-title-dropdown {
  padding: 6px 8px;
}

.stats-grouping-select {
  width: 100%;
  border: 1px solid #9ebbd8;
  border-radius: 5px;
  background: #ffffff;
  color: #1961ac;
  font: inherit;
  font-weight: bold;
  padding: 6px 30px 6px 8px;
  cursor: pointer;
}

.stats-grouping-select:focus {
  outline: 2px solid rgba(25,97,172,.22);
  outline-offset: 1px;
}

.overview-meta {
  background: #f5f9fd;
  border: 1px solid #d8e4f0;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #444;
}

.overview-meta strong {
  color: #1961ac;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}

.stats-row:last-child {
  border-bottom: none;
}

.stats-row span {
  color: #444;
}

.stats-row strong {
  color: #1961ac;
  text-align: right;
}

.stats-muted {
  color: #777;
  font-size: 12px;
  padding: 8px 10px;
}

.stats-spacer {
  height: 8px;
  border-bottom: 1px solid #eee;
}

.stats-row-total {
  font-weight: bold;
  background: #f5f9fd;
}

.stats-row-total span,
.stats-row-total strong {
  font-weight: bold;
}

.stats-row-selectable {
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}

.stats-row-selectable:hover,
.stats-row-selectable:focus-visible {
  background: #eaf4ff;
  box-shadow: inset 3px 0 0 #1961ac;
}

.stats-row-selectable.selected {
  background: #d7ebff;
  box-shadow: inset 4px 0 0 #1961ac;
}

.stats-row-selectable.loading {
  opacity: 0.65;
  cursor: progress;
}

.stats-section-collapsible > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.stats-section-collapsible > summary::-webkit-details-marker {
  display: none;
}

.stats-section-collapsible > summary::after {
  content: '▶';
  float: right;
  font-size: 10px;
  margin-top: 2px;
  transition: transform 0.15s ease;
}

.stats-section-collapsible[open] > summary::after {
  transform: rotate(90deg);
}

.stats-section-collapsible > summary.stats-section-title {
  border-bottom: none;
}

.stats-section-collapsible[open] > summary.stats-section-title {
  border-bottom: 1px solid #d8e4f0;
}

.stats-selection-status {
  margin: -2px 0 10px;
  padding: 7px 9px;
  border-radius: 6px;
  background: #f5f9fd;
  border: 1px solid #d8e4f0;
  color: #52606d;
  font-size: 11px;
  line-height: 1.35;
}

.stats-selection-status.error {
  background: #fff4f4;
  border-color: #f0b7b7;
  color: #a12626;
}

/* Eigener Schließen-Button: unabhängig davon, ob das Suchmodul geladen ist. */
.project-stats-panel #projectStatsClose {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex: 0 0 27px;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: rgba(255,255,255,.16);
  color: #fff;
  font: normal 20px/1 Arial, sans-serif;
  cursor: pointer;
}
.project-stats-panel #projectStatsClose:hover,
.project-stats-panel #projectStatsClose:focus-visible {
  background: rgba(255,255,255,.30);
  outline: 2px solid rgba(255,255,255,.60);
  outline-offset: 1px;
}
