/* Scoped styles for the interactive ballot */
.stimmzettel-app table.stimmzettel {
  border-collapse: collapse;
  border: none;
}

.stimmzettel-app th,
.stimmzettel-app td {
  min-width: 1em;
  vertical-align: top;
}

.stimmzettel-app th.stimmzettel,
.stimmzettel-app td.stimmzettel {
  border: 1px solid #000;
}

.stimmzettel-app h3 {
  text-align: center;
  margin: 0.25em 0;
}

.stimmzettel-app .nr {
  font-size: 67%;
}

.stimmzettel-app .stimmenPartei {
  text-align: right;
  color: #009900;
}

.stimmzettel-app .leerraum {
  border: none;
}

.stimmzettel-app .listenkreuz {
  width: 1em;
  height: 1em;
  border: 0.1em solid #000;
  text-align: center;
  border-radius: 0.75em;
  float: right;
  font-size: 2em;
  overflow: visible;
  vertical-align: top;
  margin: 0.25em;
}

.stimmzettel-app td.barriere {
  border-bottom: 3px solid #000;
}

.stimmzettel-app .fehler,
.stimmzettel-app .warnung,
.stimmzettel-app .info {
  display: block;
  padding: 0.25em;
  margin: 0.5em;
  border-radius: 0.25em;
}

.stimmzettel-app #fehler_warnungen {
  display: inline-block;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  margin: -2em 0 0 0;
  z-index: 5;
}

.stimmzettel-app .fehler {
  color: #c00000;
  background: #ff9999;
  border: 1px solid #c00000;
}
.stimmzettel-app .fehler::before {
  content: "⛔ ";
}

.stimmzettel-app .warnung {
  color: #999900;
  background: #ffff99;
  border: 1px solid #999900;
}
.stimmzettel-app .warnung::before {
  content: "⚠ ";
}

.stimmzettel-app .info {
  color: #0000ff;
  background: #9999ff;
  border: 1px solid #0000ff;
}
.stimmzettel-app .info::before {
  content: "ⓘ ";
}

.stimmzettel-app .container {
  margin-left: 1em;
  margin-right: 1em;
}

.stimmzettel-app #stimmzettelPapier {
  text-align: left;
  padding: 1em;
  display: block;
  margin: 1em auto;
  max-width: 100%;
  box-sizing: border-box;
}

/* Horizontal scroll wrapper (mobile + desktop) */
.stimmzettel-app .stimmzettel-scroll {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* ensure the table can become wider than viewport */
.stimmzettel-app table#Stimmzettel {
  width: max-content;
  min-width: 100%;
}

/* --- Scroll UI (slider + hint) --- */
.stimmzettel-app .stimmzettel-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #b30000 0%, #cc0000 100%);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 10;
}

.stimmzettel-app .stimmzettel-scroller {
  flex: 1;
  min-width: 0;
  height: 24px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  cursor: pointer;
}

.stimmzettel-app .stimmzettel-scroller::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  background: #fff;
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  border: 3px solid #b30000;
}

.stimmzettel-app .stimmzettel-scroller::-moz-range-thumb {
  width: 32px;
  height: 32px;
  background: #fff;
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  border: 3px solid #b30000;
}

.stimmzettel-app .stimmzettel-scroller::-webkit-slider-runnable-track {
  height: 24px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 12px;
}

.stimmzettel-app .stimmzettel-scroller::-moz-range-track {
  height: 24px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 12px;
}

.stimmzettel-app .stimmzettel-hint {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.stimmzettel-app .stimmzettel-scroll-arrows {
  display: flex;
  gap: 8px;
}

.stimmzettel-app .stimmzettel-arrow-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #b30000;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s, background 0.1s;
}

.stimmzettel-app .stimmzettel-arrow-btn:hover {
  background: #f0f0f0;
  transform: scale(1.1);
}

.stimmzettel-app .stimmzettel-arrow-btn:active {
  transform: scale(0.95);
}

/* Scroll-snap: helpful on mobile/trackpad, still allows fine scrolling */
.stimmzettel-app .stimmzettel-scroll {
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
}

.stimmzettel-app .stimmzettel-snap {
  scroll-snap-align: center;
}

/* Mobile tweaks */
@media (max-width: 600px) {
  .stimmzettel-app #stimmzettelPapier {
    padding: 0.25em;
    margin: 0.25em auto;
  }

  .stimmzettel-app th,
  .stimmzettel-app td {
    font-size: 0.75em;
    padding: 2px 3px;
  }

  .stimmzettel-app th.stimmzettel {
    min-width: 120px;
    max-width: 160px;
  }

  /* Kandidaten-Namen-Spalte */
  .stimmzettel-app td.stimmzettel[id^="k"] {
    min-width: 80px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Kreuz-Zellen (3 pro Kandidat) */
  .stimmzettel-app td.stimmzettel:not([id^="k"]):not(.nr) {
    width: 22px !important;
    min-width: 22px !important;
    max-width: 22px !important;
    padding: 2px !important;
    text-align: center;
  }

  /* Nummern-Spalte */
  .stimmzettel-app td.nr {
    width: 28px !important;
    min-width: 28px !important;
    max-width: 28px !important;
    padding: 2px !important;
    text-align: center;
  }

  .stimmzettel-app .listenkreuz {
    font-size: 1.4em;
    margin: 0.15em;
  }

  .stimmzettel-app h3 {
    font-size: 0.9em;
  }

  .stimmzettel-app td.leerraum,
  .stimmzettel-app th.leerraum {
    width: 6px !important;
    min-width: 6px !important;
    max-width: 6px !important;
  }

  .stimmzettel-app .container {
    margin-left: 0.25em;
    margin-right: 0.25em;
  }
}

@media (max-width: 768px) {
  .stimmzettel-app .stimmzettel-toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
  }

  .stimmzettel-app .stimmzettel-scroller {
    order: 1;
    flex: 1 1 100%;
  }

  .stimmzettel-app .stimmzettel-hint {
    order: 2;
    flex: 1;
    white-space: normal;
    font-size: 0.85rem;
    text-align: center;
  }

  .stimmzettel-app .stimmzettel-scroll-arrows {
    order: 3;
  }
}

/* Tablet: moderate column widths */
@media (min-width: 601px) and (max-width: 1024px) {
  .stimmzettel-app th.stimmzettel {
    min-width: 150px;
    max-width: 200px;
  }

  .stimmzettel-app td.kandidat {
    max-width: 150px;
  }
}
