* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 1rem;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fafafa;
}

.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

h1 {
  font-size: 1.6rem;
  font-weight: 500;
  margin: 0 0 0.5rem 0;
  color: #222;
}

.input-area {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.input-area label {
  font-weight: 500;
  color: #333;
  white-space: nowrap;
}

input[type="number"] {
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid #aaa;
  border-radius: 6px;
  width: 160px;
  background: white;
}

input:focus {
  outline: 2px solid #0066cc;
  border-color: transparent;
}

.modi-container {
  display: flex;
  flex-direction: column;
}

.modi-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 32px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-weight: 500;
  color: #333;
}

.checkbox-label.half-round-label {
  color: #666;
}

.checkbox-label.half-round-label.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.checkbox-label input:disabled {
  cursor: not-allowed;
}

.toggle-row {
  gap: 10px;
  margin-top: 4px;
  transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease;
  overflow: hidden;
  max-height: 50px;
  opacity: 1;
}

.toggle-row.hidden {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
  pointer-events: none;
}

.toggle-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
}

.switch {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.2s;
  border-radius: 28px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

input:checked + .slider {
  background-color: #2b7a4b;
}

input:checked + .slider:before {
  transform: translateX(28px);
}

.dropdown-container {
  position: relative;
  display: inline-block;
}

.download-btn {
  background-color: #2b7a4b;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background-color 0.2s, transform 0.1s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  white-space: nowrap;
}

.download-btn:hover {
  background-color: #1e5f3a;
}

.download-btn:active {
  transform: scale(0.97);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 200px;
  z-index: 100;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 16px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid white;
}

.dropdown-menu button {
  background: none;
  border: none;
  padding: 10px 16px;
  text-align: left;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.1s;
}

.dropdown-menu button:hover {
  background-color: #f0f0f0;
}

.dropdown-menu.show {
  display: flex;
}

.table-wrapper {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 300px;
}

th {
  background: #e9e9e9;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: inset 0 -1px 0 #bbb;
}

th, td {
  padding: 0.75rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

tbody tr:nth-child(even) {
  background-color: #f5f5f5;
}

td:first-child, th:first-child {
  padding-left: 1rem;
}

td:last-child, th:last-child {
  padding-right: 1rem;
}

@media (max-width: 700px) {
  .input-area {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .modi-container {
    width: 100%;
  }
  .modi-row {
    justify-content: flex-start;
  }
  .download-btn {
    align-self: flex-start;
  }
  .dropdown-menu {
    left: auto;
    right: 0;
  }
  .dropdown-menu::before {
    left: auto;
    right: 16px;
  }
}

@media (max-width: 450px) {
  th, td {
    padding: 0.6rem 0.3rem;
    font-size: 0.85rem;
  }
}

.footer {
  margin-top: 0.75rem;
  text-align: center;
  border-top: 1px dashed #ccc;
  padding-top: 0.5rem;
  font-size: 0.9rem;
  color: #666;
}

/* Klausurspiegel spezifische Styles werden dynamisch erzeugt */
