/* ==================== LUKASVOTES - OPTIMIZED CSS ==================== */

/* 1. Montserrat als Default für ALLE Elemente */
* {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif !important;
}

body,
html {
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

input,
textarea,
select,
button,
.form-control,
.form-select,
.btn,
.dropdown-menu,
.modal,
.tooltip,
.popover {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif !important;
}

.select2-container,
.select2-dropdown,
.select2-results,
.select2-selection {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif !important;
}

.flatpickr-calendar,
.flatpickr-input,
.flatpickr-day,
.flatpickr-month,
.flatpickr-year {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif !important;
}

.bootstrap,
.bootstrap * {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif !important;
}

/* 2. Bootstrap-Überschreibungen gezielt und konsistent */
.btn,
.btn-outline-primary,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger,
.btn-light,
.btn-dark {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif !important;
  border-radius: 0.6rem !important;
  font-weight: 600 !important;
}

.btn-outline-primary {
  border-color: #fff !important;
  color: #333 !important;
  background: #fff0 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07) !important;
  transition: background 0.2s, color 0.2s !important;
}
.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background: #f3f3f3 !important;
  color: #111 !important;
  border-color: #fff !important;
}

.btn-primary {
  background: #ffa600 !important;
  border-color: #ffa600 !important;
  color: #fff !important;
}
.btn-primary:hover,
.btn-primary:focus {
  background: #e69500 !important;
  border-color: #e69500 !important;
  color: #fff !important;
}

.form-control,
.form-select {
  border-radius: 0.6rem !important;
  border: 1.5px solid #e0e0e0 !important;
  background: #fff !important;
  font-size: 1.05rem !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03) !important;
}

.card {
  border-radius: 18px !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.13) !important;
  border: none !important;
  background: #fff !important;
}

/* 3. Grid: Nur eigenes Grid für Abstimmungskarten */
.votes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2.5rem;
  padding: 0 2vw;
  justify-content: center;
}
@media (max-width: 900px) {
  .votes-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
    padding: 0 0.5vw;
  }
}

/* 4. Custom-Komponenten bleiben erhalten */
.lang-switch {
  position: absolute;
  top: 0;
  right: 0;
  margin: 0.5rem;
  display: flex;
  z-index: 1000;
}

/* Sprachumschalter: Orange aktiv, weiß inaktiv */
.lang-switch .btn {
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #333;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.375rem 0.75rem;
  margin-left: 0.25rem;
  border-radius: 0.5rem;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lang-switch .btn.active,
.lang-switch .btn:active,
.lang-switch .btn.selected {
  background: #ffa600 !important;
  color: #fff !important;
  border-color: #ffa600 !important;
  box-shadow: 0 2px 8px rgba(255, 166, 0, 0.3);
  font-weight: 700;
  z-index: 1;
}

.lang-switch .btn:not(.active):hover {
  background: #fff;
  color: #ffa600;
  border-color: #ffa600;
}

/* Entferne alte Sprachumschalter-Konflikte */
.lang-switch .btn-outline-primary,
.lang-switch .btn-outline-light {
  background: none !important;
  border: none !important;
  color: inherit !important;
  box-shadow: none !important;
}

/* Links - Footer und Pagination schwarz lassen */
.voting-header .reference-text a,
.voting-header .reference-link {
  color: white !important;
}

.reference-text a {
  color: #ffa600;
  text-decoration: none;
}

footer a {
  color: #333 !important;
  text-decoration: none;
}

footer a:hover {
  color: #000 !important;
  text-decoration: underline;
}

/* Pagination Links schwarz */
.pagination .page-link {
  color: #333 !important;
  border-color: #dee2e6;
}

.pagination .page-link:hover {
  color: #000 !important;
  background-color: #f8f9fa;
  border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
  background-color: #ffa600;
  border-color: #ffa600;
  color: white !important;
}

/* ==================== HEADER STYLES ==================== */

/* Voting Header */
.voting-header {
  background: #ffa600;
  color: white;
  padding: 2rem 0 4rem 0;
  text-align: center;
  position: relative;
  min-height: 180px;
}

.voting-header h1 {
  margin: 0;
  font-size: 2rem;
  color: white;
}

.voting-header img {
  height: 4rem;
  width: auto;
  object-fit: contain;
}

.voting-header .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Logo */
.logo-img {
  height: 4rem;
  width: auto;
  object-fit: contain;
}

/* App Name */
.app-name {
  color: white;
  font-size: 1rem;
  font-weight: 500;
  margin-top: 0.5rem;
  opacity: 0.9;
}

/* Vote Navigation Buttons */
.vote-navigation-buttons {
  position: absolute;
  bottom: 1rem;
  display: flex;
  gap: 0.5rem;
  width: 100%;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 1000;
  position: relative;
}

/* Navigation buttons should be white with orange border */
.vote-navigation-buttons .btn {
  background: #fff !important;
  color: #ffa600 !important;
  border: 2px solid #ffa600 !important;
  border-radius: 0.5rem !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  transition: background 0.2s, color 0.2s, border 0.2s !important;
  padding: 0.375rem 0.75rem !important;
  margin-left: 0.25rem !important;
}
.vote-navigation-buttons .btn:hover,
.vote-navigation-buttons .btn:focus,
.vote-navigation-buttons .btn.active {
  background: #ffa600 !important;
  color: #fff !important;
  border-color: #ffa600 !important;
  cursor: pointer !important;
}

/* Custom Header Styles */
.header {
  background: #ffa600;
  color: white;
  padding: 2rem 0;
  text-align: center;
}

.header h1 {
  margin: 0;
  font-size: 2rem;
}

/* ==================== FILTER STYLES ==================== */

/* Show filters button - should remain dark/black style */
.d-md-none .btn-outline-primary {
  border-color: #e0e0e0 !important;
  color: #333 !important;
  background: #fff !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07) !important;
}
.d-md-none .btn-outline-primary:hover,
.d-md-none .btn-outline-primary:focus {
  background: #f3f3f3 !important;
  color: #111 !important;
  border-color: #e0e0e0 !important;
}

/* Filter Bar */
.filter-bar {
  background: #f0f4f8 !important;
  padding: 1rem 0;
  max-width: calc(100vw - 3rem) !important;
  overflow-x: hidden !important;
}

/* Filter Form Responsive Container */
.filter-bar form {
  max-width: 100% !important;
  overflow-x: auto !important;
}

/* Filter Form - begrenzte Breite auf Desktop */
@media (min-width: 768px) {
  .filter-bar form {
    max-width: calc(100vw - 7rem) !important;
  }
}

/* Filter Controls - Einheitliche Höhe und vertikale Zentrierung */
.filter-bar .form-select,
.filter-bar .form-select-sm,
.filter-bar .form-control,
.filter-bar .input-group,
.filter-bar .input-group .form-control,
.filter-bar .input-group-text {
  height: 2.5rem !important;
  min-height: 2.5rem !important;
  display: flex !important;
  align-items: center !important;
}

/* Responsive Filter Elements - überschreibt inline min-width */
.filter-bar form > div {
  flex: 1 1 auto !important;
  min-width: 120px !important;
  max-width: 200px !important;
}

/* Button Container behält seine Breite */
.filter-bar form > div:last-child,
.filter-bar form > .d-flex,
.filter-bar form > button {
  flex: 0 0 auto !important;
  min-width: auto !important;
  max-width: none !important;
}

/* Filter Grid Layout */
.filter-bar .row {
  margin-left: 0 !important;
  margin-right: 0 !important;
  gap: 0.5rem !important;
}

.filter-bar .row > [class*="col-"] {
  padding-left: 0.25rem !important;
  padding-right: 0.25rem !important;
}

.filter-bar .row > [class*="col-"]:first-child {
  padding-left: 0 !important;
}

.filter-bar .row > [class*="col-"]:last-child {
  padding-right: 0 !important;
}

/* Dropdown Column Sizing */
.filter-bar .col-md-2 {
  flex: 0 0 auto !important;
  max-width: none !important;
  min-width: 150px !important;
}

.filter-bar .col-md-2 + .col-md-2 {
  margin-left: 0.25rem !important;
}

/* Search Field */
.filter-bar .col-md-4 {
  flex: 0 0 25% !important;
  max-width: 25% !important;
}

.filter-bar #query {
  max-width: 275px !important;
}

/* Member Select */
.member-select {
  max-width: 15rem !important;
  width: auto !important;
}

/* Region Dropdown */
#geo {
  width: 15ch !important;
  height: 2.5rem !important;
}

/* Filter Dropdown Spacing */
.filter-dropdown {
  padding-left: 0.1rem !important;
  padding-right: 0.1rem !important;
  margin-left: 0 !important;
  margin-right: 0.25rem !important;
  flex: 0 0 auto !important;
  max-width: 160px !important;
}

/* ==================== VOTE CARD STYLES ==================== */

/* Vote Card Base Styles */
#votes-container .card {
  border: 2px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

#votes-container .card .card-body {
  height: 100%;
  overflow: visible;
  padding: 1.25rem 1.25rem 2rem 1.25rem !important;
}

/* ==================== GALLERY LAYOUT ==================== */

/* Vote Gallery Container */
.votes-gallery {
  margin-top: 1.5rem;
}

/* Vote Cards in Gallery */
.vote-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border-radius: 15px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

/* Vote Result Indicator */
.vote-result-indicator {
  height: 4px;
  width: 100%;
  border-radius: 15px 15px 0 0;
}

.vote-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

/* Vote Title */
.vote-card .vote-title {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  line-height: 1.3 !important;
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 1rem !important;
  min-height: 4.2rem;
  flex-shrink: 0;
}

/* Vote Charts Container */
.vote-charts-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 0;
}

/* Main Chart Container */
.main-chart-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.main-chart-container canvas {
  max-width: 150px !important;
  max-height: 150px !important;
}

/* Vote Legend Grid */
.vote-legend-grid {
  margin-top: 1rem;
}

.vote-legend-item {
  padding: 0.5rem;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.vote-legend-item:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.member-vote-highlight {
  background-color: rgba(255, 166, 0, 0.15) !important;
  border: 2px solid #ffa600 !important;
  border-radius: 8px !important;
}

/* Vote Indicator */
.vote-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Vote Info */
.vote-info {
  flex-grow: 1;
  min-width: 0;
}

.vote-label {
  font-size: 0.75rem;
  line-height: 1.2;
  margin-bottom: 0.125rem;
}

.vote-count {
  font-size: 0.7rem;
  line-height: 1.2;
}

/* Vote Reference */
.vote-reference {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding-top: 0.75rem;
  margin-top: auto;
  flex-shrink: 0;
}

/* Pagination */
.votes-pagination {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

/* Legacy Vote Title (für Kompatibilität) */
#votes-container .card .card-body .vote-title {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  line-height: 1.3 !important;
  font-size: 1.4rem;
  font-weight: bold;
  margin-bottom: 1.25rem !important;
}

.vote-title a,
.vote-title a:hover,
.vote-title a:focus {
  color: inherit;
  text-decoration: none;
}

/* Vote Meta */
.vote-meta {
  color: #666;
  font-size: 0.9rem;
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

/* Vote Reference */
#votes-container .card .card-body .vote-reference {
  position: static !important;
  bottom: auto !important;
  margin-top: 1rem !important;
}

/* Chart Layout */
#votes-container
  .card
  .card-body
  .d-flex.justify-content-between.align-items-start.w-100 {
  position: static !important;
  bottom: auto !important;
  margin-top: 1rem !important;
  height: auto !important;
}

/* Large Donut Chart */
#votes-container .card .card-body .flex-shrink-0[style*="width:50%"] {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100% !important;
  width: 48% !important;
  flex-shrink: 0 !important;
}

#votes-container .card .card-body .flex-shrink-0[style*="width:50%"] canvas {
  max-width: 225px !important;
  max-height: 225px !important;
}

/* Mini Donuts */
#votes-container
  .card
  .card-body
  .d-flex.flex-column.justify-content-start.gap-3[style*="width:45%"] {
  height: 100% !important;
  width: 48% !important;
  justify-content: center !important;
  gap: 0.1rem !important;
  margin-left: 0 !important;
  padding-left: 0.25rem !important;
}

/* Vote Labels */
#votes-container .card .card-body .d-flex.flex-column .small {
  font-size: 0.75rem !important;
}

#votes-container .card .card-body .small.fw-bold {
  font-size: 0.875rem !important;
  font-weight: 600 !important;
}

#votes-container .flex-column.justify-content-start.gap-3 {
  gap: 0.2rem !important;
}

#votes-container .flex-row .ms-2 {
  margin-left: 0.25rem !important;
}

/* Vote Navigation */
.votes-wrapper {
  position: relative;
  overflow: hidden;
}

.votes-controls {
  margin-top: 1rem;
}

.votes-controls .scroll-arrows button {
  background: #ffa600;
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  cursor: pointer;
  margin: 0 0.25rem;
  transition: background-color 0.2s ease;
}

.votes-controls .scroll-arrows button:hover {
  background: #e69500;
}

/* Vote Bar Styles */
.vote-bar {
  position: relative;
  height: 30px;
  background-color: #f8f9fa;
  border-radius: 15px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.vote-bar-for {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background-color: #7ab800;
}

.vote-bar-against {
  position: absolute;
  top: 0;
  height: 100%;
  background-color: #d0006f;
}

.vote-bar-abstention {
  position: absolute;
  top: 0;
  height: 100%;
  background-color: #00c1f0;
}

.vote-bar-no-vote {
  position: absolute;
  top: 0;
  height: 100%;
  background-color: #b6b6b6;
}

/* Vote Legend */
.vote-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
}

.vote-legend-col {
  text-align: center;
  flex: 1;
}

.vote-legend-compact {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.vote-legend-item {
  text-align: center;
}

/* Vote Indicators */
.vote-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}

.vote-indicator-for {
  background-color: #7ab800;
}

.vote-indicator-against {
  background-color: #d0006f;
}

.vote-indicator-abstention {
  background-color: #00c1f0;
}

.vote-indicator-no-vote {
  background-color: #b6b6b6;
}

/* ==================== MEMBER STYLES ==================== */

.member-info {
  margin-top: 0.5rem;
  display: flex;
  justify-content: center;
}
.member-info .card {
  min-width: 180px;
  max-width: 260px;
  min-height: 80px;
  font-size: 0.97rem;
  padding: 0.7rem 0.7rem;
  margin: 0 auto;
}
.member-info .card-body {
  font-size: 0.97rem;
}
.member-info .card img {
  width: 2.5rem !important;
  height: 2.5rem !important;
}
.member-info .card-body p {
  margin-bottom: 0.35rem !important;
}
.member-info .card-body p:last-child {
  margin-bottom: 0 !important;
}
.member-info-badge {
  background-color: #ffa600;
  color: white;
  padding: 0.12rem 0.32rem;
  border-radius: 0.25rem;
  font-size: 0.93rem;
  font-weight: bold;
  letter-spacing: 0.01em;
  margin-right: 0.3em;
  display: inline-block;
  vertical-align: middle;
}

/* Reden-Link Hervorhebung */
.member-info .card-body a[href*="/speeches"],
.member-info-mobile .card-body a[href*="/speeches"],
.orange-card .card-body a[href*="/speeches"] {
  color: #ffa600 !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  transition: all 0.2s ease;
  background-color: rgba(255, 166, 0, 0.1) !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  border: 1px solid rgba(255, 166, 0, 0.3) !important;
}

.member-info .card-body a[href*="/speeches"]:hover,
.member-info-mobile .card-body a[href*="/speeches"]:hover,
.orange-card .card-body a[href*="/speeches"]:hover {
  color: #e69500 !important;
  text-decoration: underline !important;
  transform: translateY(-1px);
  background-color: rgba(255, 166, 0, 0.2) !important;
  border-color: rgba(255, 166, 0, 0.5) !important;
}

/* Member Card */
.member-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  transition: all 0.2s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.member-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: #ffa600;
}

a .member-card:hover {
  text-decoration: none;
}

a:hover .member-card h6 {
  color: #ffa600;
}

/* Member Donut Highlight */
.member-donut-highlight {
  z-index: 2;
  font-size: 0.85em;
}

.member-donut-highlight-box {
  box-shadow: 0 0 0 2px #f2aa3c;
  margin-bottom: 2px;
  position: relative;
}

/* ==================== CHART STYLES ==================== */

/* Chart Wrapper */
.chart-wrapper {
  margin: 1rem 0;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 300px;
  margin: 0 auto;
}

.chart-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: #333;
  z-index: 1;
  pointer-events: none;
}

/* Legend Container */
.legend-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #666;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Chart Canvas */
.chart-container canvas {
  max-width: 100%;
  height: auto;
}

/* Group Logo */
.group-logo {
  width: 3.75rem !important;
  height: 3.75rem !important;
  object-fit: contain;
}

/* ==================== COMPONENT STYLES ==================== */

/* Custom Cards */
.custom-card {
  border-radius: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: none;
}

.orange-card {
  /* border-left: 6px solid #FFA600; entfernt */
}

.orange-card-header {
  background: #ffa600;
  color: white;
  border-radius: 15px 15px 0 0 !important;
}

/* Buttons */
.btn-outline-primary {
  border-color: #ffa600;
  color: #ffa600;
}

.btn-outline-primary:hover {
  background-color: #ffa600;
  border-color: #ffa600;
  color: white;
}

.btn-outline-primary img {
  width: 1rem;
  height: 1rem;
  margin-right: 0.25rem;
}

/* Fix für Button-Groups: Spezifischere Regeln für btn-outline-primary in btn-group */
.btn-group > .btn-outline-primary {
  border-color: #ffa600 !important;
  color: #ffa600 !important;
  background-color: transparent !important;
}

.btn-group > .btn-outline-primary:hover,
.btn-group > .btn-outline-primary:focus {
  background-color: #ffa600 !important;
  border-color: #ffa600 !important;
  color: white !important;
}

.btn-group > .btn-outline-primary.active {
  background-color: #ffa600 !important;
  border-color: #ffa600 !important;
  color: white !important;
}

/* Badges */
.badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
}

/* Tables */
.voting-table th {
  background: #e1e5ea;
}

.table-responsive {
  border-radius: 10px;
  overflow: hidden;
}

.table th,
.table td {
  padding: 0.75rem;
  vertical-align: middle;
}

/* Form Elements */
.form-control:focus,
.form-select:focus {
  border-color: #ffa600;
  box-shadow: 0 0 0 0.2rem rgba(255, 166, 0, 0.25);
}

/* Alerts */
.alert-info {
  background-color: #d1ecf1;
  border-color: #bee5eb;
  color: #0c5460;
}

.alert-success {
  background-color: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.alert-warning {
  background-color: #fff3cd;
  border-color: #ffeaa7;
  color: #856404;
}

.alert-danger {
  background-color: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

/* ==================== RESPONSIVE STYLES ==================== */

/* Mobile First Approach - Base Mobile Styles */
@media (max-width: 767.98px) {
  body {
    font-size: 0.875rem;
    line-height: 1.4;
  }

  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  /* Header Mobile */
  .voting-header {
    padding: 1rem 0 2rem 0;
    min-height: 120px;
  }

  .voting-header h1 {
    font-size: 1.5rem;
  }

  .voting-header img {
    height: 3.25rem;
  }

  .voting-header p {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
  }

  /* Cards Mobile */
  .card {
    margin-bottom: 1rem;
    border-radius: 10px;
  }

  .card-header {
    padding: 0.75rem;
  }

  .card-body {
    padding: 1rem;
  }

  /* Tables Mobile */
  .table-responsive {
    font-size: 0.75rem;
  }

  .table th,
  .table td {
    padding: 0.5rem 0.25rem;
  }

  /* Buttons Mobile */
  .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
  }

  .btn-sm {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  /* Form Controls Mobile */
  .form-control,
  .form-select {
    font-size: 0.875rem;
    height: 2.25rem;
  }

  /* Badges Mobile */
  .badge {
    font-size: 0.625rem;
    padding: 0.2rem 0.4rem;
  }

  /* Chart Mobile */
  .chart-container {
    height: 200px;
  }

  .chart-center-text {
    font-size: 1.25rem;
  }

  .legend-container {
    gap: 0.5rem;
  }

  .legend-item {
    font-size: 0.75rem;
  }

  /* Group Logo Mobile */
  .group-logo {
    width: 40px;
    height: 40px;
  }

  /* Vote Cards Mobile */
  #votes-container {
    flex-direction: column;
    gap: 1rem;
    overflow-x: visible;
  }

  #votes-container .flex-shrink-0 {
    width: 100% !important;
    flex-shrink: 1 !important;
  }

  #votes-container .card {
    width: 100% !important;
    height: auto !important;
    flex-shrink: 1 !important;
  }

  #votes-container .card .card-body {
    padding: 1rem !important;
  }

  #votes-container .card .card-body .vote-title {
    font-size: 1.2rem !important;
    height: auto !important;
    width: 100% !important;
    margin-bottom: 1rem !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
    line-height: 1.3 !important;
  }

  #votes-container
    .card
    .card-body
    .d-flex.justify-content-between.align-items-start.w-100 {
    flex-direction: column !important;
    gap: 1rem !important;
  }

  #votes-container .card .card-body .flex-shrink-0[style*="width:50%"] {
    width: 100% !important;
    height: auto !important;
    justify-content: center !important;
  }

  #votes-container .card .card-body .flex-shrink-0[style*="width:50%"] canvas {
    max-width: 200px !important;
    max-height: 200px !important;
  }

  #votes-container
    .card
    .card-body
    .d-flex.flex-column.justify-content-start.gap-3[style*="width:45%"] {
    width: 100% !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    gap: 0.5rem !important;
    padding-left: 0 !important;
  }

  #votes-container .card .card-body .vote-reference {
    margin-top: 1rem !important;
  }

  #votes-container .flex-column.justify-content-start.gap-3 {
    gap: 0.5rem !important;
  }

  #votes-container .flex-column.justify-content-center.align-items-start.gap-2 {
    flex-direction: row !important;
    justify-content: space-around !important;
    gap: 0.5rem !important;
  }

  /* Member Cards Mobile */
  .member-card {
    margin-bottom: 1rem;
  }

  .member-card:hover {
    transform: none;
  }

  .g-2 .col-6 {
    margin-bottom: 1rem;
  }

  .member-card h6 {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
  }

  .member-card small {
    font-size: 0.75rem;
  }

  .member-card .badge {
    font-size: 0.625rem;
  }

  /* Member Info Mobile */
  .member-info.ms-3 {
    margin-left: 0 !important;
  }

  .member-info .card {
    margin-bottom: 1rem;
  }

  .member-photo {
    width: 6rem !important;
    height: 6rem !important;
    object-position: center 25% !important;
  }

  /* Filter Bar Mobile */
  .filter-bar {
    padding: 0.75rem 0;
    max-width: calc(100vw - 3rem) !important;
  }

  .filter-bar .row {
    gap: 0.25rem !important;
  }

  .filter-bar .col-md-2,
  .filter-bar .col-md-4 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    min-width: auto !important;
    margin-bottom: 0.5rem;
  }

  /* Mobile - Stack filter elements vertically */
  .filter-bar form {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .filter-bar form > div {
    min-width: auto !important;
    max-width: 100% !important;
    margin-bottom: 0.5rem;
  }

  .filter-bar .form-control,
  .filter-bar .form-select {
    height: 2.25rem !important;
    min-height: 2.25rem !important;
    font-size: 0.875rem;
    width: 100% !important;
  }

  /* Language Switcher Mobile */
  .lang-switch .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    margin-left: 0.125rem;
    border-radius: 0.375rem;
  }

  /* Vote Legend Mobile */
  .vote-legend-compact {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .vote-legend-item {
    font-size: 0.875rem;
  }

  /* Vote Navigation Mobile */
  .vote-navigation-buttons {
    position: static;
    transform: none;
    margin-top: 1rem;
    justify-content: center;
    gap: 1rem;
    bottom: auto;
  }

  .vote-navigation-buttons .btn {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
  }

  /* Votes Wrapper Mobile */
  .votes-wrapper {
    margin: 0 -0.75rem;
  }

  /* HTML Body Mobile */
  html,
  body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  main {
    padding: 0;
    margin: 0;
  }

  * {
    box-sizing: border-box;
  }
}

/* Small Mobile Devices */
@media (max-width: 575.98px) {
  .vote-navigation-buttons {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  .vote-navigation-buttons .btn {
    width: auto;
    min-width: 120px;
  }

  .voting-header {
    padding: 0.75rem 0 1.5rem 0;
  }

  .container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

/* Desktop Gallery Layout - 3 Boxen pro Zeile auf Laptops */
@media (min-width: 768px) and (max-width: 1199px) {
  .vote-card {
    height: 480px !important;
    min-height: 480px !important;
    max-height: 480px !important;
  }

  .vote-card .vote-title {
    font-size: 1.1rem !important;
    height: 4.2rem !important;
    min-height: 4.2rem !important;
    max-height: 4.2rem !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
  }

  .main-chart-container {
    height: 140px !important;
    min-height: 140px !important;
    max-height: 140px !important;
  }

  .main-chart-container canvas {
    max-width: 120px !important;
    max-height: 120px !important;
  }

  .vote-legend-grid {
    height: 120px !important;
    min-height: 120px !important;
    max-height: 120px !important;
  }

  .vote-reference {
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    overflow: hidden !important;
  }
}

/* Für größere Bildschirme - Gallery Layout */
@media (min-width: 1200px) {
  .vote-card {
    min-height: 420px !important;
  }

  .vote-card .vote-title {
    font-size: 1.2rem !important;
    min-height: 4.5rem !important;
  }

  .main-chart-container canvas {
    max-width: 140px !important;
    max-height: 140px !important;
  }
}

/* Für sehr große Bildschirme - Gallery Layout */
@media (min-width: 1400px) {
  .vote-card {
    min-height: 450px !important;
  }

  .vote-card .vote-title {
    font-size: 1.3rem !important;
    min-height: 5rem !important;
  }

  .main-chart-container canvas {
    max-width: 160px !important;
    max-height: 160px !important;
  }
}

/* Tablet Vote Card Sizing */
@media (min-width: 768px) and (max-width: 850px) {
  #votes-container .card {
    height: 420px !important;
    width: 550px !important;
    flex: 0 0 550px !important;
  }

  #votes-container
    .card
    .card-body
    .d-flex.justify-content-between.align-items-start.w-100 {
    margin-top: 0.75rem !important;
  }

  #votes-container .card .card-body .vote-reference {
    margin-top: 0.75rem !important;
  }
}

/* ==================== SPECIFIC OVERRIDES ==================== */

/* Stats Section */
.stats {
  background: white;
  padding: 2rem 0;
  border-radius: 10px;
  margin-top: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Global Body Styles */
body {
  background-color: #f8f9fa;
}

/* Mobile Specific Overrides */
@media (max-width: 767.98px) {
  .d-md-none .btn.btn-outline-primary {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .d-md-none .btn-outline-primary img {
    width: 1rem;
    height: 1rem;
    margin-right: 0.25rem;
  }

  /* Additional mobile vote card adjustments */
  #votes-container
    .card
    .card-body
    .d-flex.justify-content-between.align-items-start.w-100 {
    position: static !important;
    bottom: auto !important;
    margin-top: 1rem !important;
    height: auto !important;
  }

  #votes-container .card .card-body .flex-shrink-0[style*="width:50%"] canvas {
    max-width: 200px !important;
    max-height: 200px !important;
  }
}

/* Loading Spinner */
.loadingspinner {
  --square: 1.625rem;
  --offset: 1.875rem;
  --duration: 2.4s;
  --delay: 0.2s;
  --timing-function: ease-in-out;
  --in-duration: 0.4s;
  --in-delay: 0.1s;
  --in-timing-function: ease-out;
  width: calc(3 * var(--offset) + var(--square));
  height: calc(2 * var(--offset) + var(--square));
  padding: 0px;
  margin-left: auto;
  margin-right: auto;
  margin-top: 0.625rem;
  margin-bottom: 1.875rem;
  position: relative;
}

.loadingspinner div {
  display: inline-block;
  background: darkorange;
  border: none;
  border-radius: 0.125rem;
  width: var(--square);
  height: var(--square);
  position: absolute;
  padding: 0px;
  margin: 0;
  font-size: 6pt;
  color: black;
}

.loadingspinner #square1 {
  left: calc(0 * var(--offset));
  top: calc(0 * var(--offset));
  animation: square1 var(--duration) var(--delay) var(--timing-function)
      infinite,
    squarefadein var(--in-duration) calc(1 * var(--in-delay))
      var(--in-timing-function) both;
}

.loadingspinner #square2 {
  left: calc(0 * var(--offset));
  top: calc(1 * var(--offset));
  animation: square2 var(--duration) var(--delay) var(--timing-function)
      infinite,
    squarefadein var(--in-duration) calc(1 * var(--in-delay))
      var(--in-timing-function) both;
}

.loadingspinner #square3 {
  left: calc(1 * var(--offset));
  top: calc(1 * var(--offset));
  animation: square3 var(--duration) var(--delay) var(--timing-function)
      infinite,
    squarefadein var(--in-duration) calc(2 * var(--in-delay))
      var(--in-timing-function) both;
}

.loadingspinner #square4 {
  left: calc(2 * var(--offset));
  top: calc(1 * var(--offset));
  animation: square4 var(--duration) var(--delay) var(--timing-function)
      infinite,
    squarefadein var(--in-duration) calc(3 * var(--in-delay))
      var(--in-timing-function) both;
}

.loadingspinner #square5 {
  left: calc(3 * var(--offset));
  top: calc(1 * var(--offset));
  animation: square5 var(--duration) var(--delay) var(--timing-function)
      infinite,
    squarefadein var(--in-duration) calc(4 * var(--in-delay))
      var(--in-timing-function) both;
}

@keyframes square1 {
  0% {
    left: calc(0 * var(--offset));
    top: calc(0 * var(--offset));
  }
  8.333% {
    left: calc(0 * var(--offset));
    top: calc(1 * var(--offset));
  }
  100% {
    left: calc(0 * var(--offset));
    top: calc(1 * var(--offset));
  }
}

@keyframes square2 {
  0% {
    left: calc(0 * var(--offset));
    top: calc(1 * var(--offset));
  }
  8.333% {
    left: calc(0 * var(--offset));
    top: calc(2 * var(--offset));
  }
  16.67% {
    left: calc(1 * var(--offset));
    top: calc(2 * var(--offset));
  }
  25.00% {
    left: calc(1 * var(--offset));
    top: calc(1 * var(--offset));
  }
  83.33% {
    left: calc(1 * var(--offset));
    top: calc(1 * var(--offset));
  }
  91.67% {
    left: calc(1 * var(--offset));
    top: calc(0 * var(--offset));
  }
  100% {
    left: calc(0 * var(--offset));
    top: calc(0 * var(--offset));
  }
}

@keyframes square3 {
  0%,
  100% {
    left: calc(1 * var(--offset));
    top: calc(1 * var(--offset));
  }
  16.67% {
    left: calc(1 * var(--offset));
    top: calc(1 * var(--offset));
  }
  25.00% {
    left: calc(1 * var(--offset));
    top: calc(0 * var(--offset));
  }
  33.33% {
    left: calc(2 * var(--offset));
    top: calc(0 * var(--offset));
  }
  41.67% {
    left: calc(2 * var(--offset));
    top: calc(1 * var(--offset));
  }
  66.67% {
    left: calc(2 * var(--offset));
    top: calc(1 * var(--offset));
  }
  75.00% {
    left: calc(2 * var(--offset));
    top: calc(2 * var(--offset));
  }
  83.33% {
    left: calc(1 * var(--offset));
    top: calc(2 * var(--offset));
  }
  91.67% {
    left: calc(1 * var(--offset));
    top: calc(1 * var(--offset));
  }
}

@keyframes square4 {
  0% {
    left: calc(2 * var(--offset));
    top: calc(1 * var(--offset));
  }
  33.33% {
    left: calc(2 * var(--offset));
    top: calc(1 * var(--offset));
  }
  41.67% {
    left: calc(2 * var(--offset));
    top: calc(2 * var(--offset));
  }
  50.00% {
    left: calc(3 * var(--offset));
    top: calc(2 * var(--offset));
  }
  58.33% {
    left: calc(3 * var(--offset));
    top: calc(1 * var(--offset));
  }
  100% {
    left: calc(3 * var(--offset));
    top: calc(1 * var(--offset));
  }
}

@keyframes square5 {
  0% {
    left: calc(3 * var(--offset));
    top: calc(1 * var(--offset));
  }
  50.00% {
    left: calc(3 * var(--offset));
    top: calc(1 * var(--offset));
  }
  58.33% {
    left: calc(3 * var(--offset));
    top: calc(0 * var(--offset));
  }
  66.67% {
    left: calc(2 * var(--offset));
    top: calc(0 * var(--offset));
  }
  75.00% {
    left: calc(2 * var(--offset));
    top: calc(1 * var(--offset));
  }
  100% {
    left: calc(2 * var(--offset));
    top: calc(1 * var(--offset));
  }
}

@keyframes squarefadein {
  0% {
    transform: scale(0.75);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ======= Gallery Grid exakt 3 Spalten ab 900px ======= */
@media (min-width: 900px) {
  .votes-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 24px !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
    box-sizing: border-box;
  }
  .vote-card {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
  }
}

/* ======= Gallery Grid: immer 3 Spalten, volle Breite, symmetrisch ======= */
.votes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100vw;
  max-width: 100vw;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

@media (min-width: 1100px) {
  .votes-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 1400px) {
  .votes-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (min-width: 1800px) {
  .votes-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Karten flexibel machen, keine feste Breite */
.vote-card,
#votes-container .card {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Filterleiste: volle Breite, kein Padding */
.filter-bar {
  width: 100vw;
  max-width: 100vw;
  margin: 0 0 1.5rem 0;
  padding: 0;
  box-sizing: border-box;
}

/* ==================== FILTERBAR STYLES ==================== */
.filter-bar {
  background: #f0f4f8 !important;
  padding: 1.2rem 0;
  display: flex;
  justify-content: center;
}
.filter-bar form.d-flex {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.2rem;
  width: 100%;
  max-width: 1200px;
}
.filter-bar form.d-flex > div {
  margin-bottom: 0 !important;
}

/* MAIN CONTENT FULL-WIDTH OVERRIDE */
#main-content {
  width: 100vw !important;
  max-width: 100vw !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* Votes-Gallery Randanpassung */
.votes-gallery {
  margin-left: 0;
  margin-right: 0;
  padding-left: 0.2vw;
  padding-right: 0.2vw;
}

/* Hauptcontainer für große Bildschirme */
.container.votes-main-container {
  max-width: 1800px !important;
  width: 95vw !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
}

.votes-grid {
  padding: 0 2vw;
}
/* Member-Infobox breiter */
.member-info .card {
  min-width: 420px !important;
  max-width: 520px !important;
  width: 100% !important;
}
/* Member-Foto größer */
.member-info img.rounded-circle {
  width: 140px !important;
  height: 140px !important;
  object-fit: cover !important;
  object-position: center 25% !important;
  border: 3px solid #fff !important;
}
/* Fraktionslogo kleiner */
.member-info .group-logo {
  width: 1.5rem !important;
  height: 1.5rem !important;
}
/* Votes-Grid optimieren */
.votes-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)) !important;
  gap: 2rem 1.5rem !important;
  justify-content: center !important;
  align-items: stretch !important;
  width: 100% !important;
  margin: 0 auto !important;
  max-width: 1400px !important;
  padding: 0 2vw !important;
}
/* Vote-Card für große Bildschirme */
.vote-card.card {
  min-width: 0 !important;
  max-width: 100% !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  border-radius: 1.2rem !important;
  background: #fff !important;
}
/* Mobile Anpassungen */
@media (max-width: 768px) {
  .container.votes-main-container {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .votes-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    padding: 0 0.5rem !important;
  }
  .member-info .card {
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .member-info img.rounded-circle {
    width: 80px !important;
    height: 80px !important;
  }
  .member-info .group-logo {
    width: 1.2rem !important;
    height: 1.2rem !important;
  }
}

/* Drei Karten nebeneinander ab 1100px */
@media (min-width: 1100px) {
  .votes-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}
/* Filterleiste bündig mit Container */
.votes-filter-bar {
  max-width: 1400px !important;
  width: 95vw !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 2vw !important;
  padding-right: 2vw !important;
}
@media (max-width: 768px) {
  .votes-filter-bar {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Filterleiste und Grid-Container fast volle Breite */
.votes-filter-bar {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 2vw !important;
  padding-right: 2vw !important;
  box-sizing: border-box !important;
}
.votes-grid {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 2vw !important;
  padding-right: 2vw !important;
  box-sizing: border-box !important;
}
@media (min-width: 1800px) {
  .votes-filter-bar,
  .votes-grid {
    padding-left: 1vw !important;
    padding-right: 1vw !important;
  }
}
@media (max-width: 768px) {
  .votes-filter-bar,
  .votes-grid {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Header-Container bleibt zentriert und schmal */
.voting-header .container {
  max-width: 1200px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
}

/* Hauptbereich für Filter und Abstimmungskarten wird breiter */
.container.votes-main-container {
  max-width: 1800px !important;
  width: 95vw !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
}

.votes-grid {
  padding: 0 2vw;
}

/* ==================== SPEECH CHARTS COLLAPSE STYLES ==================== */
.collapse-text {
  transition: opacity 0.3s ease;
}

.collapse-text.d-none {
  opacity: 0;
}

[data-bs-toggle="collapse"] {
  transition: all 0.3s ease;
}

[data-bs-toggle="collapse"] .chevron-icon {
  transition: transform 0.3s ease;
  display: inline-block;
  font-size: 0.8rem;
}

[data-bs-toggle="collapse"][aria-expanded="true"] .chevron-icon {
  transform: rotate(180deg);
}

/* Chart container styles */
#countryChart,
#groupChart {
  max-height: 300px;
}

/* Responsive chart adjustments */
@media (max-width: 768px) {
  #countryChart,
  #groupChart {
    max-height: 250px;
  }
}
/* ========== FULL-WIDTH FILTER + VOTES GRID OVERRIDE ========== */
.filter-bar,
.container.votes-main-container {
  width: 100vw !important;
  max-width: 100vw !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
}

.filter-bar {
  background: #f0f4f8 !important;
  padding: 1rem 2vw !important;
}

.votes-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 2rem !important;
  padding: 0 2vw !important;
  width: 100vw !important;
  max-width: 100vw !important;
  margin: 0 auto !important;
  box-sizing: border-box !important;
}

@media (max-width: 768px) {
  .votes-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    padding: 0 1rem !important;
  }
  .filter-bar {
    padding: 0.75rem 1rem !important;
  }
}
/* ===== HEADER: CENTER CONTENT & OPTIMIZE BANNER ===== */
.container.votes-main-container {
  justify-content: center !important;
  align-items: center !important;
}

.voting-header {
  padding: 1.5rem 0 2.5rem 0 !important;
}

.voting-header .member-info {
  align-self: center !important;
}

/* ===== FILTER BAR: CENTER FORM ===== */
.filter-bar form.d-flex {
  margin: 0 auto !important;
}

.info-row {
  margin-bottom: 0.5rem;
}
.info-row.mb-0 {
  margin-bottom: 0 !important;
}

/* Filterleiste: Button und Dropdown immer nebeneinander */
.filter-bar .d-flex.flex-row.flex-nowrap {
  overflow-x: auto;
  white-space: nowrap;
}

/* Chart und Legende nebeneinander, auf Mobile untereinander */
.vote-charts-container.d-flex {
  flex-direction: row;
}
@media (max-width: 600px) {
  .copyright-notice {
    font-size: 0.6rem !important;
    line-height: 1.2 !important;
    margin-top: 0.25rem !important;
  }
  
  .copyright-notice a {
    font-size: 0.6rem !important;
  }
  
  /* Bild auf sehr kleinen Bildschirmen etwas verkleinern */
  .rounded-circle[style*="6.25rem"] {
    width: 5rem !important;
    height: 5rem !important;
  }

  .vote-charts-container.d-flex {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .vote-legend-grid {
    margin-top: 1rem;
    margin-left: 0 !important;
    padding-left: 0 !important;
  }
}
.vote-legend-grid {
  min-width: 160px;
  padding-left: 0.5rem;
}

.group-logo-big {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translate(-40%, -30%);
  width: 4.5rem;
  height: 4.5rem;
  z-index: 2;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
}

.vote-charts-container {
  justify-content: center !important;
  align-items: center !important;
}

.main-chart-container {
  width: 200px !important;
  height: 200px !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-chart-container canvas {
  max-width: 200px !important;
  max-height: 200px !important;
}

.vote-legend-grid {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0.5rem !important;
}

.vote-legend-item {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.5rem !important;
  padding: 0.2rem 0.7rem !important;
  border-radius: 1.2rem !important;
  background: #f8f8f8;
  min-width: 120px;
  margin-bottom: 0 !important;
}

.vote-label,
.vote-count {
  margin-bottom: 0 !important;
  display: inline-block !important;
}

.filter-bar form.d-flex,
.filter-bar form.d-flex-flex-row,
.filter-bar form.d-flex.flex-row {
  flex-wrap: nowrap !important;
  gap: 1.2rem !important;
}

.filter-bar form.d-flex > div,
.filter-bar form.d-flex-flex-row > div,
.filter-bar form.d-flex.flex-row > div {
  margin-bottom: 0 !important;
}

.table .rounded-circle[alt="Foto"],
.table .rounded-circle {
  width: 2.5rem !important;
  height: 2.5rem !important;
  object-fit: cover;
  max-width: 100%;
  max-height: 100%;
}

.member-card .member-photo {
  width: 6rem !important;
  height: 6rem !important;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.member-card h6 {
  font-size: 1.15rem !important;
}
.member-card small {
  font-size: 1rem !important;
}

@media (max-width: 767.98px) {
  .mb-4, .mb-3, .card, .card-body, .row, h5 {
    margin-bottom: 0.75rem !important;
  }
  
  .card-body, .custom-card, .orange-card {
    padding: 0.75rem !important;
  }

  /* Copyright-Notice auf mobilen Geräten besser sichtbar machen */
  .copyright-notice,
  .copyright-notice small,
  .copyright-notice a {
    font-size: 0.7rem !important;
    line-height: 1.3 !important;
    display: block !important;
    text-align: center !important;
  }
  
  .copyright-notice a {
    display: inline !important;
  }

  /* Navigation Buttons wieder nebeneinander */
  .vote-navigation-buttons {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 1rem !important;
    margin-top: 0.75rem !important;
    padding: 0 0.75rem !important;
  }

  .vote-navigation-buttons .btn {
    min-width: 44vw !important;
    margin: 0 !important;
    font-size: 1.1rem !important;
  }

  .vote-legend-compact {
    margin-top: 0.5rem !important;
    margin-bottom: 0 !important;
  }

  .vote-legend-item {
    padding: 0.25rem 0 !important;
    margin-bottom: 0 !important;
    font-size: 0.875rem !important;
  }

  /* Reduziere den Abstand zwischen Banner und Member Country Box */
  .voting-header {
    padding-bottom: 1.5rem !important;
  }

  main.container {
    margin-top: 1rem !important;
  }

  .group-short-label {
    display: inline !important;
  }

  .group-long-label {
    display: none !important;
  }

  /* Kompaktere Legende */
  .row.g-1 {
    margin: -0.125rem !important;
  }

  .row.g-1 > .col-6 {
    padding: 0.125rem !important;
  }

  .d-md-none.w-100.mt-1.mb-1 {
    margin-top: 0.25rem !important;
    margin-bottom: 0 !important;
  }

  .vote-legend-compact + * {
    margin-top: 0.5rem !important;
  }
}
@media (min-width: 768px) {
  .group-short-label {
    display: none !important;
  }
  .group-long-label {
    display: inline !important;
  }
}

@media (max-width: 768px) {
  .filter-bar form.d-flex {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.7rem !important;
  }
  .filter-bar form.d-flex > div {
    width: 100% !important;
    min-width: 0 !important;
  }
  .filter-bar .d-flex.flex-row.flex-nowrap {
    flex-direction: column !important;
    align-items: stretch !important;
    overflow-x: visible !important;
    white-space: normal !important;
  }
  .vote-legend-grid {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .vote-legend-item {
    min-width: 0 !important;
    width: 100% !important;
    flex: 1 1 100% !important;
    font-size: 1rem !important;
  }
  .member-info-mobile {
    margin-top: 1.5rem !important;
    margin-bottom: 0.5rem !important;
  }
  .voting-header {
    padding-bottom: 1.2rem !important;
  }
  .vote-legend-grid {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0.3rem 0.7rem !important;
    margin: 0.2rem auto 0.2rem auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .vote-legend-item {
    min-width: 90px !important;
    max-width: 48vw !important;
    flex: 1 1 45%;
    font-size: 0.97rem !important;
    padding: 0.18rem 0.5rem !important;
    margin: 0 !important;
    justify-content: flex-start !important;
    white-space: normal !important;
  }
  .vote-label,
  .vote-count {
    font-size: 0.97rem !important;
  }
}

@media (max-width: 768px) {
  .member-select {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    text-align: center !important;
  }
}

@media (max-width: 767.98px) {
  .vote-legend-grid-2col {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 0.5rem 0.5rem;
  }
  .vote-legend-grid-2col .vote-legend-item {
    flex: 0 0 50%;
    max-width: 50%;
    min-width: 0;
    margin-bottom: 0.25rem;
    box-sizing: border-box;
    justify-content: flex-start;
  }
}

@media (max-width: 767.98px) {
  /* Kompaktere Member Info Box auf Mobilgeräten */
  .member-info-mobile .card {
    padding: 0.75rem !important;
    min-height: 6rem !important;
    display: flex !important;
    align-items: center !important;
  }

  .member-info-mobile .card > .d-flex {
    align-items: center !important;
    width: 25% !important;
    gap: 0.75rem !important;
  }

  .member-info-mobile img.rounded-circle {
    width: 4.5rem !important;
    height: 4.5rem !important;
    margin: auto 0 !important;
  }

  .member-info-mobile .card-body {
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 0.25rem !important;
  }

  .member-info-mobile p {
    margin: 0 !important;
    font-size: 0.875rem !important;
    line-height: 1.4 !important;
  }

  .member-info-mobile p:last-child {
    margin-bottom: 0 !important;
  }

  .member-info-mobile .group-logo {
    width: 1.5rem !important;
    height: 1.5rem !important;
  }

  /* Speeches in einer Zeile halten */
  .member-info-mobile .info-row,
  .member-info .info-row {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    gap: 0.25rem !important;
  }

  .member-info-mobile .info-row a,
  .member-info .info-row a {
    text-overflow: ellipsis !important;
    overflow: hidden !important;
    white-space: nowrap !important;
  }

  .member-info-badge {
    flex-shrink: 0 !important;
    margin-right: 0.25rem !important;
  }

  /* Vertikale Zentrierung der Flex-Container */
  .member-info-mobile .d-flex.align-items-center {
    gap: 0.25rem !important;
  }

  .member-info-mobile .d-flex.flex-row {
    align-items: center !important;
  }

  /* Vote Legend Mobile Styles */
  .vote-legend-mobile {
    width: 100% !important;
    margin: 1.5rem auto 0 !important;
  }

  .vote-legend-mobile .row {
    margin: 0 !important;
    width: 100% !important;
  }

  .vote-legend-mobile .col-6 {
    padding: 0.25rem !important;
    width: 100% !important;
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }

  .vote-legend-mobile .vote-legend-item {
    display: flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
    font-size: 0.7rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 140px !important;
  }

  .vote-legend-mobile .vote-legend-color {
    min-width: 8px !important;
    width: 8px !important;
    height: 8px !important;
    flex-shrink: 0 !important;
  }

  .vote-legend-mobile .vote-legend-text {
    font-size: 0.7rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 0 !important;
    flex: 1 !important;
  }
}
