@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500&display=swap");

:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --bg-ink: #151410;
  --bg-muted: #f1ede6;
  --bg-card: #ffffff;
  --accent: #18a89b;
  --accent-strong: #0c6f68;
  --accent-warm: #d4915a;
  --ink: #151410;
  --ink-muted: #5a564c;
  --border: rgba(21, 20, 16, 0.12);
  --shadow: 0 24px 50px rgba(21, 20, 16, 0.15);
  font-family: "Space Grotesk", "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: radial-gradient(circle at top left, #fff7ec 0%, #f7f4ef 42%, #eef5f3 100%);
  color: var(--ink);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at 20% 20%, rgba(24, 168, 155, 0.15), transparent 45%),
    radial-gradient(circle at 85% 12%, rgba(255, 155, 82, 0.18), transparent 40%),
    radial-gradient(circle at 40% 80%, rgba(24, 168, 155, 0.1), transparent 50%);
  pointer-events: none;
  z-index: -1;
}

#main {
  min-height: 100vh;
}

.app {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px clamp(16px, 4vw, 40px) 36px;
  animation: fadeIn 0.6s ease-out;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.add-source {
  border: none;
  border-radius: 14px;
  background: var(--accent-strong);
  color: white;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.add-source:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(12, 111, 104, 0.25);
}

.source-menu {
  position: absolute;
  top: 48px;
  right: 0;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 520px;
  overflow-y: auto;
  z-index: 10;
}

.source-menu-title {
  font-size: 13px;
  font-weight: 500;
}

.source-menu-status {
  font-size: 12px;
  color: var(--ink-muted);
}

.source-menu-item {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-muted);
}

.source-menu-action {
  border: none;
  border-radius: 12px;
  background: var(--bg-muted);
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
}

.source-menu-action.small {
  padding: 6px 10px;
  border-radius: 10px;
}

.source-menu-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.source-menu-inline .source-menu-input {
  flex: 1;
}

.source-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

.source-menu-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.source-menu-subsection {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.source-menu-label {
  font-size: 11px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.source-menu-input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 12px;
  background: var(--bg-muted);
}

.source-menu-button {
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
}

.source-menu-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-muted);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-title {
  font-size: clamp(24px, 2.6vw, 30px);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--ink-muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 13px;
  color: var(--ink-muted);
  box-shadow: 0 10px 20px rgba(21, 20, 16, 0.08);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(24, 168, 155, 0.2);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 4px rgba(24, 168, 155, 0.2);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(24, 168, 155, 0.08);
  }
  100% {
    box-shadow: 0 0 0 4px rgba(24, 168, 155, 0.2);
  }
}

.grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 2fr);
  gap: 20px;
}

.left-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel {
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-header .panel-title {
  margin-bottom: 0;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-select {
  border: 1px solid var(--border);
  background: var(--bg-muted);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.panel-button {
  border: none;
  border-radius: 12px;
  background: var(--bg-muted);
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
}

.pager {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pager-button {
  border: none;
  border-radius: 10px;
  background: var(--bg-muted);
  padding: 6px 10px;
  font-size: 11px;
  cursor: pointer;
}

.pager-label {
  font-size: 12px;
  color: var(--ink-muted);
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow: auto;
  padding-right: 4px;
}

.channel-card {
  border-radius: 14px;
  border: 1px solid transparent;
  background: var(--bg-muted);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease, box-shadow 0.2s ease;
}

.channel-badge {
  align-self: flex-start;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  background: rgba(21, 20, 16, 0.08);
  color: var(--ink-muted);
}

.channel-badge.drm {
  background: rgba(255, 155, 82, 0.2);
  color: #a14d00;
}

.channel-badge.source {
  background: rgba(24, 168, 155, 0.16);
  color: #0f6c63;
}

.channel-card:hover {
  transform: translateY(-2px);
  border: 1px solid rgba(24, 168, 155, 0.4);
  box-shadow: 0 12px 24px rgba(21, 20, 16, 0.1);
}

.channel-card.active {
  border: 1px solid var(--accent);
  background: rgba(24, 168, 155, 0.1);
}

.channel-title {
  font-size: 15px;
  font-weight: 600;
}

.channel-meta {
  font-size: 13px;
  color: var(--ink-muted);
}

.channel-detail {
  font-size: 11px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.source-status {
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.source-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.source-card {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fbf9f6;
  padding: 12px 14px;
}

.source-name {
  font-weight: 600;
  margin-bottom: 6px;
}

.source-meta {
  font-size: 12px;
  color: var(--ink-muted);
}

.catalog-panel {
  margin-bottom: 18px;
}

.player-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #0f0f0f;
  border: 1px solid rgba(21, 20, 16, 0.2);
  position: relative;
}

.video-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.11;
  mix-blend-mode: overlay;
  background:
    linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.045),
      rgba(0, 0, 0, 0.045)
    ),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.04) 0px,
      rgba(255, 255, 255, 0.04) 1px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0) 4px
    );
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.meta-card {
  border-radius: 12px;
  background: #fdfbf8;
  border: 1px solid var(--border);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink-muted);
}

.meta-card.drm {
  border-color: rgba(255, 155, 82, 0.5);
  background: rgba(255, 155, 82, 0.12);
}

.meta-card strong {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.share-card {
  margin-top: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-muted);
}

.share-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.share-label {
  font-size: 11px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.share-value {
  font-size: 12px;
  color: var(--ink);
  word-break: break-all;
}

.share-link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.share-link {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  font-size: 12px;
  background: #fbf9f6;
  color: var(--ink);
}

.share-copy {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.share-copy:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(30, 23, 17, 0.08);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink);
}

.toggle input {
  accent-color: var(--accent);
}

.share-input {
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  font-size: 12px;
  background: #fbf9f6;
  color: var(--ink);
}

.moq-panel {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.moq-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.moq-label {
  font-size: 12px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.moq-input {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-size: 13px;
  background: #fbf9f6;
  color: var(--ink);
}

.moq-input:focus {
  outline: none;
  border-color: rgba(24, 168, 155, 0.6);
  box-shadow: 0 0 0 3px rgba(24, 168, 155, 0.15);
}

.moq-button {
  margin-top: 6px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.moq-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(24, 168, 155, 0.25);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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