/**
 * G4melab — Page Live Twitch
 */

body.g4-page-live {
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(255, 45, 138, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 60% 35% at 80% 100%, rgba(0, 229, 192, 0.06) 0%, transparent 50%),
    var(--g4-bg) !important;
}

body.g4-page-live .g4-main {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ── Stage pleine largeur fluide ── */
.g4-live-stage {
  --g4-live-gap: clamp(0.65rem, 1.2vw, 1rem);
  --g4-live-rail: clamp(240px, 18vw, 300px);
  width: min(
    100% - var(--g4-wrap-gutter),
    calc(var(--g4-wrap-fluid) + var(--g4-live-rail) + var(--g4-live-gap))
  );
  margin-inline: auto;
  padding: 0.65rem 0 0.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  box-sizing: border-box;
  container-type: inline-size;
}

.g4-live-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  min-height: 0;
}

.g4-live-body {
  flex: 0 0 auto;
  min-height: 0;
  display: grid;
  grid-template-columns:
    var(--g4-live-rail)
    minmax(0, calc(100cqw - (2 * var(--g4-live-rail)) - (2 * var(--g4-live-gap))))
    var(--g4-live-rail);
  gap: var(--g4-live-gap);
  align-items: start;
  container-type: inline-size;
}

/* ── Barre titre + actions ── */
.g4-live-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.65rem 1.25rem;
  padding: 0.35rem 0 0.65rem;
  margin-bottom: 0.65rem;
  border-bottom: 1px solid rgba(0, 229, 192, 0.12);
  flex-shrink: 0;
}

.g4-live-toolbar__head h1 {
  margin: 0;
  font-family: var(--g4-font-display);
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--g4-cyan) 0%, #7b5cff 55%, var(--g4-magenta) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.1;
}

.g4-live-toolbar__head p {
  margin: 0.2rem 0 0;
  color: var(--g4-muted);
  font-size: 0.82rem;
}

.g4-live-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* ── Panneaux latéraux ── */
.g4-live-pick,
.g4-live-chat {
  background: rgba(12, 22, 40, 0.85);
  border: 1px solid rgba(0, 229, 192, 0.18);
  border-radius: 12px;
  padding: 0.85rem 0.75rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.g4-live-chat__frame {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #050a12;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.g4-live-chat__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.g4-live-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  min-height: 0;
}

.g4-live-panel__title {
  margin: 0 0 0.65rem;
  padding: 0 0.15rem;
  font-family: var(--g4-font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--g4-muted);
  flex-shrink: 0;
}

/* ── Onglets Streamers / Guests ── */
.g4-live-pick__tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
  flex-shrink: 0;
}

.g4-live-pick__tab {
  flex: 1;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(8, 14, 26, 0.55);
  color: var(--g4-muted);
  font-family: var(--g4-font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.g4-live-pick__tab:hover {
  color: #fff;
  border-color: rgba(0, 229, 192, 0.25);
}

.g4-live-pick__tab.is-active {
  color: var(--g4-cyan);
  border-color: rgba(0, 229, 192, 0.55);
  background: rgba(0, 229, 192, 0.08);
}

.g4-live-pick__panel {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.g4-live-pick__panel.is-active {
  display: flex;
}

.g4-live-pick__empty {
  margin: 0.5rem 0 0;
  padding: 0.75rem;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--g4-muted);
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: center;
}

.g4-live-pick__empty small {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  opacity: 0.85;
}

/* ── Player ── */
.g4-live-player {
  position: relative;
  width: 100%;
  border: 1px solid rgba(0, 229, 192, 0.22);
  border-radius: 12px;
  overflow: hidden;
  background: #050a12;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.g4-live-player__badge {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(8, 12, 20, 0.82);
  border: 1px solid rgba(255, 59, 92, 0.5);
  color: #ff6b8a;
  font-family: var(--g4-font-display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.g4-live-player:not(.is-live) .g4-live-player__badge {
  display: none;
}

.g4-live-player__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: min(72vh, 920px);
  background: #000;
}

.g4-live-player__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.g4-live-player:not(.is-live) .g4-live-player__frame {
  opacity: 0.2;
  pointer-events: none;
}

.g4-live-player__offline {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: linear-gradient(180deg, rgba(8, 14, 26, 0.55) 0%, rgba(5, 10, 18, 0.92) 100%);
  text-align: center;
  padding: 1rem;
}

.g4-live-player__offline[hidden] {
  display: none;
}

.g4-live-player__offline img {
  width: 72px;
  height: 72px;
  min-width: 72px;
  min-height: 72px;
  max-width: 72px;
  max-height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(0, 229, 192, 0.35);
}

.g4-live-player__offline img.is-logo-fallback {
  object-fit: contain;
  padding: 0.35rem;
  background: rgba(255, 255, 255, 0.06);
}

.g4-live-player__offline strong {
  font-family: var(--g4-font-display);
  font-size: 1.05rem;
  color: #fff;
}

.g4-live-player__offline p {
  margin: 0;
  color: var(--g4-muted);
  font-size: 0.85rem;
}

/* ── Boutons ── */
.g4-live-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-family: var(--g4-font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.2s, box-shadow 0.2s, color 0.2s;
  white-space: nowrap;
}

.g4-live-btn--sm {
  padding: 0.5rem 0.9rem;
  font-size: 0.72rem;
  border-radius: 8px;
}

.g4-live-btn--follow {
  color: var(--g4-magenta);
  border: 1px solid rgba(255, 45, 138, 0.65);
  background: rgba(255, 45, 138, 0.06);
}

.g4-live-btn--follow:hover {
  background: rgba(255, 45, 138, 0.14);
  color: #fff;
}

.g4-live-btn--donate {
  color: var(--g4-cyan);
  border: 1px solid rgba(0, 229, 192, 0.65);
  background: rgba(0, 229, 192, 0.06);
}

.g4-live-btn--donate:hover {
  background: rgba(0, 229, 192, 0.14);
  color: #fff;
}

.g4-live-actions-mobile {
  display: none;
}

/* ── Liste streamers ── */
.g4-live-pick__list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}

.g4-live-pick__row {
  display: grid;
  grid-template-columns: 44px 1fr 10px;
  gap: 0.65rem;
  align-items: center;
  width: 100%;
  padding: 0.6rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: rgba(8, 14, 26, 0.6);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.g4-live-pick__row:hover {
  border-color: rgba(0, 229, 192, 0.25);
  background: rgba(0, 229, 192, 0.05);
}

.g4-live-pick__row.is-active {
  border-color: rgba(0, 229, 192, 0.45);
  background: rgba(0, 229, 192, 0.08);
}

.g4-live-pick__row img {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  max-width: 44px;
  max-height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.g4-live-pick__row img.is-logo-fallback {
  object-fit: contain;
  padding: 0.2rem;
  background: rgba(255, 255, 255, 0.06);
}

.g4-live-pick__info strong {
  display: block;
  font-family: var(--g4-font-display);
  font-size: 0.92rem;
  color: #fff;
  line-height: 1.2;
}

.g4-live-pick__status {
  display: block;
  font-family: var(--g4-font-display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0.15rem;
}

.g4-live-pick__row.is-online .g4-live-pick__status {
  color: #3dff9a;
}

.g4-live-pick__row.is-offline .g4-live-pick__status {
  color: #ff6b6b;
}

.g4-live-pick__info small {
  display: block;
  margin-top: 0.2rem;
  color: var(--g4-muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.g4-live-pick__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  justify-self: end;
}

.g4-live-pick__dot.is-live {
  background: #3dff9a;
  box-shadow: 0 0 8px rgba(61, 255, 154, 0.7);
}

.g4-live-pick__dot.is-off {
  background: #ff6b6b;
}

@media (min-width: 1101px) {
  .g4-live-pick,
  .g4-live-chat {
    height: calc(
      (100cqw - (2 * var(--g4-live-rail)) - (2 * var(--g4-live-gap))) * 9 / 16 + 2px
    );
  }

  .g4-live-pick__list {
    overflow-y: auto;
  }
}

@media (max-width: 1100px) {
  .g4-live-stage {
    width: min(100% - var(--g4-wrap-gutter), var(--g4-wrap-fluid));
  }

  .g4-live-body {
    grid-template-columns: 1fr;
  }

  .g4-live-main {
    order: 1;
  }

  .g4-live-chat {
    order: 2;
    min-height: clamp(280px, 42vh, 420px);
  }

  .g4-live-pick {
    order: 3;
    width: 100%;
    max-height: none;
    min-height: auto;
  }

  .g4-live-player__frame {
    max-height: min(68vh, 720px);
  }
}

@media (max-width: 860px) {
  .g4-live-stage {
    padding-inline: 0;
  }

  .g4-live-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .g4-live-toolbar__actions {
    display: none;
  }

  .g4-live-actions-mobile {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.65rem;
  }

  .g4-live-actions-mobile .g4-live-btn {
    width: 100%;
    padding: 0.65rem 0.45rem;
    font-size: 0.65rem;
  }

  .g4-live-player__frame {
    max-height: none;
  }

  .g4-live-pick {
    padding: 0.75rem 0.65rem;
  }

  .g4-live-chat {
    padding: 0.75rem 0.65rem;
    min-height: clamp(240px, 38vh, 360px);
  }

  .g4-live-pick__list {
    overflow: visible;
  }

  .g4-live-pick__row {
    grid-template-columns: 40px 1fr 10px;
    padding: 0.55rem 0.6rem;
  }

  .g4-live-pick__row img {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
  }
}
