/* Local overrides for Stream2 Opname Console.
   Base styling is provided by /cp/cp-tailwind.css (audiostreamen-controlpanel-ui). */

* {
  box-sizing: border-box;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

:root {
  --as-brand-dark: #0c3f8f;
  --as-brand-dark-hover: #0a3579;
  --as-brand-light: #66d3ff;
  --as-brand-light-bg: #e9f7ff;
}

/* Brand skin (Tailwind-based UI pages). */
.tw-shell {
  background:
    radial-gradient(1200px 320px at 20% -10%, rgba(102, 211, 255, 0.16), rgba(102, 211, 255, 0) 55%),
    radial-gradient(900px 280px at 90% -20%, rgba(12, 63, 143, 0.08), rgba(12, 63, 143, 0) 60%),
    #f8fafc !important;
}

.tw-card-title {
  color: var(--as-brand-dark) !important;
}

.tw-btn-primary {
  background-color: var(--as-brand-dark) !important;
  color: #fff !important;
}

.tw-btn-primary:hover {
  background-color: var(--as-brand-dark-hover) !important;
  opacity: 1 !important;
}

.tw-btn-ghost {
  border-color: #cbd5e1 !important;
}

.tw-btn-ghost:hover {
  background-color: var(--as-brand-light-bg) !important;
  border-color: #93c5fd !important;
  color: var(--as-brand-dark) !important;
}

.tw-input:focus {
  border-color: var(--as-brand-dark) !important;
  --tw-ring-color: rgba(12, 63, 143, 0.35) !important;
}

.tw-navlink:hover,
.tw-navlink-active {
  background-color: var(--as-brand-light-bg) !important;
  color: var(--as-brand-dark) !important;
}

.tw-topbar {
  border-bottom-color: #dbeafe !important;
}

.tw-sidebar {
  border-right: 1px solid #cbd5e1 !important;
}

.tw-topbar {
  border-bottom: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 0 rgba(148, 163, 184, 0.25);
}

.tw-topbar-left {
  min-width: 0;
}

.tw-topbar-center {
  width: min(40rem, 100%);
  justify-self: center;
}

.top-search-wrap {
  position: relative;
  width: 100%;
}

.top-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 12px;
  pointer-events: none;
}

.top-search-input {
  width: 100%;
  padding-left: 34px !important;
  border-color: #bfdbfe !important;
  background-color: #ffffff !important;
}

.top-search-input:focus {
  border-color: var(--as-brand-dark) !important;
}

@media (max-width: 1024px) {
  .tw-topbar {
    height: auto !important;
    gap: 10px !important;
    align-items: stretch !important;
  }

  .tw-topbar-center {
    width: 100%;
    justify-self: stretch;
  }
}

/* Login-first:
   - When not authenticated: show only login (white background).
   - After login: show full app (cp UI default background). */
.auth-only {
  display: none;
}

.auth-locked .auth-only {
  display: block;
}

/* Lock down all controls when not authenticated (UI only; API enforces auth too). */
.auth-locked .auth-required {
  display: none !important;
}

.auth-locked.tw-shell {
  background-color: #ffffff !important;
}

.auth-locked .app-main {
  margin-left: 0 !important;
}

.auth-locked .app-content {
  max-width: none;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.auth-locked #notice {
  width: min(28rem, calc(100% - 32px));
}

/* Full-width info layout on all pages. */
.app-main .app-content {
  max-width: none !important;
  width: 100%;
}

.app-main .app-content .tw-card.auth-required {
  width: 100%;
  max-width: none;
}

#regionsContainer > article {
  width: 100%;
}

.sidebar-live-player {
  border-top: 1px solid #e2e8f0;
  margin-top: 16px;
  padding-top: 12px;
}

.sidebar-live-player-title {
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  font-weight: 700;
}

.sidebar-live-player-now {
  margin-top: 6px;
  font-size: 12px;
  color: #334155;
  word-break: break-all;
}

.sidebar-live-player-audio {
  margin-top: 8px;
  width: 100%;
}

/* Region cards: show key runtime fields as horizontal blocks. */
.region-hblocks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.region-hblock {
  flex: 1 1 18rem;
  min-width: 14rem;
}

/* Top status as one horizontal line. */
.status-inline {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.status-inline-item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 10px;
}

.status-inline-label {
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  font-weight: 700;
}

.status-inline-value {
  font-size: 13px;
  line-height: 1.25;
  color: #0f172a;
  font-weight: 600;
  white-space: nowrap;
}

.status-inline-item.status-inline-wide {
  min-width: 26rem;
}

.status-inline-item.status-inline-wide .status-inline-value {
  display: inline-block;
  max-width: 44rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.autoplay-shell .app-content {
  max-width: 1500px;
}

.autoplay-root-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.autoplay-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.root-tab.is-active {
  border-color: transparent;
}

.folder-tree-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 10px;
}

.folder-tree-title {
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  font-weight: 700;
  margin-bottom: 8px;
}

.folder-tree {
  max-height: 220px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.folder-tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
}

.folder-tree-toggle {
  width: 20px;
  height: 20px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #334155;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.folder-tree-name {
  border: 0;
  background: transparent;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.2;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
}

.folder-tree-name:hover {
  background: #e2e8f0;
}

.folder-tree-name.is-active {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}

.media-toolbar {
  display: grid;
  grid-template-columns: minmax(18rem, 1fr) minmax(12rem, 18rem) auto;
  gap: 10px;
  align-items: center;
}

.media-toolbar-search .tw-input {
  width: 100%;
}

.media-toolbar-usage {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.media-usage-track {
  position: relative;
  width: 100%;
  height: 18px;
  border-radius: 8px;
  overflow: hidden;
  background: #e2e8f0;
}

.media-usage-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #0ea5e9 100%);
  transition: width 120ms ease;
}

.media-toolbar-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.autoplay-topmenu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}

.autoplay-topmenu-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.autoplay-topmenu-roots {
  border-top: 1px solid #f1f5f9;
  padding-top: 8px;
}

.autoplay-topmenu .tw-btn {
  flex: 0 0 auto;
}

.autoplay-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.45);
  z-index: 60;
}

.autoplay-modal {
  position: fixed;
  inset: 0;
  z-index: 61;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.autoplay-modal-card {
  width: min(900px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
}

body.modal-open {
  overflow: hidden;
}

.autoplay-modal.tw-hidden,
.autoplay-modal-backdrop.tw-hidden {
  display: none !important;
}

.playlist-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.playlist-panel {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 10px;
  min-height: 420px;
}

.playlist-panel-title {
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  font-weight: 700;
  margin-bottom: 8px;
}

.playlist-library-tree {
  max-height: 380px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.playlist-library-tree.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.playlist-lib-node {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  padding: 4px 6px;
}

.playlist-lib-node > summary {
  cursor: pointer;
  font-weight: 600;
  color: #0f172a;
}

.playlist-lib-node-body {
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.playlist-lib-track {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  padding: 6px 8px;
  font-size: 12px;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.playlist-lib-track.is-selected {
  border-color: #3b82f6;
  background: #eff6ff;
}

.playlist-lib-track-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.playlist-lib-track-select {
  flex: 0 0 auto;
}

.playlist-lib-track-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-track-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 380px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.playlist-track-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
  color: #64748b;
  font-size: 12px;
}

.playlist-track-item {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: move;
}

.playlist-track-item.is-drop-target {
  border-color: #3b82f6;
  background: #eff6ff;
}

.playlist-track-label {
  font-size: 12px;
  color: #0f172a;
  word-break: break-all;
}

.playlist-track-actions {
  flex: 0 0 auto;
}

@media (max-width: 920px) {
  .media-toolbar {
    grid-template-columns: 1fr;
  }

  .media-toolbar-actions {
    justify-content: flex-start;
  }

  .playlist-layout {
    grid-template-columns: 1fr;
  }
}

/* Exact top menu style (Tailwind Plus-like) for backup dashboard. */
.topmenu-exact {
  position: sticky;
  top: 0;
  z-index: 40;
  gap: 12px !important;
  align-items: center !important;
}

.topmenu-menubtn {
  padding: 8px !important;
  min-width: 42px;
  min-height: 42px;
}

.topmenu-main {
  display: flex;
  flex: 1 1 auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.topmenu-search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.topmenu-search-input {
  width: 100%;
  padding-left: 34px !important;
}

.topmenu-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.topmenu-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.topmenu-iconbtn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}

.topmenu-iconbtn:hover {
  color: #64748b;
  background: #f8fafc;
}

.topmenu-icon-svg {
  width: 20px;
  height: 20px;
}

.topmenu-separator-mobile,
.topmenu-separator-desktop {
  width: 1px;
  height: 24px;
  background: #e2e8f0;
}

.topmenu-separator-desktop {
  display: none;
}

.topmenu-profile {
  position: relative;
}

.topmenu-profile-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.topmenu-profile-summary::-webkit-details-marker {
  display: none;
}

.topmenu-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  object-fit: cover;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
}

.topmenu-name {
  display: none;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 600;
  color: #0f172a;
}

.topmenu-chevron {
  display: none;
  width: 18px;
  height: 18px;
  color: #94a3b8;
}

.topmenu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 220px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.topmenu-dropdown-row {
  padding: 2px 2px 4px;
}

.topmenu-dropdown-item {
  width: 100%;
  justify-content: flex-start;
}

@media (min-width: 1024px) {
  .topmenu-separator-mobile {
    display: none;
  }

  .topmenu-separator-desktop {
    display: block;
  }

  .topmenu-name,
  .topmenu-chevron {
    display: inline-block;
  }
}

@media (max-width: 1024px) {
  .topmenu-exact {
    height: 64px !important;
  }

  .topmenu-main {
    gap: 8px;
  }

  .topmenu-actions {
    gap: 8px;
  }

  .topmenu-dropdown {
    width: min(220px, calc(100vw - 20px));
  }
}
