/* LiveShare — theme-aligned co-browse UI */

.liveshare-dlg {
  max-width: min(380px, calc(100vw - 32px));
  padding: 22px 22px 16px;
}

.liveshare-dlg__title {
  margin-bottom: 10px;
}

.liveshare-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.liveshare-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  border: 1px solid var(--theme-border, #2a2a2a);
  background: var(--theme-elevated, #141414);
  color: var(--theme-muted, #9aa0a6);
}

.liveshare-role-chip svg {
  width: 12px;
  height: 12px;
  display: block;
  flex-shrink: 0;
  transform: translateY(0.5px);
}

.liveshare-role-chip--host {
  border-color: color-mix(in srgb, var(--theme-accent-hot, #a78bfa) 35%, var(--theme-border, #2a2a2a));
  color: var(--theme-accent, #c4b5fd);
  background: var(--theme-accent-soft-08, rgba(167, 139, 250, 0.08));
}

.liveshare-role-chip--guest {
  border-color: color-mix(in srgb, #34d399 30%, var(--theme-border, #2a2a2a));
  color: #6ee7b7;
  background: rgba(52, 211, 153, 0.08);
}

.liveshare-dlg__lead {
  margin-bottom: 18px;
}

.liveshare-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--theme-border, #2a2a2a);
}

.liveshare-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.liveshare-section[hidden] {
  display: none;
}

.liveshare-section__title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--theme-muted, #9aa0a6);
}

.liveshare-section__title svg {
  width: 14px;
  height: 14px;
  stroke: var(--theme-accent, #c4b5fd);
}

.liveshare-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.liveshare-field label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--theme-muted, #9aa0a6);
}

.liveshare-field input,
.liveshare-link-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--theme-border, #2a2a2a);
  background: var(--theme-elevated, #141414);
  color: var(--theme-text, #e8eaef);
  font: inherit;
  font-size: 13px;
}

.liveshare-field input:focus,
.liveshare-link-input:focus {
  outline: none;
  border-color: var(--theme-accent-hot, #a78bfa);
  box-shadow: 0 0 0 2px var(--theme-accent-soft-20, rgba(167, 139, 250, 0.2));
}

.liveshare-link-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.liveshare-link-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--theme-muted, #9aa0a6);
}

.liveshare-link-hint[hidden] {
  display: none;
}

.liveshare-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.liveshare-link-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.liveshare-viewers-wrap,
.liveshare-roster-section[hidden] {
  display: none;
}

.liveshare-roster-section {
  margin-bottom: 12px;
}

.liveshare-roster__summary {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--theme-muted, #9aa0a6);
}

.liveshare-roster {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.liveshare-roster-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--theme-border, #2a2a2a);
  background: var(--theme-elevated, #141414);
}

.liveshare-roster-item--host {
  border-color: color-mix(in srgb, var(--theme-accent-hot, #a78bfa) 35%, var(--theme-border, #2a2a2a));
  background: var(--theme-accent-soft-08, rgba(167, 139, 250, 0.08));
}

.liveshare-roster-item--self {
  box-shadow: inset 0 0 0 1px var(--theme-accent-soft-20, rgba(167, 139, 250, 0.2));
}

.liveshare-roster-item__main {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.liveshare-roster-item__main svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: block;
}

.liveshare-roster-item__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--theme-text, #e8eaef);
}

.liveshare-roster-item__tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--theme-muted, #9aa0a6);
}

.liveshare-viewers-wrap {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--theme-border, #2a2a2a);
}

.liveshare-viewers-wrap[hidden] {
  display: none;
}

.liveshare-viewers__heading {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--theme-muted, #9aa0a6);
}

.liveshare-viewers__heading svg {
  width: 13px;
  height: 13px;
  display: block;
}

.liveshare-viewers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.liveshare-viewer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--theme-border, #2a2a2a);
  background: var(--theme-elevated, #141414);
}

.liveshare-viewer__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--theme-text, #e8eaef);
}

.liveshare-viewer__kick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, #ef4444 30%, var(--theme-border, #2a2a2a));
  background: transparent;
  color: #fca5a5;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.liveshare-viewer__kick svg {
  width: 13px;
  height: 13px;
  display: block;
}

.liveshare-viewer__kick:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: #ef4444;
}

.liveshare-viewer__kick:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

.liveshare-link-input {
  flex: 1;
  min-width: 0;
  color: var(--theme-muted, #9aa0a6);
}

.liveshare-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--theme-border, #2a2a2a);
  background: var(--theme-elevated, #141414);
  color: var(--theme-text, #e8eaef);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}

.liveshare-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

.liveshare-btn > span {
  position: relative;
  top: 0.5px;
}

.liveshare-btn:hover {
  border-color: var(--theme-accent-hot, #a78bfa);
  background: var(--theme-accent-soft-08, rgba(167, 139, 250, 0.08));
}

.liveshare-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--theme-accent-soft-20, rgba(167, 139, 250, 0.2));
}

.liveshare-btn--primary {
  background: var(--theme-accent-soft, rgba(167, 139, 250, 0.12));
  border-color: color-mix(in srgb, var(--theme-border, #2a2a2a) 65%, var(--theme-accent-hot, #a78bfa));
}

.liveshare-btn--icon {
  width: 42px;
  flex-shrink: 0;
  padding: 0;
}

.liveshare-btn--ghost {
  background: transparent;
  color: #fca5a5;
  border-color: color-mix(in srgb, #ef4444 28%, var(--theme-border, #2a2a2a));
}

.liveshare-btn--ghost:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
}

.liveshare-btn[hidden] {
  display: none;
}

.liveshare-status {
  margin: 14px 0 12px;
  min-height: 1.25em;
  font-size: 12px;
  line-height: 1.45;
  color: var(--theme-accent, #c4b5fd);
}

.liveshare-status.is-error {
  color: #fca5a5;
}

.liveshare-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.liveshare-role-badge {
  position: absolute;
  right: 2px;
  bottom: 2px;
  top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  pointer-events: none;
}

.liveshare-role-badge svg {
  width: 9px;
  height: 9px;
  stroke-width: 2.75;
  display: block;
}

.liveshare-role-badge--host {
  background: var(--theme-accent-soft-20, rgba(167, 139, 250, 0.2));
  color: var(--theme-accent, #c4b5fd);
}

.liveshare-role-badge--guest {
  background: rgba(52, 211, 153, 0.2);
  color: #6ee7b7;
}

.liveshare-role-badge[hidden] {
  display: none;
}

#liveshare-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#liveshare-btn > svg,
#liveshare-btn > i svg {
  display: block;
}

#liveshare-btn svg {
  width: 18px;
  height: 18px;
}

.nav-btn.liveshare-active {
  color: var(--theme-accent, #c4b5fd);
  background: var(--theme-accent-soft-08, rgba(167, 139, 250, 0.08));
  box-shadow: inset 0 0 0 1px var(--theme-accent-soft-20, rgba(167, 139, 250, 0.2));
}

html.liveshare-remote #liveshare-dlg {
  display: none !important;
}

html.liveshare-guest .omnibar-field,
html.liveshare-guest #new-tab,
html.liveshare-guest .tab .tab-close,
html.liveshare-guest #tab-bar .tab {
  pointer-events: none;
  opacity: 0.72;
}

html.liveshare-host #liveshare-section-join {
  opacity: 0.55;
}

html.liveshare-guest #liveshare-section-broadcast {
  opacity: 0.55;
}

html.liveshare-guest-pending #tab-bar,
html.liveshare-guest-pending #iframe-stack {
  visibility: hidden;
}

html.liveshare-guest-pending::before {
  content: "Connecting to LiveShare…";
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--theme-muted, #9aa0a6);
  background: var(--theme-bg, #0a0a0a);
  pointer-events: none;
}

.liveshare-ended-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  background: color-mix(in srgb, var(--theme-bg, #0a0a0a) 88%, transparent);
  backdrop-filter: blur(6px);
}

.liveshare-ended-overlay[hidden] {
  display: none;
}

.liveshare-ended-overlay__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--theme-text, #e8eaef);
}

.liveshare-ended-overlay__sub {
  margin: 0;
  font-size: 13px;
  color: var(--theme-muted, #9aa0a6);
}
