/* ═══════════════════════════════════════════════════════════════════════════
   KonzernTV Social Media Slideshow — Haupt-Stylesheet
   2-Phasen Darstellung: Phase1=Bild zentriert | Phase2=Bild links+rotiert+Text
   Optimiert für 1920×1080 (16:9), BrightSign Chromium
   ═══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, rgba(113,12,47,1) 0%, rgba(69,0,13,1) 100%);
  overflow: hidden;
  font-family: 'Helvetica Neue', Arial, 'Liberation Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  color: #ffffff;
}

/* ── Slideshow Container ─────────────────────────────────────────────────── */

.slideshow {
  position: relative;
  width: 100vw; height: 100vh;
  overflow: hidden;
}

/* ── Slide (A/B Crossfade) ───────────────────────────────────────────────── */

.slide {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity 0.7s ease-in-out;
  overflow: hidden;
}
.slide.active { opacity: 1; }

/* ── Dunkler Hintergrund (Quelle-Farbton) ────────────────────────────────── */

.slide-bg-color {
  position: absolute; inset: 0;
  z-index: 0;
}

/* ── Großes Quellen-Wasserzeichen im Hintergrund ─────────────────────────── */

.slide-watermark {
  position: absolute;
  right: 3%;
  top: 50%;
  transform: translateY(-50%);
  width: 14vmin; height: 14vmin;
  opacity: 0.3;
  z-index: 1;
  color: #fff;
  pointer-events: none;
  transition: width 1.1s cubic-bezier(0.4,0,0.2,1),
              height 1.1s cubic-bezier(0.4,0,0.2,1),
              opacity 0.8s ease;
}
.slide-watermark svg { width: 100%; height: 100%; }

/* Phase 2 (mit Bild): Wasserzeichen groß, gering opazität */
.slide-watermark.phase2 {
  width: 44vmin; height: 44vmin;
  opacity: 0.08;
}

/* Text-only Posts: Wasserzeichen sofort groß */
.slide-watermark.large {
  width: 44vmin; height: 44vmin;
  opacity: 0.08;
}

/* ══════════════════════════════════════════════════════════════════════════
   POSTS MIT BILD — Phase 1: Bild zentriert
   ══════════════════════════════════════════════════════════════════════════ */

.slide-image-wrap {
  position: absolute;
  z-index: 2;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 28px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.05);
  transform-origin: center center;

  /* Phase 1: zentriert */
  top: 5%; height: 88%;
  left: 50%; width: 63%;
  transform: translateX(-50%) perspective(1400px) rotateY(0deg);

  transition:
    left   1.1s cubic-bezier(0.4, 0, 0.2, 1),
    width  1.1s cubic-bezier(0.4, 0, 0.2, 1),
    top    1.1s cubic-bezier(0.4, 0, 0.2, 1),
    height 1.1s cubic-bezier(0.4, 0, 0.2, 1),
    transform     1.1s cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 1.1s ease,
    box-shadow    1.1s ease;
  will-change: transform;
}

/* Phase 2: links + Perspektive-Rotation — kein Crop, Rahmen groß genug */
.slide-image-wrap.phase2 {
  top: 3%; height: 92%;
  left: 2%; width: 30%;
  transform: translateX(0) perspective(1400px) rotateY(20deg);
  border-radius: 8px;
  box-shadow: -30px 20px 70px rgba(0,0,0,0.75), 0 0 0 1px rgba(255,255,255,0.04);
}

.slide-image {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

/* In Phase 2: weiterhin contain — kein Crop */

/* Video-Icon im Bild */
.slide-video-icon {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(50px, 5.5vw, 88px);
  height: clamp(50px, 5.5vw, 88px);
  background: rgba(0,0,0,0.45);
  border: 2.5px solid rgba(255,255,255,0.7);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(18px, 2vw, 32px);
  padding-left: 5%;
  backdrop-filter: blur(4px);
}

/* Badge entfernt — Plattform-Logo wird als Wasserzeichen rechts angezeigt */

/* ── Textpanel (Phase 2): rechts neben dem Bild ─────────────────────────── */

.slide-text-panel {
  position: absolute;
  left: 35%; right: 3%;
  top: 6%; bottom: 8%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(14px, 2vh, 28px);
  opacity: 0;
  transform: translateX(35px);
  transition: opacity 0.8s ease 0.55s, transform 0.8s ease 0.55s;
  pointer-events: none;
}
.slide-text-panel.phase2 {
  opacity: 1;
  transform: translateX(0);
}

/* slide-source-line entfernt */

/* ══════════════════════════════════════════════════════════════════════════
   POSTS OHNE BILD — zentriert
   ══════════════════════════════════════════════════════════════════════════ */

.slide-center-content {
  position: absolute; inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 2.5vh, 36px);
  padding: 5% 14%;
  text-align: center;
}
.slide-center-content .slide-author {
  flex-direction: column; align-items: center; text-align: center;
}
.slide-center-content .slide-text {
  line-clamp : var(--line-clamp, 6);
  font-size: clamp(22px, 2.8vw, 48px);
  text-align: center;
}

/* ── Autor ───────────────────────────────────────────────────────────────── */

.slide-author {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.2vw, 20px);
}

.slide-avatar {
  width: clamp(42px, 4.5vw, 72px);
  height: clamp(42px, 4.5vw, 72px);
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
  background: rgba(255,255,255,0.08);
}

.slide-author-name {
  display: block;
  font-size: clamp(16px, 1.9vw, 32px);
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 1px 4px rgba(0,0,0,0.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.slide-date {
  display: block;
  font-size: clamp(11px, 1.1vw, 19px);
  opacity: 0.6;
  margin-top: 0.2em;
}

/* ── Post-Text ───────────────────────────────────────────────────────────── */

.slide-text {
  font-size: clamp(22px, 2.8vw, 48px);
  line-height: 1.52;
  font-weight: 400;
  text-shadow: 0 1px 5px rgba(0,0,0,0.5);
  display: -webkit-box;
  line-clamp: var(--line-clamp, 6);
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  hyphens: auto;
}

/* ── Fortschrittsbalken ──────────────────────────────────────────────────── */

.progress-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 4px;
  z-index: 9999;
  display: flex;
  gap: 3px;
}
.progress-segment {
  /* flex-grow wird per JS als proportionale Dauer gesetzt */
  height: 100%;
  background: rgba(255,255,255,0.15);
  overflow: hidden;
}
.progress-segment-fill {
  height: 100%;
  background: rgba(255,255,255,0.85);
  width: 0%;
}

/* ── Offline-Hinweis ─────────────────────────────────────────────────────── */

.offline-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  background: rgba(190,30,30,0.92);
  color: #fff;
  text-align: center;
  font-size: clamp(12px, 1.3vw, 20px);
  font-weight: 500;
  padding: 0.4em 1em;
  z-index: 200;
  transform: translateY(-110%);
  transition: transform 0.45s ease;
}
.offline-bar.visible { transform: translateY(0); }

/* ── Leerer Zustand ──────────────────────────────────────────────────────── */

.empty-state {
  display: none;
  position: absolute; inset: 0;
  flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1.5em;
  color: rgba(255,255,255,0.25);
  font-size: clamp(18px, 2.2vw, 36px);
  z-index: 5;
}
.empty-state.visible { display: flex; }
