/**
 * pview.css – Teilnehmer-Ansicht: Social-Media-Design
 * ====================================================
 * Orientiert an modernen Social-Media-Plattformen (Twitter/X, Facebook, Instagram).
 * Läuft als vollbild-Overlay über dem Director-Interface.
 * Mobile-first, max-width für Content-Panels auf Desktop.
 */

/* ── Root / Overlay ─────────────────────────────────────────────────────────── */
:root {
  --pv-bg:        #EFF2F5;
  --pv-card:      #FFFFFF;
  --pv-border:    #E4E6EB;
  --pv-text:      #1C1E21;
  --pv-text-mid:  #65676B;
  --pv-unread:    #0866FF;
  --pv-danger:    #E41E3F;
  --pv-radius:    12px;
  --pv-shadow:    0 1px 4px rgba(0,0,0,.10), 0 0 0 1px rgba(0,0,0,.04);
}

/* #pview display wird ausschließlich per JS gesteuert (display:none/flex).
   Kein display: in dieser Regel – würde das JS-gesteuerte display:none überschreiben. */
#pview {
  position: fixed;
  inset: 0;
  background: var(--pv-bg);
  flex-direction: column;         /* greift wenn JS display:flex setzt */
  font-family: var(--sans, 'Inter', -apple-system, sans-serif);
  z-index: 500;   /* über .v2-bar1 (300), .v2-bar2 (290), #sidebar (300) */
  -webkit-font-smoothing: antialiased;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.pv-header {
  background: var(--ink, #1C1E21);
  color: white;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 16px;
  min-height: 54px;
  flex-shrink: 0;
  border-bottom: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  z-index: 10;
}

.pv-header-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* Brand-Logo auf dunklem Header: weiß machen (nur .pv-brand-logo, nicht Kunden-Upload) */
#pv-logo-container img.pv-brand-logo {
  height: 28px;
  width: auto;
  filter: brightness(0) invert(1);
}

/* Kunden-Logo: Originalfarben erhalten */
#pv-logo-container img.pv-client-logo {
  height: 32px;
  width: auto;
  filter: none;
}

/* Fallback für Login-Modal-Logo */
#pv-login-logo img {
  height: 40px;
  width: auto;
  max-width: 180px;
}

#pv-logo-container span {
  color: white !important;
  font-size: 15px !important;
  font-weight: 600 !important;
}

.pv-header-center {
  flex: 1;
  min-width: 0;
}

.pv-header-org {
  font-size: 15px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pv-header-right {
  text-align: right;
  flex-shrink: 0;
}

.pv-header-user {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.95);
}

.pv-header-clock {
  font-family: var(--mono, monospace);
  font-size: 10px;
  color: rgba(255,255,255,.5);
  margin-top: 1px;
}

/* ── Scrollable Body ─────────────────────────────────────────────────────────── */
.pv-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 70px; /* bottom tab bar clearance */
  -webkit-overflow-scrolling: touch;
}

/* ── Content Panels ─────────────────────────────────────────────────────────── */
#pvt-inject,
#pvt-inbox,
#pvt-feed {
  padding: 14px 12px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.pv-empty-state {
  padding: 40px 24px;
  text-align: center;
  color: var(--pv-text-mid);
  font-size: 14px;
}

/* ── Bottom Tab Bar ──────────────────────────────────────────────────────────── */
.pv-tab-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--pv-card);
  border-top: 1px solid var(--pv-border);
  display: flex;
  z-index: 110;
  padding: env(safe-area-inset-bottom, 0) 0 0;
}

.pv-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px 10px;
  cursor: pointer;
  position: relative;
  border: none;
  background: none;
  color: #65676B;
  font-family: var(--sans, 'Inter', sans-serif);
  font-size: 11px;
  font-weight: 500;
  gap: 2px;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}

.pv-tab-btn:hover { color: var(--accent, #4CAF50); }

.pv-tab-btn.active {
  color: var(--accent, #4CAF50);
}

.pv-tab-icon {
  font-size: 20px;
  line-height: 1;
}

.pv-tab-label {
  font-size: 11px;
}

.pv-tab-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 20px);
  background: var(--pv-danger);
  color: white;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  line-height: 14px;
  pointer-events: none;
}

/* ── Compose FAB ─────────────────────────────────────────────────────────────── */
.pv-fab {
  position: fixed;
  bottom: 74px;
  right: 18px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent, #4CAF50);
  color: white;
  border: none;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 115;
  transition: transform .15s, box-shadow .15s;
}

.pv-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 18px rgba(0,0,0,.3);
}

/* ══════════════════════════════════════════════════════════════════════════════
   INJECT / LAGE TAB
══════════════════════════════════════════════════════════════════════════════ */

.pv-inject-card {
  background: var(--pv-card);
  border-radius: var(--pv-radius);
  box-shadow: var(--pv-shadow);
  overflow: hidden;
  margin-bottom: 14px;
}

.pv-inject-banner {
  background: var(--accent, #4CAF50);
  color: white;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pv-inject-banner.new {
  background: var(--pv-danger);
}

.pv-inject-banner-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.7);
  animation: pv-pulse 1.5s infinite;
}

@keyframes pv-pulse {
  0%, 100% { opacity: .7; transform: scale(1); }
  50%       { opacity: 1;  transform: scale(1.3); }
}

.pv-inject-body {
  padding: 16px;
}

.pv-inject-meta {
  font-family: var(--mono, monospace);
  font-size: 10px;
  color: var(--pv-text-mid);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.pv-inject-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--pv-text);
  margin-bottom: 12px;
  line-height: 1.3;
}

.pv-inject-content {
  font-size: 15px;
  line-height: 1.7;
  color: #444;
}

.pv-inject-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--pv-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pv-inject-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--pv-bg);
  color: var(--pv-text-mid);
  text-transform: uppercase;
  letter-spacing: .06em;
  border: 1px solid var(--pv-border);
}

.pv-inject-history-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--pv-text-mid);
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 6px 0 8px;
}

.pv-inject-old-card {
  background: var(--pv-card);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  opacity: .65;
  border: 1px solid var(--pv-border);
}

.pv-inject-old-card:hover { opacity: .85; }

.pv-inject-old-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--pv-text);
  margin-bottom: 2px;
}

.pv-inject-old-meta {
  font-family: var(--mono, monospace);
  font-size: 10px;
  color: var(--pv-text-mid);
}

/* ══════════════════════════════════════════════════════════════════════════════
   SOCIAL MEDIA / FEED TAB
══════════════════════════════════════════════════════════════════════════════ */

.pv-sm-card {
  background: var(--pv-card);
  border-radius: var(--pv-radius);
  box-shadow: var(--pv-shadow);
  overflow: hidden;
  margin-bottom: 12px;
}

.pv-sm-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 8px;
}

.pv-sm-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}

.pv-sm-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.pv-sm-meta { flex: 1; min-width: 0; }

.pv-sm-author {
  font-size: 14px;
  font-weight: 700;
  color: var(--pv-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pv-sm-sub {
  font-size: 12px;
  color: var(--pv-text-mid);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Platform badge pill */
.pv-sm-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  color: white;
  white-space: nowrap;
  flex-shrink: 0;
}

.pv-plat-twitter,
.pv-plat-x       { background: #000000; }
.pv-plat-linkedin { background: #0A66C2; }
.pv-plat-instagram { background: linear-gradient(135deg,#F09433,#E6683C,#DC2743,#CC2366,#BC1888); }
.pv-plat-facebook { background: #1877F2; }
.pv-plat-tiktok   { background: #010101; }
.pv-plat-press    { background: #2D2D2D; }
.pv-plat-news     { background: #C41E3A; }
.pv-plat-default  { background: #65676B; }

.pv-sm-content {
  padding: 0 14px 12px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--pv-text);
  white-space: pre-wrap;
  word-break: break-word;
}

.pv-sm-image {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
}

/* Engagement bar */
.pv-sm-stats {
  padding: 6px 14px;
  border-top: 1px solid var(--pv-border);
  border-bottom: 1px solid var(--pv-border);
  display: flex;
  gap: 18px;
}

.pv-sm-stat {
  font-size: 12px;
  color: var(--pv-text-mid);
  cursor: default;
}

/* Comments section */
.pv-sm-comments {
  padding: 8px 14px 4px;
}

.pv-sm-comment-item {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.pv-sm-comment-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent, #4CAF50);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pv-sm-comment-bubble {
  background: var(--pv-bg);
  border-radius: 18px;
  padding: 7px 12px;
  font-size: 13px;
  line-height: 1.4;
  flex: 1;
}

.pv-sm-comment-author {
  font-weight: 700;
  color: var(--pv-text);
  font-size: 12px;
}

.pv-sm-comment-text {
  color: var(--pv-text);
}

.pv-sm-comment-ts {
  font-size: 10px;
  color: var(--pv-text-mid);
  margin-top: 2px;
  font-family: var(--mono, monospace);
}

/* Comment input row */
.pv-sm-comment-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 12px;
}

.pv-sm-comment-input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--pv-border);
  border-radius: 20px;
  font-size: 13px;
  font-family: var(--sans, inherit);
  background: var(--pv-bg);
  color: var(--pv-text);
  outline: none;
  transition: border-color .15s, background .15s;
}

.pv-sm-comment-input:focus {
  border-color: var(--accent, #4CAF50);
  background: white;
}

.pv-sm-comment-send {
  background: var(--accent, #4CAF50);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: opacity .15s;
}

.pv-sm-comment-send:hover { opacity: .85; }

/* ══════════════════════════════════════════════════════════════════════════════
   INBOX / NACHRICHTEN TAB
══════════════════════════════════════════════════════════════════════════════ */

.pv-msg-card {
  background: var(--pv-card);
  border-radius: var(--pv-radius);
  box-shadow: var(--pv-shadow);
  margin-bottom: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .15s;
}

.pv-msg-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.14), 0 0 0 1px rgba(0,0,0,.06);
}

.pv-msg-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.pv-msg-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent, #4CAF50);
  color: white;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pv-msg-info { flex: 1; min-width: 0; }

.pv-msg-subject {
  font-size: 14px;
  font-weight: 600;
  color: var(--pv-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pv-msg-card.unread .pv-msg-subject {
  font-weight: 700;
}

.pv-msg-meta {
  font-size: 12px;
  color: var(--pv-text-mid);
  margin-top: 1px;
}

.pv-msg-unread-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--pv-unread);
  flex-shrink: 0;
}

.pv-msg-body-panel {
  padding: 0 14px 14px;
  border-top: 1px solid var(--pv-border);
}

.pv-msg-body-text {
  padding: 12px 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--pv-text);
}

.pv-msg-attachment {
  margin-bottom: 10px;
}

.pv-msg-attachment img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--pv-border);
}

.pv-msg-replies { margin-bottom: 12px; }

.pv-msg-reply-item {
  background: var(--pv-bg);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.pv-msg-reply-ts {
  font-family: var(--mono, monospace);
  font-size: 10px;
  color: var(--pv-text-mid);
  flex-shrink: 0;
}

.pv-msg-replied-badge {
  font-size: 11px;
  color: var(--pv-text-mid);
  font-family: var(--mono, monospace);
  padding: 8px 0 4px;
}

/* Reply form */
.pv-reply-form { border-top: 1px solid var(--pv-border); padding-top: 12px; }

.pv-reply-input {
  width: 100%;
  min-height: 70px;
  padding: 10px 12px;
  border: 1px solid var(--pv-border);
  border-radius: 10px;
  font-size: 13px;
  font-family: var(--sans, inherit);
  background: var(--pv-bg);
  color: var(--pv-text);
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  margin-bottom: 8px;
  transition: border-color .15s;
}

.pv-reply-input:focus { border-color: var(--accent, #4CAF50); background: white; }

.pv-reply-send {
  background: var(--accent, #4CAF50);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans, inherit);
  transition: opacity .15s;
}

.pv-reply-send:hover { opacity: .85; }

/* ── Compose Overlay ─────────────────────────────────────────────────────────── */
#pv-compose-panel {
  position: fixed;
  bottom: 70px; left: 0; right: 0;
  background: white;
  border-top: 1px solid var(--pv-border);
  border-radius: 20px 20px 0 0;
  padding: 20px 16px;
  z-index: 120;
  box-shadow: 0 -4px 20px rgba(0,0,0,.15);
  max-width: 600px;
  margin: 0 auto;
}

#pv-compose-panel .pv-compose-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--pv-text);
  margin-bottom: 14px;
}

#pv-compose-panel label {
  font-size: 11px;
  color: var(--pv-text-mid);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  display: block;
  margin-bottom: 4px;
}

#pv-compose-panel input,
#pv-compose-panel select,
#pv-compose-panel textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--pv-border);
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--sans, inherit);
  background: var(--pv-bg);
  color: var(--pv-text);
  box-sizing: border-box;
  margin-bottom: 10px;
  outline: none;
  transition: border-color .15s;
}

#pv-compose-panel input:focus,
#pv-compose-panel select:focus,
#pv-compose-panel textarea:focus {
  border-color: var(--accent, #4CAF50);
  background: white;
}

#pv-compose-panel textarea {
  min-height: 80px;
  resize: vertical;
}

/* ── Übungsende-Screen ────────────────────────────────────────────────────────── */
#pv-end-screen {
  position: fixed;
  inset: 0;
  background: var(--pv-bg);
  z-index: 200;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 24px;
  text-align: center;
}

.pv-end-icon {
  font-size: 56px;
  line-height: 1;
}

.pv-end-org {
  font-family: var(--mono, monospace);
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--pv-text-mid);
}

.pv-end-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--pv-text);
  letter-spacing: .01em;
}

.pv-end-text {
  font-size: 15px;
  color: var(--pv-text-mid);
  max-width: 360px;
  line-height: 1.7;
}

.pv-end-ts {
  font-family: var(--mono, monospace);
  font-size: 11px;
  color: var(--pv-text-mid);
  margin-top: 8px;
}

/* ── Login Modal Override ─────────────────────────────────────────────────────── */
#pv-login .modal {
  border-radius: 20px;
  overflow: hidden;
}

#pv-login .mh {
  flex-direction: column;
  align-items: center;
  padding: 28px 24px 16px;
  border-bottom: none;
  gap: 12px;
}

#pv-login .mh .pv-login-logo {
  /* rendered by JS via applyTheme → .logo-container */
}

#pv-login .mt2 {
  font-size: 20px;
  font-weight: 700;
}

#pv-login .mb2 {
  padding: 8px 24px 16px;
}

#pv-login .mf {
  padding: 12px 24px 24px;
  border-top: none;
  flex-direction: column;
  gap: 8px;
}

#pv-login .mf .btn {
  width: 100%;
  padding: 11px;
  font-size: 15px;
  border-radius: 10px;
}

#pv-login #pv-pw {
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  letter-spacing: .05em;
}

/* ── Session End Logo override ──────────────────────────────────────────────── */
#pv-end-logo-container img {
  height: 48px;
  width: auto;
}

/* ── Dark header override for session-client-logo ──────────────────────────── */
#pv-client-logo-display img {
  height: 28px;
  width: auto;
}
