/* Allgemeines Layout */
body {
  font-family: Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 0;
  background: #f7f7f7;
  color: #333;
}

header {
  background: #4caf50;
  color: white;
  padding: 1rem;
  text-align: center;
}

nav {
  display: flex;
  gap: 0.5rem;
  background: #eee;
  padding: 0.5rem;
  overflow-x: auto;
  border-bottom: 1px solid #ddd;
}

nav button {
  flex: 1;
  padding: 0.6rem;
  border: none;
  background: #ddd;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 4px;
  transition: background 0.3s;
}

nav button.active,
nav button:hover {
  background: #4caf50;
  color: white;
}

/* Container für die Überschrift und den Button zum Hinzufügen eines Kindes. Das
   Element platziert Überschrift links und den Button rechts. */
.child-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* Button zum Ein‑ und Ausblenden des Kinderformulars in der Kopfzeile. Er soll
   unauffällig sein und am rechten Rand positioniert werden. */
#toggleAddChildFormBtn {
  background: #2196f3;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  font-size: 0.9rem;
}
#toggleAddChildFormBtn:hover {
  background: #1976d2;
}

main {
  padding: 1rem;
}

section {
  display: none;
}

section.active {
  display: block;
}

form {
  margin-top: 1rem;
  background: #fff;
  padding: 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

form input,
form select {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.2rem;
  margin-bottom: 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

form button[type="submit"] {
  padding: 0.6rem 1.2rem;
  border: none;
  background: #4caf50;
  color: white;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
}

form button[type="submit"]:hover {
  background: #45a049;
}

.list {
  margin-top: 1rem;
}

.list-item {
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0.8rem;
  margin-bottom: 0.6rem;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-item .info {
  flex: 1;
}

.list-item .actions button {
  margin-left: 0.5rem;
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
}

.list-item .actions button.inc {
  background: #4caf50;
  color: white;
}

.list-item .actions button.dec {
  background: #f44336;
  color: white;
}

/* New action button for spending coins. The colour is a warm orange to
   differentiate it from the positive (green) and negative (red) point
   buttons. */
.list-item .actions button.spend {
  background: #ff9800;
  color: white;
}

/* Progress bar container used to visualise how close a child is to the next
   coin. It sits below the other information and stretches across the
   available width. */
.progress-bar {
  width: 100%;
  height: 0.4rem;
  background: #ddd;
  border-radius: 4px;
  margin-top: 0.3rem;
  overflow: hidden;
}

/* The fill element inside the progress bar will be coloured dynamically via
   inline styles. A subtle transition makes the change in width less abrupt. */
.progress-fill {
  height: 100%;
  width: 0%;
  background: #4caf50;
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Sterne-Darstellung für den Fortschritt: zeigt bis zu fünf Sterne pro Kind,
   die gefüllt oder leer sein können. */
.stars {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem;
  font-size: 0.9rem;
  margin-top: 0.3rem;
}

/* Schnelle Kategorievergabe im Kinderreiter. Die Auswahl und der Button
   befinden sich nebeneinander und sind kompakt gestaltet. */
.quick-cat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.3rem;
}
.quick-cat select {
  flex: 1;
  padding: 0.3rem;
  font-size: 0.9rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.quick-cat button.apply-cat-btn {
  padding: 0.3rem 0.6rem;
  border: none;
  border-radius: 4px;
  background: #4caf50;
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
}
.quick-cat button.apply-cat-btn:hover {
  background: #45a049;
}

/* Kompakte Farbeingabe: Farbe ist als Quadrat sichtbar, nicht als langes Feld. */
input[type="color"] {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* Lösch-Button in der Statistik. Rot, damit klar ist, dass hier etwas
   Unwiderrufliches passiert. */
.stats-delete-btn {
  background: #f44336;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
}
.stats-delete-btn:hover {
  background: #e53935;
}

/* Statistikbereich: Chart und Filter */
.stats-chart-container {
  margin-top: 1rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 1rem;
}
.stats-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.8rem;
}
.stats-filter-row label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: bold;
  font-size: 0.9rem;
}
.stats-filter-row select {
  padding: 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
}
.chart-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}
.chart-buttons button {
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 4px;
  background: #ddd;
  cursor: pointer;
  font-size: 0.9rem;
}
.chart-buttons button:hover {
  background: #ccc;
}
.chart-buttons button.active {
  background: #4caf50;
  color: white;
}

/* Detailsliste unter dem Statistikdiagramm */
.stats-details {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #333;
}
.stats-details ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.stats-details li {
  margin-bottom: 0.2rem;
}

footer {
  text-align: center;
  padding: 1rem;
  background: #eee;
  color: #777;
  font-size: 0.9rem;
}