/*
 * Shadow Nexus Social Live — cohost.css  (v2)
 * Styles for the Co-Host feature only.
 * This file is completely independent from live.css.
 * Disabling this file removes all co-host UI without affecting anything else.
 */

/* ══════════════════════════════════════════════════════
   CO-HOST BUTTON — bottom bar (host only)
   ══════════════════════════════════════════════════════ */
#btnCoHost {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(80, 0, 180, 0.45);
  backdrop-filter: blur(6px);
  border: 1.5px solid rgba(160, 80, 255, 0.65);
  color: #fff; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: background 0.18s, border-color 0.18s, transform 0.1s, box-shadow 0.18s;
  touch-action: manipulation;
  position: relative;
}
#btnCoHost:hover {
  background: rgba(110, 20, 220, 0.55);
  border-color: rgba(180, 100, 255, 0.85);
  box-shadow: 0 0 14px rgba(160, 80, 255, 0.45);
}
#btnCoHost:active { transform: scale(0.92); }
#btnCoHost.cohost-active {
  background: rgba(120, 30, 240, 0.55);
  border-color: rgba(200, 130, 255, 0.9);
  box-shadow: 0 0 16px rgba(180, 100, 255, 0.55);
}

/* Hide from viewers — host only */
body.is-viewer #btnCoHost { display: none !important; }

/* ══════════════════════════════════════════════════════
   CO-HOST SETTINGS PANEL
   Hidden by default. Opened only when host taps the button.
   ══════════════════════════════════════════════════════ */
#cohostPanel {
  display: none;
  position: fixed;
  bottom: 80px; left: 50%;
  transform: translateX(-50%);
  width: min(340px, calc(100vw - 24px));
  background: rgba(4, 10, 28, 0.98);
  backdrop-filter: blur(16px);
  border: 1.5px solid rgba(160, 80, 255, 0.5);
  border-radius: 20px;
  padding: 18px 16px 16px;
  z-index: 9100;
  animation: cohostPopIn 0.2s ease-out both;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: none;
}
#cohostPanel::-webkit-scrollbar { display: none; }
#cohostPanel.visible { display: block; }

/* Keep legacy #cohostPopup name working if anything still references it */
#cohostPopup {
  display: none;
  position: fixed;
  bottom: 80px; left: 50%;
  transform: translateX(-50%);
  width: min(340px, calc(100vw - 24px));
  background: rgba(4, 10, 28, 0.98);
  backdrop-filter: blur(16px);
  border: 1.5px solid rgba(160, 80, 255, 0.5);
  border-radius: 20px;
  padding: 18px 16px 16px;
  z-index: 9100;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: none;
}
#cohostPopup.visible { display: block; }

@keyframes cohostPopIn {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Header */
.cohost-popup-title {
  font-size: 13px; font-weight: 800;
  color: #e8d8ff; text-align: center;
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(160, 80, 255, 0.22);
  padding-bottom: 10px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* Close button inside panel */
.cohost-popup-close {
  position: absolute; top: 10px; right: 12px;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.13);
  color: #aaa; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.15s;
}
.cohost-popup-close:hover { background: rgba(255,255,255,0.15); }

/* Section label */
.cohost-section-label {
  font-size: 10px; font-weight: 700; color: #7a5ab8;
  text-transform: uppercase; letter-spacing: 0.6px;
  margin: 10px 0 6px;
}

/* ── Search row (legacy — kept for backwards compat) ── */
.cohost-search-row {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 8px;
}
.cohost-search-input {
  flex: 1;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(160, 80, 255, 0.35);
  border-radius: 20px;
  color: #fff; font-size: 13px;
  padding: 8px 14px; outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.cohost-search-input::placeholder { color: rgba(180,140,255,0.35); }
.cohost-search-input:focus { border-color: rgba(180, 100, 255, 0.7); }

.cohost-search-btn {
  padding: 8px 14px; border-radius: 20px;
  background: rgba(120, 30, 240, 0.3);
  border: 1px solid rgba(160, 80, 255, 0.55);
  color: #c8a8ff; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: background 0.15s;
  white-space: nowrap;
}
.cohost-search-btn:hover { background: rgba(140, 50, 255, 0.45); }
.cohost-search-btn:active { transform: scale(0.96); }

/* ── User list (friends + search results) ── */
.cohost-user-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 200px; overflow-y: auto;
  scrollbar-width: none;
  margin-bottom: 4px;
}
.cohost-user-list::-webkit-scrollbar { display: none; }

.cohost-user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  animation: cohostRowIn 0.15s ease-out both;
}
@keyframes cohostRowIn {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.cohost-user-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: #0B1F3A center/cover no-repeat;
  border: 1.5px solid rgba(160, 80, 255, 0.45);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #c090ff;
  overflow: hidden;
}
.cohost-user-name {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 700; color: #e8d8ff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cohost-user-handle {
  font-size: 10px; color: #7a5ab8; margin-top: 1px;
}

/* ── Status indicator row ── */
.cohost-user-status {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; color: #7a6a9a;
  margin-top: 2px;
}
.cohost-status-label {
  font-size: 10px; font-weight: 600;
}

/* Status dots */
.cohost-status-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  display: inline-block;
}
.cohost-status-available { background: #22d470; box-shadow: 0 0 4px rgba(34,212,112,0.7); }
.cohost-status-online    { background: #00aeef; box-shadow: 0 0 4px rgba(0,174,239,0.6); }
.cohost-status-busy      { background: #f59e0b; box-shadow: 0 0 4px rgba(245,158,11,0.6); }
.cohost-status-offline   { background: #4a4a5a; }

/* ── Invite button ── */
.cohost-invite-btn {
  padding: 5px 12px; border-radius: 8px;
  background: rgba(120, 30, 240, 0.25);
  border: 1px solid rgba(160, 80, 255, 0.55);
  color: #c090ff; font-size: 11px; font-weight: 800;
  cursor: pointer; transition: background 0.15s;
  white-space: nowrap; flex-shrink: 0;
}
.cohost-invite-btn:hover  { background: rgba(140, 50, 255, 0.42); }
.cohost-invite-btn:active { transform: scale(0.96); }
.cohost-invite-btn.sent {
  background: rgba(80, 180, 80, 0.2);
  border-color: rgba(60, 200, 80, 0.5);
  color: #60e870; cursor: default;
}
.cohost-invite-btn.sent:hover { background: rgba(80, 180, 80, 0.2); }
.cohost-invite-btn.disabled,
.cohost-invite-btn:disabled {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.1);
  color: #44355a; cursor: not-allowed;
}

/* Empty state */
.cohost-empty {
  text-align: center; font-size: 12px; color: #4a3a6a;
  padding: 12px 0;
}

/* ── Active Co-Hosts list ── */
.cohost-active-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: rgba(120, 30, 240, 0.1);
  border: 1px solid rgba(160, 80, 255, 0.22);
  border-radius: 10px;
  margin-bottom: 6px;
  animation: cohostRowIn 0.15s ease-out both;
}
.cohost-active-name {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 700; color: #e8d8ff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cohost-active-status {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; color: #22d470;
  margin-top: 2px;
}
.cohost-remove-btn {
  padding: 5px 10px; border-radius: 8px;
  background: rgba(180, 0, 30, 0.2);
  border: 1px solid rgba(255, 50, 70, 0.4);
  color: #ff5566; font-size: 11px; font-weight: 800;
  cursor: pointer; transition: background 0.15s;
  white-space: nowrap; flex-shrink: 0;
}
.cohost-remove-btn:hover { background: rgba(220, 0, 40, 0.35); }
.cohost-remove-btn:active { transform: scale(0.96); }

/* Divider */
.cohost-divider {
  border: none;
  border-top: 1px solid rgba(160, 80, 255, 0.14);
  margin: 10px 0;
}

/* ══════════════════════════════════════════════════════
   CO-HOST INVITE NOTIFICATION CARD (incoming request)
   Shown to the invitee (viewer side) over the live stage
   ══════════════════════════════════════════════════════ */
#cohostInviteCard {
  display: none;
  position: fixed;
  top: 72px; left: 50%;
  transform: translateX(-50%);
  width: min(300px, calc(100vw - 28px));
  background: rgba(4, 10, 28, 0.97);
  backdrop-filter: blur(14px);
  border: 1.5px solid rgba(160, 80, 255, 0.6);
  border-radius: 16px;
  padding: 16px 16px 14px;
  z-index: 9200;
  text-align: center;
  animation: cohostCardIn 0.22s ease-out both;
}
#cohostInviteCard.visible { display: block; }

@keyframes cohostCardIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.cohost-invite-icon { font-size: 32px; line-height: 1; margin-bottom: 8px; }
.cohost-invite-title {
  font-size: 14px; font-weight: 800; color: #e8d8ff;
  margin-bottom: 4px;
}
.cohost-invite-sub {
  font-size: 12px; color: #8a6ab8; line-height: 1.5;
  margin-bottom: 12px;
}
.cohost-invite-actions {
  display: flex; gap: 10px;
}
.cohost-invite-accept {
  flex: 1; padding: 10px;
  border-radius: 10px;
  background: rgba(80, 200, 100, 0.2);
  border: 1.5px solid rgba(60, 220, 90, 0.55);
  color: #60e870; font-size: 13px; font-weight: 800;
  cursor: pointer; transition: background 0.15s;
  touch-action: manipulation;
}
.cohost-invite-accept:hover { background: rgba(80, 200, 100, 0.38); }
.cohost-invite-deny {
  flex: 1; padding: 10px;
  border-radius: 10px;
  background: rgba(180, 0, 30, 0.16);
  border: 1.5px solid rgba(255, 50, 70, 0.4);
  color: #ff5566; font-size: 13px; font-weight: 800;
  cursor: pointer; transition: background 0.15s;
  touch-action: manipulation;
}
.cohost-invite-deny:hover { background: rgba(220, 0, 40, 0.3); }

/* ══════════════════════════════════════════════════════
   CO-HOST BADGE (shown on the co-host's stream name label)
   ══════════════════════════════════════════════════════ */
.cohost-badge-pill {
  display: inline-flex; align-items: center; gap: 3px;
  background: rgba(120, 30, 240, 0.35);
  border: 1px solid rgba(160, 80, 255, 0.6);
  border-radius: 8px;
  padding: 2px 6px;
  font-size: 9px; font-weight: 800;
  color: #c090ff; letter-spacing: 0.4px;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   CO-HOST SETTINGS SECTION (inside Live Settings panel)
   ══════════════════════════════════════════════════════ */
#cohostSettingsSection {
  margin-top: 4px;
}

/* "Who can co-host" select */
.cohost-select {
  width: 100%;
  background: rgba(4, 10, 28, 0.9);
  border: 1px solid rgba(160, 80, 255, 0.4);
  border-radius: 8px;
  color: #d8d0ff;
  font-size: 12px; font-weight: 600;
  padding: 6px 10px;
  outline: none;
  margin-top: 4px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.cohost-select:focus { border-color: rgba(180, 100, 255, 0.7); }
.cohost-select option { background: #0a0820; color: #d8d0ff; }

.cohost-select-wrap {
  display: flex; flex-direction: column; gap: 4px;
  width: 100%;
}
.cohost-select-label {
  font-size: 10px; font-weight: 700; color: #6a50a0;
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-top: 6px;
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */
@media (max-width: 380px) {
  #btnCoHost { width: 36px; height: 36px; font-size: 16px; }
  #cohostPanel { padding: 14px 12px 12px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  #btnCoHost { width: 34px; height: 34px; font-size: 14px; }
  #cohostPanel { bottom: 60px; max-height: calc(100vh - 80px); }
}
