/*
 * Corporate-Farben als CSS-Variablen – PLATZHALTER.
 * Sobald Fabian die echten j4p-Hex-Codes liefert, NUR diese Werte ersetzen.
 * Im gesamten CSS werden ausschließlich diese Variablen für Farben verwendet.
 */
:root {
  --color-primary: #1f4e5f; /* TODO: durch echten j4p-Markenfarbton ersetzen */
  --color-primary-dark: #143844; /* TODO */
  --color-accent: #e8a33d; /* TODO: Akzentfarbe, z. B. für Play-Button */
  --color-background: #ffffff; /* TODO */
  --color-text: #1a1a1a; /* TODO */
  --color-text-muted: #6b7280; /* TODO */
  --color-surface: #f5f7f8; /* TODO: Hintergrund für Karten/Ladeflächen */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--color-background);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--color-primary);
}

/* ---------- Case-Seite ---------- */

.case-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

.image-area {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  background: var(--color-surface);
  overflow: hidden;
  flex-shrink: 0;
}

.image-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 400ms ease;
}

.image-area img.visible {
  opacity: 1;
}

.image-shimmer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(
    100deg,
    var(--color-surface) 30%,
    #ffffff 50%,
    var(--color-surface) 70%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  transition: opacity 300ms ease;
}

.image-shimmer.hidden {
  opacity: 0;
  pointer-events: none;
}

.image-shimmer span {
  font-size: 14px;
  color: var(--color-text-muted);
  padding: 0 24px;
  text-align: center;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.image-area .idle-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 14px;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 12px;
  min-height: 0;
}

.case-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 12px;
  line-height: 1.2;
}

.case-text {
  font-size: 17px;
  line-height: 1.5;
  color: var(--color-text);
  overflow-y: auto;
  flex: 1;
}

.inactive-notice {
  font-size: 17px;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 40px;
}

.fallback-notice {
  font-size: 13px;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 8px;
}

.play-bar {
  position: sticky;
  bottom: 0;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  background: var(--color-background);
  display: flex;
  justify-content: center;
}

.play-button {
  width: 64px;
  height: 64px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--color-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.play-button svg {
  width: 28px;
  height: 28px;
}

.footer-links {
  text-align: center;
  padding: 4px 20px calc(10px + env(safe-area-inset-bottom));
  font-size: 12px;
  color: var(--color-text-muted);
}

.footer-links a {
  color: var(--color-text-muted);
  text-decoration: underline;
  margin: 0 6px;
}

/* ---------- Startseite ---------- */

.landing {
  max-width: 480px;
  margin: 60px auto;
  padding: 0 20px;
  text-align: center;
}

/* ---------- Admin ---------- */

.admin-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.admin-login {
  max-width: 360px;
  margin: 80px auto;
  padding: 0 20px;
  text-align: center;
}

.admin-login input {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 1px solid var(--color-surface);
  border-radius: 8px;
  margin: 12px 0;
}

.btn {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 15px;
  cursor: pointer;
}

.btn:hover {
  background: var(--color-primary-dark);
}

.btn.secondary {
  background: var(--color-surface);
  color: var(--color-text);
}

.error-message {
  color: #c0392b;
  font-size: 14px;
  min-height: 20px;
}

.case-card {
  background: var(--color-surface);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}

.case-card h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.case-card .slug {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.case-card textarea {
  width: 100%;
  min-height: 100px;
  font-size: 15px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #dfe3e5;
  font-family: inherit;
  resize: vertical;
}

.case-card .field-row {
  margin: 12px 0;
}

.case-card label {
  display: block;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.case-card audio {
  width: 100%;
}

.case-card .thumb {
  max-width: 160px;
  border-radius: 6px;
  display: block;
  margin-bottom: 8px;
}

.case-card .card-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.save-feedback {
  font-size: 14px;
  color: #1e8e3e;
  opacity: 0;
  transition: opacity 200ms ease;
}

.save-feedback.visible {
  opacity: 1;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
