/* /var/www/olaj/htdocs/live/live.css */

:root {
  color-scheme: dark;
  --bg: #050508;
  --bg-elevated: #101016;
  --accent: #ff2f70;
  --accent-soft: rgba(255,47,112,0.22);
  --text: #f9f9ff;
  --muted: #9ca3af;
  --border: rgba(148,163,184,0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(circle at top, #111827 0, #020617 45%, #000 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;

  touch-action: manipulation;
  -ms-touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

button, input {
  touch-action: manipulation;
}

body.live-body {
  display: flex;
  flex-direction: column;
}

.layout {
  flex: 1;
  display: flex;
  flex-direction: row;
  max-height: 100vh;
}

/* LEWA: VIDEO */

.stage-column {
  flex: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 8px;
}

.hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  pointer-events: none;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #dc2626, #f97316);
  box-shadow: 0 0 18px rgba(248,113,113,0.45);
  pointer-events: auto;
}

.live-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #fee2e2;
  box-shadow: 0 0 12px rgba(254,226,226,0.8);
}

.live-pill span {
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.live-pill .time {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  opacity: .9;
}

.hud-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hud-chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,0.85);
  border: 1px solid rgba(148,163,184,0.35);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.hud-chip svg {
  width: 14px;
  height: 14px;
}

.stage-video-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 18px 50px rgba(15,23,42,0.9);
}


/* ───────── PRODUCT RIBBON POD HUD ───────── */

.product-ribbon {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 40px;                       /* tuż pod HUD-em */
  z-index: 5;
  pointer-events: none;            /* całość „przezroczysta”… */
}

.product-ribbon-inner {
  pointer-events: auto;            /* …ale sam box klikalny */
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: radial-gradient(circle at top left, rgba(56,189,248,0.35), rgba(15,23,42,0.96));
  border: 1px solid rgba(148,163,184,0.75);
  box-shadow: 0 14px 40px rgba(15,23,42,0.9);
  backdrop-filter: blur(16px);
}

.product-ribbon-empty .product-ribbon-inner {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .18s ease-out, transform .18s ease-out;
}

.product-ribbon:not(.product-ribbon-empty) .product-ribbon-inner {
  opacity: 1;
  transform: translateY(0);
}

.product-ribbon-thumb {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(15,23,42,0.95);
  border: 1px solid rgba(148,163,184,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: rgba(209,213,219,0.9);
}

.product-ribbon-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-ribbon-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.product-ribbon-title {
  font-size: 13px;
  font-weight: 600;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-ribbon-meta {
  font-size: 11px;
  color: rgba(209,213,219,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-ribbon-meta strong {
  font-weight: 600;
}

.product-ribbon-cta {
  flex: 0 0 auto;
  font-size: 11px;
  color: #bfdbfe;
  opacity: .85;
}

/* Na mobile ribbon bliżej góry i trochę mniejszy */

@media (max-width: 900px) {
  .product-ribbon {
    top: 34px;
    left: 8px;
    right: 8px;
  }

  .product-ribbon-inner {
    padding: 6px 10px;
  }

  .product-ribbon-thumb {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
  }

  .product-ribbon-title {
    font-size: 12px;
  }

  .product-ribbon-meta {
    font-size: 10px;
  }
}


/* pionowy stream sensownie na desktopie */
video#video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

/* DOLNY PASEK: status + audio + czat */

.status-bar {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,0.85);
  border: 1px solid rgba(148,163,184,0.6);
  font-size: 11px;
  color: var(--muted);
  max-width: 55%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: auto;
  transition: opacity .2s ease-out, transform .2s ease-out;
}

.status-pill.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34,197,94,0.25);
}

.status-pill.error .status-dot {
  background: #ef4444;
  box-shadow: 0 0 0 6px rgba(239,68,68,0.3);
}

/* AUDIO BUTTON */

.audio-btn {
  pointer-events: auto;
  border-radius: 999px;
  border: none;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(15,23,42,0.9);
  color: var(--text);
  border: 1px solid rgba(96,165,250,0.9);
  box-shadow: 0 8px 20px rgba(37,99,235,0.5);
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, opacity .18s ease-out;
}

.audio-btn:active {
  transform: translateY(1px) scale(.99);
  box-shadow: 0 4px 14px rgba(37,99,235,0.4);
}

.audio-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
}

/* CZAT BUTTON – ghost */

.chat-toggle {
  margin-left: auto;
  pointer-events: auto;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.65);
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(15,23,42,0.35);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 20px rgba(15,23,42,0.7);
}

.chat-toggle svg {
  width: 15px;
  height: 15px;
}

/* ───────── PRODUCT RIBBON (pojedynczy, bez „ramki pod spodem”) ───────── */

.product-ribbon {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 12px;                 /* pod HUD-em; dostosuj jak będziesz chciał */
  z-index: 15;

  background: transparent;
  padding: 0;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  pointer-events: none;
}

.product-ribbon-hidden {
  display: none !important;
}

.product-ribbon-empty .product-ribbon-inner {
  opacity: .7;
}

/* właściwy JEDEN ribbon – ~50% wyższy */

.product-ribbon-inner {
  display: flex;
  align-items: center;
  gap: 12px;

  max-width: 380px;
  margin: 0 auto;

  padding: 9px 14px;                 /* było 6x10 → więcej mięcha */
  border-radius: 999px;

  background: linear-gradient(135deg, #ec4899, #032a69);
  box-shadow: 0 14px 36px rgba(15,23,42,0.9);

  pointer-events: auto;
}

/* lewy „avatar” produktu – +50% */

.product-ribbon-thumb {
  width: 48px;                        /* było 32px */
  height: 48px;
  border-radius: 999px;
  background: rgba(15,23,42,0.95);
  border: 2px solid rgba(248,250,252,0.85);
  box-shadow: 0 0 0 2px rgba(15,23,42,0.9);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.product-ribbon-thumb.has-image {
  background-color: #020617;
}

/* tekst */

.product-ribbon-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.product-ribbon-title {
  font-size: 14px;                   /* było 13px */
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f9fafb;
}

.product-ribbon-meta {
  font-size: 12px;                   /* było 11px */
  color: #e5e7eb;
  opacity: .9;
}

/* CTA po prawej – wyższy i wygodniejszy w klikaniu */

.product-ribbon-cta {
  margin-left: auto;
  padding: 7px 14px;                 /* było 5x12 */
  border-radius: 999px;
  background: rgba(15,23,42,0.96);
  color: #f9fafb;
  font-size: 12px;                   /* było 11px */
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 0 0 1px rgba(15,23,42,0.85);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* trochę lżej na mobile, ale nadal większy niż wcześniej */

@media (max-width: 900px) {
  .product-ribbon {
    top: 44px;
    left: 6px;
    right: 6px;
  }

  .product-ribbon-inner {
    max-width: none;
    padding: 8px 12px;               /* było 5x9 */
  }

  .product-ribbon-thumb {
    width: 44px;                     /* było 32/34 */
    height: 44px;
  }

  .product-ribbon-title {
    font-size: 13px;                 /* było 12 */
  }

  .product-ribbon-meta {
    font-size: 11px;                 /* było 10 */
  }

  .product-ribbon-cta {
    padding: 6px 12px;
    font-size: 11px;
  }
}

/* PRAWA: CZAT */

.chat-column {
  flex: 1;
  min-width: 260px;
  max-width: 420px;
  border-left: 1px solid rgba(15,23,42,0.9);
  background: transparent;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(15,23,42,0.85);
  border: 1px solid rgba(148,163,184,0.4);
  font-size: 13px;
}

.chat-header-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-header-title span {
  font-weight: 500;
}

.chat-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(56,189,248,0.15);
  color: #7dd3fc;
  border: 1px solid rgba(56,189,248,0.4);
}

.chat-conn {
  font-size: 11px;
  opacity: .7;
}

/* LOG: bez tła, tylko bańki mają tło */

.chat-log {
  flex: 1;
  min-height: 0;
  border-radius: 14px;
  background: transparent;
  border: none;
  padding: 8px;
  overflow-y: auto;
  font-size: 13px;
}

/* BĄBELKI: FB style + avatar + zanikanie */

.chat-msg {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 4px;
  max-width: 100%;
  opacity: .25;
  transition: opacity .25s ease-out, transform .2s ease-out;
}

.chat-msg-faded {
  opacity: 0.4;
  transform: translateY(-2px);
}

/* ostatnie 5 w pełnej sile */
.chat-msg:nth-last-child(-n+5) {
  opacity: 1;
}

.chat-avatar {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(15,23,42,0.95);
  border: 1px solid rgba(148,163,184,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #e5e7eb;
  overflow: hidden; /* ważne dla fotki w kółku */
}

.chat-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;
}

.chat-bubble {
  max-width: calc(100% - 30px);
}

.chat-msg-author {
  font-size: 11px;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 1px;
}

.chat-msg-body {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15,23,42,0.85);
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
}

/* Twoje wiadomości */

.chat-msg-own {
  justify-content: flex-end;
}

.chat-msg-own .chat-avatar {
  order: 2;
  background: linear-gradient(135deg, #f97316, #ec4899);
  color: #0b1120;
  border-color: transparent;
}

.chat-msg-own .chat-bubble {
  order: 1;
}

.chat-msg-own .chat-msg-body {
  background: linear-gradient(135deg, #22c55e, #0ea5e9);
  color: #0b1120;
}

/* placeholder przed pierwszą wiadomością */

.chat-placeholder {
  opacity: .7;
}

/* BANER ODPOWIEDZI NAD INPUTEM */

.chat-reply-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 8px;
  margin-bottom: 4px;
  border-radius: 999px;
  background: rgba(15,23,42,0.92);
  border: 1px solid rgba(148,163,184,0.6);
  font-size: 11px;
}

.chat-reply-banner.active {
  display: flex;
}

.chat-reply-label {
  font-weight: 600;
  color: #e5e7eb;
}

.chat-reply-preview {
  flex: 1;
  margin-left: 4px;
  margin-right: 4px;
  color: rgba(148,163,184,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-reply-cancel {
  border: none;
  background: transparent;
  color: rgba(248,113,113,0.95);
  font-size: 11px;
  cursor: pointer;
  padding: 0 4px;
}

/* INPUT */

.chat-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.chat-input-row input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid rgba(51,65,85,0.9);
  background: rgba(15,23,42,0.95);
  color: var(--text);
  padding: 7px 12px;
  font-size: 13px;
  outline: none;
}

.chat-input-row input::placeholder {
  color: rgba(148,163,184,0.8);
}

.chat-input-row button {
  border-radius: 999px;
  border: none;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  background: linear-gradient(135deg, #f97316, #ec4899);
  color: #0b1120;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(236,72,153,0.4);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.chat-input-row button:active {
  transform: translateY(1px) scale(.99);
  box-shadow: 0 4px 14px rgba(236,72,153,0.3);
}

/* MOBILE: czat jako dolny overlay, video full */

@media (max-width: 900px) {
  html, body { overflow: hidden; }
  .layout { flex-direction: column; }
  .stage-column { padding: 6px; }

  .chat-column {
    position: fixed;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    max-height: 50vh;
    border-left: none;
    border-top: none;
    border-radius: 0;
    box-shadow: none;
    transform: translateY(100%);
    transition: transform .22s ease-out;
    z-index: 40;
    background: transparent;
    padding-top: 0;
    padding-bottom: 6px;
  }

  .chat-column.open {
    transform: translateY(0);
  }

  .chat-header {
    display: none;
  }

  .chat-log {
    padding: 0 8px 4px;
    display: block;
    overflow-y: auto;
    max-height: calc(50vh - 46px); /* input + reply banner */
  }

  .chat-input-row {
    padding: 0 4px 0;
  }

  .chat-toggle {
    font-size: 13px;
  }
}

@media (min-width: 901px) {
  .chat-toggle {
    opacity: .9;
  }
}