/* basis reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #007bff;
  --bg-color: #ffffff;
  --text-color: #333;
  --border-color: #dddddd;
  --footer-bg: #f8f8f8;
}

/* Body etc. */
body {
  font-family: 'Segoe UI', Tahoma, Verdana, sans-serif;
  background: #f4f4f4;
  color: var(--text-color);
}

/* Header */
.main-bar {
  background: var(--bg-color);
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
}
.main-bar h1 {
  font-size: 24px;
}

/* Container */
.main {
  min-height: calc(100vh - 84px - 60px - 20px);
}

.container {
  max-width: 900px;
  margin: 20px auto;
  background: var(--bg-color);
  padding: 20px 30px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* Tabs */
.tab-container {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 20px;
  cursor: pointer;
  font-weight: bold;
  border-bottom: 3px solid transparent;
  transition: 0.3s border-bottom;
}
.tab.active {
  border-bottom: 3px solid var(--primary-color);
}

/* Form */
.form-container {
  display: none;
}
.form-container.active {
  display: block;
}
form {
  display: flex;
  flex-direction: column;
}
label {
  margin-bottom: 5px;
  font-weight: bold;
}
input[type="number"],
.custom-select input {
  padding: 10px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 16px;
}

/* Custom select */
.custom-select {
  position: relative;
  margin-bottom: 20px;
}
.custom-select input {
  width: 100%;
  cursor: pointer;
}
.custom-select .options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  max-height: 200px;
  overflow-y: auto;
  display: none;
  list-style: none;
  z-index: 1;
}
.custom-select .options li {
  padding: 10px;
  cursor: pointer;
  transition: 0.2s background;
}
.custom-select .options li:hover {
  background: var(--primary-color);
  color: #fff;
}

/* Button */
button {
  padding: 12px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
}
button:hover {
  background: #006ae6;
}

/* Loader */
#loader.hidden {
  display: none !important;
}
#loader {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 0;
}
.spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

/* Ergebnis */
#ergebnis.hidden {
  display: none !important;
}
#ergebnis {
  margin-top: 30px;
  padding: 20px;
  background: #fafafa;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}
/* Darstellungsbereich */
#schieneDarstellung {
  overflow: auto;
  text-align: center;
}
/* Für mobile: vertikal scrollen erlauben */
@media (max-width: 768px) {
  #schieneDarstellung {
    max-height: 80vh;
    overflow-y: auto;
  }
}

/* Footer */
.footer {
  width: 100%;
  background: var(--footer-bg);
  border-top: 1px solid var(--border-color);
  padding: 10px 20px;
  text-align: center;
  font-size: 14px;
  margin-top: 20px;
}
.footer .footer-content p {
  margin: 5px 0;
}
.footer a {
  color: var(--primary-color);
  text-decoration: none;
}
.footer a:hover {
  text-decoration: underline;
}

/* Toast */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}
.toast {
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px 15px;
  margin-top: 10px;
  border-radius: 4px;
  opacity: 0;
  transform: translateY(-20px);
  animation: fadein 0.3s forwards, fadeout 0.5s 2.5s forwards;
  max-width: 300px;
  word-wrap: break-word;
}
@keyframes fadein {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeout {
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* PWA notice */
.a2hs-notice {
  display: none;
}
@media (max-width: 768px) {
  .a2hs-notice {
    display: flex;
    position: fixed;
    bottom: 10px;
    left: 10px;
    right: 10px;
    background: var(--primary-color);
    color: #fff;
    padding: 10px 15px;
    border-radius: 4px;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    z-index: 999;
  }

  .a2hs-notice button {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
  }
}

/* SMOOTH TOGGLE-BEREICH */
.toggle-outer {
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}
.toggle-header {
  display: flex;
  align-items: center;
  padding: 10px;
  background: #f1f1f1;
  cursor: pointer;
}
.toggle-arrow {
  font-size: 0; /* icon übernehmen wir via SVG */
  margin-right: 5px;
}
.toggle-label {
  font-size: 16px;
}
.toggle-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 10px;
}

/* Neues SVG-Pfeil-Icon + Drehung */
.arrow-svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transform: rotate(0deg);
  transition: transform 0.3s ease;
}
.arrow-svg.open {
  transform: rotate(90deg);
}

/* Responsiv */
@media (max-width: 600px) {
  .container {
    margin: 15px;
    padding: 15px 20px;
  }
  .tab {
    font-size: 14px;
    padding: 8px 12px;
  }
  button {
    font-size: 14px;
    padding: 8px;
  }
}

/* Pfeil-Buttons und PDF-Button */
.small-nav-btn {
  font-size: 14px;
  padding: 6px 10px;
  margin: 2px;
  background: #666;
  color: #fff;
  border: 1px solid #555;
  cursor: pointer;
  border-radius: 4px;
}
.small-nav-btn:hover {
  background: #555;
}
.small-nav-btn:disabled {
  cursor: not-allowed;
  background: #9e9e9e;
  border-color: #757575;
}
.arrow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Ergebnis-Leiste: PDF-Button links, Pfeilnavigation rechts */
#ergebnis > div:nth-child(1) > div:nth-child(2) {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
}
@media (min-width: 601px) {
  #ergebnis > div:nth-child(1) > div:nth-child(2) {
    flex-direction: row;
    align-items: center;
    justify-content: space-between; /* button links, arrows rechts */
  }
}
