/* Libomedia Dark Editorial Software Design System
   Identity: Signals, Television Interfaces, Control Planes, Infrastructure
   Art Direction: Confident, Engineered, Premium, Quiet, Technical. Zero AI-Slop. */

:root {
  --bg-canvas: #08080a;
  --bg-surface: #0f1015;
  --bg-panel: #13141a;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text-main: #ededf0;
  --text-muted: #888992;
  --text-faint: #52535a;
  --accent: #e5a93c;
  --ok: #34d399;
  --err: #f87171;
  --radius-sm: 6px;
  --radius-md: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  background-color: var(--bg-canvas);
  color: var(--text-main);
}

body {
  background-color: var(--bg-canvas);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3.5rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #08080a;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: top 140ms ease;
}
.skip-link:focus {
  top: 1rem;
}

/* Button & Link base */
button, a {
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms var(--ease);
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
button:active:not(:disabled) {
  transform: scale(0.98);
}
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Primary and Secondary CTA Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  background: var(--accent);
  color: #08080a;
  font-size: 0.8125rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
}
.btn-primary:hover {
  background: #f0b54e;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  background: transparent;
  color: var(--text-main);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.btn-secondary:hover {
  border-color: var(--border-hover);
  background: var(--bg-surface);
}

/* Language switch */
.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.lang-opt {
  padding: 3px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 4px;
}
.lang-opt:hover {
  color: var(--text-main);
}
.lang-opt.active {
  background: #181922;
  color: var(--accent);
  border: 1px solid rgba(229, 169, 60, 0.3);
}

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* Editorial Columns (Not 3 identical cards) */
.editorial-column {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border-subtle);
}
@media (min-width: 768px) {
  .editorial-column {
    border-top: 0;
    border-left: 1px solid var(--border-subtle);
    padding: 0 1.75rem;
  }
  .editorial-column:first-child {
    border-left: 0;
    padding-left: 0;
  }
}

/* Real Television Schematic */
.tv {
  position: relative;
  width: 100%;
}
.tv-screen {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  border: 6px solid #1a1b22;
  outline: 1px solid var(--border-subtle);
  background: #060608;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 220ms ease;
}
.tv-screen[data-state="approved"] {
  border-color: #1e3a2f;
  outline-color: rgba(52, 211, 153, 0.4);
}
.tv-screen[data-state="rejected"] {
  border-color: #3b1d1d;
  outline-color: rgba(248, 113, 113, 0.4);
}
.tv-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  transition: opacity 220ms ease;
}
.tv-view-pending { opacity: 1; }
.tv-view-approved { opacity: 0; pointer-events: none; }
.tv-view-rejected { opacity: 0; pointer-events: none; }

.tv-screen[data-state="approved"] .tv-view-pending { opacity: 0; pointer-events: none; }
.tv-screen[data-state="approved"] .tv-view-approved { opacity: 1; pointer-events: auto; }

.tv-screen[data-state="rejected"] .tv-view-pending { opacity: 0; pointer-events: none; }
.tv-screen[data-state="rejected"] .tv-view-rejected { opacity: 1; pointer-events: auto; }

.tv-stand {
  width: 24%;
  height: 8px;
  background: #14151b;
  border: 1px solid var(--border-subtle);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  margin: 0 auto;
}
.tv-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 1rem;
  animation: pulse-signal 2s infinite ease-in-out;
}
@keyframes pulse-signal {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

/* Telegram Authorization Chat Bubble */
.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-bubble {
  background: #101217;
  border: 1px solid var(--border-subtle);
  border-radius: 8px 8px 8px 2px;
  padding: 12px 14px;
}
.chat-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  line-height: 1.6;
  color: #cfd0d6;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.chat-btn {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: #161920;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  text-align: center;
}
.chat-btn:hover:not(:disabled) {
  background: #1e222d;
  border-color: var(--border-hover);
}
.chat-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.chat-btn.chosen {
  border-color: rgba(229, 169, 60, 0.6);
  color: var(--accent);
  opacity: 1;
}
.chat-reply {
  animation: rise 220ms var(--ease);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Immutable Audit Log */
.audit-row {
  display: flex;
  gap: 14px;
  padding: 9px 14px;
  color: var(--text-muted);
  font-size: 11.5px;
}
.audit-row time {
  color: var(--text-faint);
  flex-shrink: 0;
}
.audit-row.new {
  color: var(--text-main);
  animation: rise 220ms var(--ease);
}

/* QR Login Flow */
.qr-step {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-align: left;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border: 1px solid transparent;
}
.qr-step:hover {
  color: var(--text-main);
}
.qr-step[aria-selected="true"] {
  color: var(--text-main);
  background: var(--bg-surface);
  border-color: var(--border-subtle);
}
.qr-step-n {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: #14151a;
  color: var(--text-muted);
}
.qr-step[aria-selected="true"] .qr-step-n {
  background: var(--accent);
  color: #08080a;
  font-weight: 700;
}

.qr-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  padding-bottom: 2rem;
}
.qr-tv {
  width: 86%;
}
.qr-tv .tv-screen > div {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5%;
  padding: 6%;
  transition: opacity 280ms var(--ease);
}
.qr-tv-b {
  flex-direction: column;
  opacity: 0;
}
.qr-stage[data-step="3"] .qr-tv-a {
  opacity: 0;
}
.qr-stage[data-step="3"] .qr-tv-b {
  opacity: 1;
}
.qr-card {
  background: #f4f4f6;
  padding: 6px;
  border-radius: 6px;
  width: 32%;
  max-width: 120px;
  flex-shrink: 0;
}
.qr-card img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

/* Phone Mockup */
.phone {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 36%;
  max-width: 160px;
  aspect-ratio: 9 / 18.5;
  border-radius: 18px;
  border: 4px solid #1a1b22;
  outline: 1px solid var(--border-subtle);
  background: #060608;
  overflow: hidden;
  box-shadow: -15px 25px 40px -10px rgba(0, 0, 0, 0.95);
}
.phone-notch {
  position: absolute;
  top: 5px;
  left: 50%;
  width: 34%;
  height: 8px;
  transform: translateX(-50%);
  background: #1a1b22;
  border-radius: 999px;
  z-index: 2;
}
.phone-view {
  position: absolute;
  inset: 0;
  padding: 22px 10px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 260ms var(--ease), transform 260ms var(--ease);
}
.qr-stage[data-step="1"] .phone-1,
.qr-stage[data-step="2"] .phone-2,
.qr-stage[data-step="3"] .phone-3 {
  opacity: 1;
  transform: none;
}
.phone-scan {
  margin-top: 6px;
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px dashed rgba(229, 169, 60, 0.5);
  position: relative;
  overflow: hidden;
}
.phone-scan span {
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--accent);
  animation: scan 1.8s ease-in-out infinite alternate;
}
@keyframes scan {
  from { top: 8%; }
  to { top: 90%; }
}
.phone-field {
  margin-top: 6px;
  padding: 5px 8px;
  border-radius: 4px;
  background: #121319;
  border: 1px solid var(--border-subtle);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #cfd0d6;
}
.phone-btn {
  margin-top: 8px;
  padding: 6px;
  border-radius: 4px;
  background: var(--accent);
  color: #08080a;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}
.phone-ok {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.4);
  position: relative;
}
.phone-ok::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 6px;
  width: 8px;
  height: 14px;
  border: solid var(--ok);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Simulation Buttons */
.sim-btn {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}
.sim-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-main);
}
.sim-btn.active {
  background: #161822;
  color: var(--text-main);
  border-color: rgba(229, 169, 60, 0.5);
}

/* Stream Resolver Item */
.resolver-tab {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}
.resolver-tab:hover {
  color: var(--text-main);
  border-color: var(--border-hover);
}
.resolver-tab.active {
  background: #161822;
  color: var(--accent);
  border-color: rgba(229, 169, 60, 0.5);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.95);
  transform: scale(0.98);
  transition: transform 160ms var(--ease);
}
.modal-backdrop.open .modal-card {
  transform: scale(1);
}
.modal-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: #14151b;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
}
.modal-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-canvas);
}
::-webkit-scrollbar-thumb {
  background: #23242c;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
