/* External application broadcast mode for OME MIRON Streams. */

.broadcast-mode-tabs {
  display: inline-flex;
  gap: 8px;
  margin: 0 0 18px;
  padding: 5px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 12px;
  background: rgba(10, 17, 24, 0.86);
}

.broadcast-mode-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #94a3b8;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.broadcast-mode-tabs button.active {
  color: #f8fafc;
  border-color: rgba(0, 212, 200, 0.35);
  background: linear-gradient(90deg, rgba(0, 212, 200, 0.18), rgba(0, 212, 200, 0.06));
  box-shadow: inset 2px 0 0 #00d4c8;
}

.broadcast-mode-tabs button span {
  color: #35e6d8;
  font-size: 16px;
}

.external-broadcast-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.external-access-card,
.external-instructions-card {
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(17, 24, 32, 0.98), rgba(10, 16, 22, 0.98));
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.2);
}

.external-access-card {
  min-height: 430px;
  overflow: hidden;
}

.external-access-card .broadcast-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.external-state {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 999px;
  color: #94a3b8;
  background: rgba(5, 12, 17, 0.68);
  font-size: 11px;
  font-weight: 700;
}

.external-state.ready {
  color: #7cf5e8;
  border-color: rgba(0, 212, 200, 0.3);
  background: rgba(0, 212, 200, 0.09);
}

.external-empty-state {
  display: flex;
  min-height: 340px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px;
  text-align: center;
}

.external-empty-icon {
  display: grid;
  width: 82px;
  height: 82px;
  margin-bottom: 18px;
  place-items: center;
  border: 1px solid rgba(0, 212, 200, 0.24);
  border-radius: 50%;
  color: #39e8db;
  background: radial-gradient(circle, rgba(0, 212, 200, 0.15), transparent 68%);
  font-size: 34px;
}

.external-empty-state h3 {
  margin: 0 0 8px;
  color: #f8fafc;
  font-size: 20px;
}

.external-empty-state p {
  max-width: 520px;
  margin: 0 0 22px;
  color: #8ea1b2;
  line-height: 1.6;
}

.external-empty-state .primary-button {
  width: auto;
  min-width: 230px;
}

.external-credentials {
  display: grid;
  gap: 13px;
  padding: 22px 24px 24px;
}

.credential-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 11px;
  background: rgba(3, 10, 15, 0.72);
}

.credential-row > div:first-child {
  min-width: 0;
}

.credential-row span,
.key-expiry small {
  display: block;
  margin-bottom: 5px;
  color: #708597;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.credential-row strong {
  display: block;
  overflow: hidden;
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credential-row button,
.key-expiry button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(0, 212, 200, 0.22);
  border-radius: 8px;
  color: #a8fff7;
  background: rgba(0, 212, 200, 0.08);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.credential-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.stream-key-value {
  letter-spacing: 0.08em;
}

.key-expiry {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  border: 1px solid rgba(34, 197, 94, 0.24);
  border-radius: 11px;
  background: rgba(34, 197, 94, 0.055);
}

.key-expiry .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.7);
}

.key-expiry strong {
  display: block;
  margin-bottom: 4px;
  color: #e9fff4;
  font-size: 12px;
}

.key-expiry small {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
}

.key-expiry.expired {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.06);
}

.key-expiry.expired .status-dot {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.65);
}

.external-instructions-card {
  grid-column: 1 / -1;
  padding: 22px 24px 24px;
}

.instruction-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.instruction-heading h3 {
  margin: 4px 0 0;
  color: #f8fafc;
  font-size: 18px;
}

.instruction-heading a {
  padding: 9px 12px;
  border: 1px solid rgba(0, 212, 200, 0.28);
  border-radius: 8px;
  color: #80fff4;
  text-decoration: none;
  background: rgba(0, 212, 200, 0.07);
  font-size: 11px;
  font-weight: 700;
}

.instruction-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.instruction-steps li {
  display: flex;
  gap: 10px;
  min-height: 92px;
  padding: 13px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 10px;
  background: rgba(4, 11, 16, 0.62);
}

.instruction-steps li > span {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  place-items: center;
  border-radius: 7px;
  color: #001c1a;
  background: #25d9cc;
  font-size: 11px;
  font-weight: 900;
}

.instruction-steps strong,
.instruction-steps small {
  display: block;
}

.instruction-steps strong {
  margin-bottom: 5px;
  color: #ecf7fb;
  font-size: 11px;
}

.instruction-steps small {
  color: #718698;
  font-size: 9px;
  line-height: 1.45;
}

.ffmpeg-example {
  margin-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  padding-top: 14px;
}

.ffmpeg-example summary {
  color: #9fb2c1;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.ffmpeg-example code {
  display: block;
  overflow-x: auto;
  margin-top: 10px;
  padding: 13px;
  border-radius: 8px;
  color: #a7fff7;
  background: #040a0e;
  font-size: 10px;
  white-space: nowrap;
}

.external-alert {
  margin: 0 24px 22px;
}

@media (max-width: 1050px) {
  .external-broadcast-layout {
    grid-template-columns: 1fr;
  }

  .external-instructions-card {
    grid-column: auto;
  }

  .instruction-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 650px) {
  .broadcast-mode-tabs {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .broadcast-mode-tabs button {
    justify-content: center;
    padding-inline: 8px;
    font-size: 11px;
  }

  .credential-row,
  .key-expiry,
  .instruction-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .key-expiry {
    grid-template-columns: 10px 1fr;
  }

  .key-expiry button {
    grid-column: 1 / -1;
  }

  .instruction-steps {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   OMS — Larix Broadcaster mobile streaming instructions
   ========================================================= */

.larix-instructions-card {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.larix-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 15px;
}

.larix-heading h3 {
  margin: 0;
  color: #fff;
  font-size: 15px;
}

.larix-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.larix-store-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.larix-store-links a {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  color: #dce8f0;
  padding: 8px 11px;
  font-size: 9px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transition:
    border-color 0.15s,
    background 0.15s,
    color 0.15s;
}

.larix-store-links a:hover {
  border-color: rgba(34, 211, 181, 0.48);
  background: rgba(34, 211, 181, 0.1);
  color: #fff;
}

.larix-connection-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 15px;
  border: 1px solid rgba(34, 211, 181, 0.22);
  border-radius: 11px;
  background: rgba(34, 211, 181, 0.06);
  padding: 12px;
}

.larix-connection-box > div {
  min-width: 0;
}

.larix-connection-box span,
.larix-connection-box strong {
  display: block;
}

.larix-connection-box span {
  color: var(--muted);
  font-size: 9px;
}

.larix-connection-box strong {
  margin-top: 5px;
  color: #dffcf7;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  overflow-wrap: anywhere;
}

.larix-connection-box button {
  border: 1px solid #0f7f70;
  border-radius: 9px;
  background: linear-gradient(#138f7d, #0f7568);
  color: #effffd;
  min-height: 35px;
  padding: 8px 12px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.larix-connection-box button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.larix-steps {
  margin-top: 0;
}

.larix-recommendations {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(7, 16, 25, 0.55);
  padding: 12px;
}

.larix-recommendations > strong {
  color: #f3f8fb;
  font-size: 10px;
}

.larix-recommendations > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.larix-recommendations span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  padding: 6px 9px;
  font-size: 8px;
}

.larix-recommendations b {
  color: #dce8f0;
}

@media (max-width: 720px) {
  .larix-heading {
    display: grid;
  }

  .larix-store-links {
    justify-content: flex-start;
  }

  .larix-connection-box {
    grid-template-columns: 1fr;
  }

  .larix-connection-box button {
    width: 100%;
  }
}

/* Mobile layout correction for OMS workspace */
@media (max-width: 1200px), (max-device-width: 900px), (hover: none), (pointer: coarse) {
  html,
  body,
  #root {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100% !important;
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .app-shell {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 100dvh !important;
    height: auto !important;
    overflow: visible !important;
  }

  .sidebar {
    position: relative !important;
    inset: auto !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: auto !important;
    height: auto !important;
    padding: 12px !important;
    box-sizing: border-box !important;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(126, 151, 173, 0.14) !important;
  }

  .brand-block {
    min-width: 0 !important;
  }

  .main-nav {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
  }

  .sidebar-section,
  .sidebar-status,
  .sidebar-spacer,
  .user-card {
    display: none !important;
  }

  .main-content,
  .broadcast-content,
  .monitoring-content,
  .admin-content {
    display: block !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 18px 12px 32px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  .page-heading {
    width: 100% !important;
    min-width: 0 !important;
  }

  .page-heading h1 {
    font-size: clamp(30px, 10vw, 44px) !important;
    line-height: 1.05 !important;
    overflow-wrap: anywhere !important;
  }

  .broadcast-mode-tabs {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .broadcast-mode-tabs button {
    width: 100% !important;
    min-width: 0 !important;
    padding-inline: 8px !important;
    justify-content: center !important;
    white-space: normal !important;
  }

  .broadcast-layout,
  .external-broadcast-layout,
  .monitoring-layout,
  .admin-dashboard-grid,
  .admin-dashboard-grid.two-column {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .external-access-card,
  .external-instructions-card,
  .broadcast-source-card,
  .broadcast-settings-card,
  .glass-panel,
  .info-panel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .external-access-card .broadcast-card-header,
  .external-instructions-card {
    padding: 16px !important;
  }

  .credential-row,
  .key-expiry,
  .instruction-heading,
  .external-actions {
    min-width: 0 !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .credential-row input,
  .credential-row code,
  .credential-value,
  .external-credentials {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  .instruction-steps {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
