/*
  Stile für den KI-Musikgenerator (seniorentreff.ai/musik/)
  Design: seniorenfreundlich, große Schrift, hohe Kontraste.
  Angelehnt an ratgeber/styles.css für ein einheitliches Erscheinungsbild.
*/

:root {
  --base-font-size: 18px;
  --font-family: "Arial", "Helvetica", sans-serif;
  --background-color: #ffffff;
  --text-color: #222222;
  --primary-color: #20539a;       /* Seniorentreff-Blau */
  --secondary-color: #3f79c7;     /* helleres Blau für Buttons */
  --accent-color: #1a7a3c;        /* Grün für Erfolg / Generier-Button */
  --border-radius: 6px;
  --card-bg: #f4f8ff;
}

/* Grundlayout */
body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--base-font-size);
  background-color: var(--background-color);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== HEADER ===== */
header {
  background-color: var(--primary-color);
  color: #ffffff;
  padding: 0.5rem 1rem;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin: 0 auto;
  gap: 0.8rem;
}

.logo img {
  width: 58px;
  height: auto;
}

.title-group {
  flex: 1;
}

.title-group h1 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.2;
}

.title-group .subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  opacity: 0.88;
}

.controls {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-shrink: 0;
}

.controls button {
  background: var(--secondary-color);
  color: #ffffff;
  border: none;
  padding: 0.35rem 0.65rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: bold;
}

.controls button:hover {
  background: #5591d8;
}

/* ===== MAIN ===== */
main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
  box-sizing: border-box;
}

/* Intro-Text */
.intro {
  background: var(--card-bg);
  border-left: 4px solid var(--primary-color);
  border-radius: var(--border-radius);
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.intro p {
  margin: 0.4rem 0;
}

/* ===== GENRE-PRESETS ===== */
.section-label {
  font-weight: bold;
  font-size: 1.05rem;
  margin: 1.2rem 0 0.6rem;
  color: var(--primary-color);
}

.genre-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.genre-btn {
  background: var(--card-bg);
  border: 2px solid var(--secondary-color);
  color: var(--primary-color);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 1rem;
  font-family: var(--font-family);
  transition: background 0.15s, color 0.15s;
}

.genre-btn:hover,
.genre-btn.active {
  background: var(--secondary-color);
  color: #ffffff;
}

/* ===== PROMPT-EINGABE ===== */
.prompt-area {
  width: 100%;
  min-height: 90px;
  font-size: 1rem;
  font-family: var(--font-family);
  border: 2px solid #aac0e0;
  border-radius: var(--border-radius);
  padding: 0.7rem;
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.5;
  color: var(--text-color);
}

.prompt-area:focus {
  outline: 3px solid var(--secondary-color);
  border-color: var(--secondary-color);
}

.prompt-hint {
  font-size: 0.82rem;
  color: #666;
  margin: 0.3rem 0 1rem;
}

/* ===== MODELL-WAHL ===== */
.model-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.model-row label {
  font-weight: bold;
  color: var(--primary-color);
}

.model-option {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  background: var(--card-bg);
  border: 2px solid #aac0e0;
  border-radius: var(--border-radius);
  padding: 0.4rem 0.8rem;
  transition: border-color 0.15s;
}

.model-option input[type="radio"] {
  accent-color: var(--primary-color);
  width: 18px;
  height: 18px;
}

.model-option:has(input:checked) {
  border-color: var(--primary-color);
  background: #dce8f8;
}

.model-badge {
  font-size: 0.75rem;
  background: var(--primary-color);
  color: #fff;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  margin-left: 0.3rem;
}

/* ===== GENERATE-BUTTON ===== */
.generate-btn {
  display: block;
  width: 100%;
  background: var(--accent-color);
  color: #ffffff;
  border: none;
  border-radius: var(--border-radius);
  padding: 0.85rem;
  font-size: 1.15rem;
  font-family: var(--font-family);
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  margin-bottom: 1.5rem;
}

.generate-btn:hover:not(:disabled) {
  background: #15693a;
}

.generate-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ===== LIMIT-ANZEIGE ===== */
.limit-bar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #555;
}

.limit-dots {
  display: flex;
  gap: 5px;
}

.limit-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--secondary-color);
  background: #fff;
  display: inline-block;
}

.limit-dot.used {
  background: var(--secondary-color);
}

/* ===== LADE-ANIMATION ===== */
.spinner {
  display: none;
  text-align: center;
  padding: 1.5rem;
  color: var(--primary-color);
}

.spinner.visible {
  display: block;
}

.spinner-wave {
  display: inline-flex;
  gap: 5px;
  align-items: flex-end;
  height: 36px;
  margin-bottom: 0.6rem;
}

.spinner-wave span {
  display: inline-block;
  width: 8px;
  background: var(--primary-color);
  border-radius: 4px;
  animation: wave 1.0s infinite ease-in-out;
}

.spinner-wave span:nth-child(2) { animation-delay: 0.1s; }
.spinner-wave span:nth-child(3) { animation-delay: 0.2s; }
.spinner-wave span:nth-child(4) { animation-delay: 0.3s; }
.spinner-wave span:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
  0%, 100% { height: 8px; }
  50%       { height: 32px; }
}

/* ===== AUDIO-PLAYER ===== */
.player-box {
  display: none;
  background: var(--card-bg);
  border: 2px solid var(--secondary-color);
  border-radius: var(--border-radius);
  padding: 1.2rem;
  margin-bottom: 1rem;
  text-align: center;
}

.player-box.visible {
  display: block;
}

.player-box h3 {
  margin: 0 0 0.8rem;
  color: var(--primary-color);
  font-size: 1.1rem;
}

.player-box audio {
  width: 100%;
  margin-bottom: 0.8rem;
}

.download-btn {
  display: inline-block;
  background: var(--primary-color);
  color: #ffffff;
  text-decoration: none;
  padding: 0.5rem 1.2rem;
  border-radius: var(--border-radius);
  font-size: 0.95rem;
  font-weight: bold;
}

.download-btn:hover {
  background: var(--secondary-color);
}

.player-prompt-label {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.6rem;
  font-style: italic;
}

/* ===== FEHLER-MELDUNG ===== */
.error-box {
  display: none;
  background: #fff0f0;
  border: 2px solid #d94040;
  border-radius: var(--border-radius);
  padding: 0.9rem 1.2rem;
  color: #b00000;
  margin-bottom: 1rem;
}

.error-box.visible {
  display: block;
}

/* ===== VERLAUF ===== */
.history-section {
  margin-top: 2rem;
}

.history-section h2 {
  font-size: 1.05rem;
  color: var(--primary-color);
  border-bottom: 2px solid var(--secondary-color);
  padding-bottom: 0.3rem;
  margin-bottom: 0.8rem;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.history-item {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.history-item audio {
  flex: 1;
  min-width: 200px;
}

.history-prompt {
  font-size: 0.85rem;
  color: #555;
  flex-basis: 100%;
  margin-top: 0.3rem;
  font-style: italic;
}

/* ===== ADSENSE ===== */
.adsense-wrap {
  max-width: 900px;
  margin: 0.5rem auto 1rem;
  padding: 0 1rem;
  text-align: center;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .header-content {
    flex-wrap: wrap;
  }
  .controls {
    order: 3;
    width: 100%;
    justify-content: flex-end;
  }
  .model-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Screenreader-Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}
