/* =========================================================
   DBV-Ligen Anwendung - zentrale Styles
   ========================================================= */

/* =========================================================
   1. Design Tokens / Grundlayout
   ========================================================= */

:root {
  --dbv-blue: #174ea6;
  --dbv-blue-dark: #123a7d;
  --dbv-accent: #f4b400;

  --ui-bg: #f3f6fb;
  --ui-panel: #ffffff;
  --ui-soft: #f8fafc;
  --ui-border: #dbe3ee;
  --ui-text: #1f2937;
  --ui-muted: #6b7280;

  --shadow-panel: 0 14px 35px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 10px 26px rgba(15, 23, 42, 0.05);
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at top, rgba(23, 78, 166, 0.06), transparent 28%),
    var(--ui-bg);
  color: var(--ui-text);
}

.page-shell,
.analysis-page {
  max-width: 1800px;
  margin: 0 auto;
  padding-bottom: 2rem;
}

.app-logo {
  height: 70px;
}


/* =========================================================
   2. Header / Überschriften
   ========================================================= */

.page-header {
  padding-top: 0.25rem;
  margin-bottom: 1.75rem;
}

.page-title {
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 600;
  color: #1f2a44;
  letter-spacing: -0.02em;
}

.page-subtitle {
  max-width: 760px;
  margin-inline: auto;
  color: var(--ui-muted);
  font-size: 1rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.section-heading-inline {
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1f2a44;
}

.section-title i {
  color: var(--dbv-blue);
}

.section-subtitle {
  color: var(--ui-muted);
  font-size: 0.95rem;
}


/* =========================================================
   3. Panels / Karten / Container
   ========================================================= */

.content-panel,
.filter-panel {
  position: relative;
  background: var(--ui-panel);
  border: 1px solid var(--ui-border);
  border-radius: 20px;
  box-shadow: var(--shadow-panel);
}

.content-panel {
  padding: 1.35rem;
}

.filter-panel {
  padding: 1.4rem;
}

.filter-item {
  background: linear-gradient(180deg, #fbfdff 0%, #f5f8fc 100%);
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.filter-item-wide {
  box-shadow: none;
}

.filter-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.55rem;
}


/* =========================================================
   4. Formulare / Filter / Bootstrap-Select
   ========================================================= */

.filter-select,
.bootstrap-select > .dropdown-toggle {
  min-height: 46px;
  border-radius: 10px !important;
  border-color: #cfd8e3;
}

.bootstrap-select {
  width: 100% !important;
}

.bootstrap-select > .dropdown-toggle {
  background: #ffffff;
  padding: 0.65rem 0.9rem;
}

.bootstrap-select > .dropdown-toggle:hover {
  background: #ffffff;
}

.bootstrap-select .filter-option-inner-inner {
  color: #374151;
}

.form-select:focus,
.bootstrap-select > .dropdown-toggle:focus,
.btn:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(23, 78, 166, 0.15) !important;
}

.filter-radio {
  display: flex;
  align-items: center;
  min-height: 24px;
  padding-top: 0.35rem;
}

.filter-radio .form-check-input {
  margin-top: 0;
}

.filter-radio .form-check-label {
  color: #4b5563;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  align-items: center;
  padding-top: 0.5rem;
}

.filter-action-btn {
  min-width: 220px;
  min-height: 46px;
  border-radius: 12px;
  font-weight: 600;
  padding: 0.7rem 1.25rem;
}

.btn-primary.filter-action-btn,
.btn-primary.search-submit-btn {
  background: linear-gradient(135deg, var(--dbv-blue) 0%, #2563eb 100%);
  border: none;
  color: #ffffff;
}

.btn-primary.filter-action-btn:hover,
.btn-primary.search-submit-btn:hover {
  background: linear-gradient(135deg, var(--dbv-blue-dark) 0%, #1d4ed8 100%);
}

.filter-action-btn.btn-outline-secondary {
  border-color: #c7d1df;
  color: #334155;
  background: #ffffff;
}

.filter-action-btn.btn-outline-secondary:hover {
  background: #f8fafc;
  color: #0f172a;
}


/* =========================================================
   5. Suche / Autocomplete
   ========================================================= */

.search-filter-item {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.search-input-group {
  position: relative;
}

.search-input-group .form-control {
  min-height: 46px;
  border-color: #cfd8e3;
}

.search-input-group .autocomplete-wrapper {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.autocomplete-wrapper .form-control {
  width: 100%;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.autocomplete-box {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 10050;
  background: #ffffff;
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.16);
  max-height: 280px;
  overflow-y: auto;
  padding: 0.35rem;
}

.autocomplete-box.is-visible {
  display: block;
}

.autocomplete-item {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  color: var(--ui-text);
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-item:hover,
.autocomplete-item.is-active {
  background: rgba(23, 78, 166, 0.08);
  color: var(--dbv-blue);
}

.autocomplete-empty {
  padding: 0.75rem 0.85rem;
  color: var(--ui-muted);
  font-size: 0.9rem;
}


/* =========================================================
   6. Analyse-Kacheln
   ========================================================= */

.analysis-grid .analysis-card,
.analysis-card {
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: 18px;
  color: inherit;
  text-decoration: none;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.analysis-card::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--dbv-blue), var(--dbv-accent));
}

.analysis-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.10);
  border-color: var(--dbv-blue);
}

.analysis-card .card-body {
  min-height: 150px;
  padding: 1rem;
}

.analysis-card h6 {
  font-size: 1rem;
  font-weight: 600;
}

.analysis-card small {
  color: var(--ui-muted);
  font-size: 0.75rem;
}

.analysis-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.85rem;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: var(--dbv-blue);
  background: rgba(23, 78, 166, 0.08);
}

.disabled-card {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  background-color: #f8f9fa;
}


/* =========================================================
   7. Karte
   ========================================================= */

.map-panel {
  position: relative;
}

.map-wrapper {
  position: relative;
}

.map-wrapper.map-hidden {
  display: none;
}

.map-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

#karte {
  width: 100%;
  height: 45vh;
  min-height: 520px;
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

#karte.map-large {
  height: 100vh;
  min-height: 85vh;
}

.utility-btn {
  border-radius: 10px;
  padding-inline: 0.9rem;
  border-color: #d1d9e6;
  color: #334155;
  background: #ffffff;
}

.utility-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}


/* =========================================================
   8. Farb-Legende
   ========================================================= */

.legend-box {
  display: none;
  position: absolute;
  top: 64px;
  right: 18px;
  z-index: 9999;

  width: 320px;
  min-width: 230px;
  max-width: 560px;

  height: 360px;
  min-height: 160px;
  max-height: calc(100% - 90px);

  background: #ffffff;
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  user-select: none;

  resize: both;
  overflow: hidden;
  backdrop-filter: blur(6px);

  flex-direction: column;
}

/* Wenn JS display:block setzt, trotzdem Flex-Layout verwenden */
.legend-box[style*="display: block"] {
  display: flex !important;
}

.legend-header {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 12px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--ui-border);
  border-radius: 14px 14px 0 0;

  cursor: move;
  font-weight: 700;
  color: #1f2937;
}

.legend-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  overflow-y: auto;

  padding: 10px;
  background: r
  gba(255, 255, 255, 0.96);
}
.legend-box.legend-collapsed {
  height: auto !important;
  min-height: 0;
  resize: none;
}

.legend-box.legend-collapsed .legend-header {
  border-radius: 14px;
  border-bottom: none;
}

/* =========================================================
   9. Marker / Hallen-Gruppen
   ========================================================= */

.hall-count-marker {
  background: transparent;
  border: none;
}

.hall-count-marker-inner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #0d6efd;
  color: #ffffff;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}

.hall-popup {
  max-width: 320px;
}

.hall-popup hr {
  opacity: 0.2;
}


/* =========================================================
   10. Tabellen
   ========================================================= */

.table-responsive {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}

.table,
#teamsWrap table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  margin-bottom: 0;
}

.table th,
.table td,
#teamsWrap table th,
#teamsWrap table td {
  white-space: nowrap !important;
  vertical-align: middle;
  word-break: normal;
  overflow-wrap: normal;
}

.table thead th {
  vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: rgba(23, 78, 166, 0.03);
}

.highlight-row {
  outline: 3px solid #ffc107;
  outline-offset: -3px;
}

.goto-marker {
  font-weight: 600;
  text-decoration: none;
}

.goto-marker:hover {
  text-decoration: underline;
}
.table-responsive::-webkit-scrollbar {
  height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
  background: #eef2f7;
  border-radius: 999px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #b8c4d6;
  border-radius: 999px;
}
#teamsWrap {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

#teamsWrap .table-responsive {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}

#teamsWrap table {
  width: max-content;
  min-width: 100%;
}

/* =========================================================
   11. Analyse-Seiten
   ========================================================= */

.analysis-header {
  margin-bottom: 1.5rem;
}

.analysis-header .page-title {
  margin-bottom: 0.5rem;
}

.analysis-header .page-subtitle {
  margin-bottom: 0;
}

.analysis-filter-summary {
  background: linear-gradient(180deg, #fbfdff 0%, #f5f8fc 100%);
}

.analysis-filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.analysis-filter-chip {
  min-width: 220px;
  background: #ffffff;
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.analysis-filter-chip-highlight {
  background: linear-gradient(135deg, rgba(23, 78, 166, 0.08) 0%, rgba(37, 99, 235, 0.10) 100%);
  border-color: #bfd0ee;
}

.analysis-filter-chip-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ui-muted);
  margin-bottom: 0.3rem;
}

.analysis-filter-chip-value {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ui-text);
}

.analysis-intro-box,
.analysis-table-panel {
  background: #ffffff;
  border: 1px solid var(--ui-border);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  padding: 1.25rem;
}

.analysis-table-panel {
  margin-bottom: 1.5rem;
}

.analysis-note-box {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  margin-bottom: 1.5rem;
}

.analysis-table-panel h2,
.analysis-table-panel h3,
.analysis-table-panel h4 {
  margin-bottom: 1rem;
  color: #1f2a44;
}

.comparison-badge {
  white-space: normal;
  line-height: 1.2;
  text-align: center;
  max-width: 140px;
  display: inline-block;
}


/* =========================================================
   12. Responsive
   ========================================================= */

@media (max-width: 1200px) {
  .analysis-card .card-body {
    min-height: 135px;
  }
}

@media (max-width: 992px) {
  .section-heading {
    align-items: flex-start;
  }

  .content-panel,
  .filter-panel {
    padding: 1rem;
  }

  .filter-actions {
    justify-content: stretch;
  }

  .filter-action-btn {
    width: 100%;
    min-width: 0;
  }

  #karte {
    min-height: 430px;
  }

  .legend-box {
    top: 74px;
    right: 12px;
    width: 210px;
    min-width: 210px;
  }
}

@media (max-width: 768px) {
  .page-title {
    font-size: 1.85rem;
  }

  .section-title {
    font-size: 1.05rem;
  }

  .analysis-card .card-body {
    min-height: 120px;
  }

  .analysis-filter-chip {
    width: 100%;
    min-width: 0;
  }

  .map-actions {
    width: 100%;
  }

  .map-actions .utility-btn {
    flex: 1 1 100%;
  }

  .search-input-group {
    display: block;
  }

  .search-input-group .autocomplete-wrapper {
    width: 100%;
  }

  .search-input-group .form-control {
    width: 100%;
    border-radius: 10px !important;
    margin-bottom: 0.75rem;
  }

  .search-submit-btn {
    width: 100%;
    border-radius: 10px !important;
  }

  .autocomplete-box {
    position: static;
    margin-top: 0.35rem;
  }

  .legend-box {
    width: 210px;
    min-width: 210px;
  }

  /* Tabellen auf Handy sauber scrollbar */
  .table-responsive {
    border-radius: 12px;
    border: 1px solid var(--ui-border);
  }

  .table,
  #teamsWrap table {
    font-size: 0.82rem;
  }

  .table th,
  .table td,
  #teamsWrap table th,
  #teamsWrap table td {
    padding: 0.5rem 0.65rem;
  }
}

/* =========================================================
   Footer / Projekt-Hinweis
   ========================================================= */

.app-footer {
  margin-top: 2rem;
  padding: 1rem 1rem 1.25rem;
  color: var(--ui-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--ui-border);
  background: rgba(255, 255, 255, 0.45);
}

.app-footer-inner {
  max-width: 1800px;
  margin: 0 auto;
  text-align: center;
}

.app-footer-line {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.app-footer strong {
  color: var(--ui-text);
}

.app-footer a {
  color: var(--dbv-blue);
  text-decoration: none;
  font-weight: 600;
}

.app-footer a:hover {
  color: var(--dbv-blue-dark);
  text-decoration: underline;
}

.footer-separator {
  color: #c0cad8;
}

@media (max-width: 768px) {
  .app-footer-line {
    flex-direction: column;
    gap: 0.25rem;
  }

  .footer-separator {
    display: none;
  }
}