/* LightCam — Ultra Lightweight Dark Production Interface */
:root {
  --bg-color: #090a0c;
  --surface-color: #121418;
  --surface-hover: #1b1e24;
  --surface-card: #161920;
  --border-color: #272a30;
  --border-focus: #3e4450;
  --text-main: #ffffff;
  --text-muted: #8e95a5;
  --text-dim: #5c6270;
  
  --color-live: #ff3434;
  --color-live-glow: rgba(255, 52, 52, 0.4);
  --color-success: #24c875;
  --color-warning: #f5a623;
  --color-accent: #3b82f6;

  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

p {
  color: var(--text-muted);
}

/* Layout Containers */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  padding: 1.25rem;
  position: relative;
}

/* Landing Page Styles */
.landing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.5rem;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

.brand-badge .dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background-color: var(--color-live);
}

.hero-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: auto 0;
  text-align: center;
}

.hero-title {
  font-size: 2rem;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
}

.target-badge-group {
  display: inline-flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.target-badge {
  padding: 0.25rem 0.75rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  width: 100%;
  min-height: 52px;
  padding: 0.875rem 1.5rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--text-main);
  color: var(--bg-color);
}

.btn-primary:hover {
  background-color: #e2e8f0;
}

.btn-live {
  background-color: var(--color-live);
  color: #ffffff;
  box-shadow: 0 0 16px var(--color-live-glow);
}

.btn-live:hover {
  background-color: #ff4a4a;
}

.btn-secondary {
  background-color: var(--surface-color);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--surface-hover);
}

.btn-icon {
  width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: var(--radius-full);
  background-color: rgba(18, 20, 24, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon.active {
  background-color: var(--text-main);
  color: var(--bg-color);
  border-color: var(--text-main);
}

.btn-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Feature Checklist */
.features-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding: 1rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: left;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.feature-item svg {
  width: 18px;
  height: 18px;
  fill: var(--color-success);
  flex-shrink: 0;
}

/* Camera Stream Viewport */
.camera-viewport {
  position: relative;
  width: 100%;
  height: calc(100vh - 2.5rem);
  max-height: 840px;
  background-color: #000000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border-color);
}

.camera-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-color: #000000;
}

.camera-video.mirrored {
  transform: scaleX(-1);
}

/* Camera Overlay Controls */
.camera-top-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status-tag.live {
  border-color: var(--color-live);
  color: #ffffff;
}

.status-tag.live .dot {
  background-color: var(--color-live);
  animation: pulse-live 1.5s infinite;
}

.status-tag.ready .dot {
  background-color: var(--color-success);
}

.status-tag.waiting .dot {
  background-color: var(--color-warning);
}

.status-tag .dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.camera-bottom-bar {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding: 1rem;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
}

.camera-control-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 0.75rem;
}

/* Preset Cards */
.preset-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.preset-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: rgba(18, 20, 24, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
}

.preset-card.active {
  border-color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.preset-card .preset-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-main);
}

.preset-card .preset-desc {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* Modal / Card Overlays */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 400px;
  background-color: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.url-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.url-text {
  font-family: monospace;
  font-size: 0.8125rem;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.qr-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  background: #ffffff;
  border-radius: var(--radius-md);
  margin: 0 auto;
}

/* Collapsible Advanced Stats */
.stats-panel {
  display: none;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.625rem;
  font-family: monospace;
  font-size: 0.6875rem;
  line-height: 1.4;
  color: #a0aec0;
}

.stats-panel.open {
  display: block;
}

.stat-row {
  display: flex;
  justify-content: space-between;
}

.stat-val {
  color: var(--text-main);
  font-weight: 600;
}

/* Ultra Clean Viewer Styles (OBS/vMix) */
body.viewer-body {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  background: transparent !important;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#remoteVideo {
  width: 100vw;
  height: 100vh;
  object-fit: contain;
  background: transparent;
  display: block;
}

#remoteVideo.fit-cover {
  object-fit: cover;
}

/* Offline & Debug HUD for Viewer */
.viewer-hud {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.75rem;
  z-index: 50;
  display: none;
}

.viewer-hud.active {
  display: block;
}
