/*
  Stile für den KI-Bildgenerator (seniorentreff.ai/bilder/)
  Angelehnt an ratgeber/styles.css und musik/styles.css
*/

:root {
  --base-font-size: 18px;
  --font-family: "Arial", "Helvetica", sans-serif;
  --background-color: #ffffff;
  --text-color: #222222;
  --primary-color: #20539a;
  --secondary-color: #3f79c7;
  --accent-color: #1a7a3c;
  --border-radius: 6px;
  --card-bg: #f4f8ff;
}

* { box-sizing: border-box; }

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: 960px;
  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, .controls a {
  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;
  text-decoration: none;
  display: inline-block;
}
.controls button:hover, .controls a:hover { background: #5591d8; }

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

.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; }

/* ===== LIMIT ===== */
.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;
}
.limit-dot.used { background: var(--secondary-color); }

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

/* ===== THEMA-PRESETS ===== */
.theme-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.theme-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;
}
.theme-btn:hover, .theme-btn.active {
  background: var(--secondary-color);
  color: #ffffff;
}

/* ===== PROMPT-EINGABE ===== */
.prompt-area {
  width: 100%;
  min-height: 80px;
  font-size: 1rem;
  font-family: var(--font-family);
  border: 2px solid #aac0e0;
  border-radius: var(--border-radius);
  padding: 0.7rem;
  resize: vertical;
  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; }

/* ===== STIL & FORMAT ===== */
.options-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
  align-items: flex-start;
}

.option-group { flex: 1; min-width: 200px; }
.option-group label { font-weight: bold; color: var(--primary-color); display: block; margin-bottom: 0.4rem; }

.style-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.style-pill {
  background: var(--card-bg);
  border: 2px solid #aac0e0;
  color: var(--text-color);
  padding: 0.35rem 0.75rem;
  border-radius: 16px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: var(--font-family);
  transition: background 0.15s, border-color 0.15s;
}
.style-pill:hover { border-color: var(--secondary-color); }
.style-pill.active {
  background: #dce8f8;
  border-color: var(--primary-color);
  font-weight: bold;
}

/* ===== 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;
  margin-bottom: 1.5rem;
}
.generate-btn:hover:not(:disabled) { background: #15693a; }
.generate-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ===== FEHLER ===== */
.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; }

/* ===== SPINNER ===== */
.spinner {
  display: none;
  text-align: center;
  padding: 2rem;
  color: var(--primary-color);
}
.spinner.visible { display: block; }

.spinner-dots {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 0.7rem;
}
.spinner-dots span {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--primary-color);
  animation: pulse 1.2s infinite ease-in-out;
}
.spinner-dots span:nth-child(2) { animation-delay: 0.2s; }
.spinner-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%       { opacity: 1.0; transform: scale(1.2); }
}

/* ===== BILD-ANZEIGE ===== */
.result-box {
  display: none;
  margin-bottom: 1.5rem;
}
.result-box.visible { display: block; }

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

.result-img-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  border: 2px solid var(--secondary-color);
  border-radius: 8px;
  overflow: hidden;
}

.result-img-wrap img {
  display: block;
  max-width: 100%;
  height: auto;
}

.result-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 0.8rem;
  flex-wrap: wrap;
  align-items: center;
}

.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); }

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

/* ===== 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-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.history-item {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 1px solid #c0d0ea;
}
.history-item img {
  width: 100%;
  height: auto;
  display: block;
}
.history-item-label {
  font-size: 0.78rem;
  color: #555;
  padding: 0.4rem 0.6rem;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-dl {
  display: block;
  text-align: center;
  font-size: 0.82rem;
  color: var(--primary-color);
  text-decoration: none;
  padding: 0.3rem;
  border-top: 1px solid #c0d0ea;
  font-weight: bold;
}
.history-item-dl:hover { background: #dce8f8; }

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

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

@media (max-width: 600px) {
  .header-content { flex-wrap: wrap; }
  .controls { order: 3; width: 100%; justify-content: flex-end; }
  .options-row { flex-direction: column; }
  .history-grid { grid-template-columns: repeat(2, 1fr); }
}
