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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #0ea5e9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #0f172a;
  --bg-light: #1e293b;
  --bg-lighter: #334155;
  --text: #f8fafc;
  --text-secondary: #94a3b8;
  --border: #334155;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.app-container {
  min-height: 100vh;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 700;
}

.logo-icon {
  font-size: 32px;
  color: var(--primary-light);
}

.logo-text {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 12px;
}

.nav-btn {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.nav-btn:hover {
  color: var(--text);
  background: var(--bg-light);
}

.nav-btn-primary {
  background: var(--primary);
  color: white;
}

.nav-btn-primary:hover {
  background: var(--primary-dark);
}

.hero {
  padding-bottom: 60px;
}

.hero-content {
  text-align: center;
  padding: 80px 20px 60px;
  max-width: 900px;
  margin: 0 auto;
}

.hero-title {
  font-size: 56px;
  font-weight: 800;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.hero-subtitle {
  font-size: 20px;
  color: var(--text-secondary);
  margin-bottom: 40px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-lg {
  padding: 18px 40px;
  font-size: 18px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(99, 102, 241, 0.5);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 6px 16px;
  font-size: 14px;
}

.btn-icon {
  font-size: 20px;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}

.feature-card {
  background: var(--bg-light);
  padding: 32px;
  border-radius: var(--radius);
  text-align: center;
  border: 1px solid var(--border);
  transition: all 0.3s;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.feature-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 14px;
}

.platform-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 40px;
}

.platform-section h2 {
  font-size: 36px;
  text-align: center;
  margin-bottom: 40px;
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.platform-item {
  display: flex;
  gap: 16px;
  padding: 24px;
  background: var(--bg-light);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.platform-icon {
  font-size: 40px;
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-lighter);
  border-radius: var(--radius-sm);
}

.platform-item h4 {
  font-size: 16px;
  margin-bottom: 4px;
}

.platform-item p {
  color: var(--text-secondary);
  font-size: 14px;
}

.footer {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}

.cast-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 40px;
  min-height: 100vh;
}

.cast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  margin-bottom: 24px;
}

.cast-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.status-online {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.status-offline {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-secondary);
}

.status-connecting {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.status-active {
  background: rgba(14, 165, 233, 0.15);
  color: var(--secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.card {
  background: var(--bg-light);
  border-radius: var(--radius);
  padding: 28px;
  border: 1px solid var(--border);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 14px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  transition: all 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-light);
}

.form-input-code {
  text-align: center;
  font-size: 28px;
  letter-spacing: 8px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form-actions .btn {
  flex: 1;
  justify-content: center;
}

.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: white;
  border-radius: var(--radius);
  display: inline-block;
}

.qr-container img {
  width: 220px;
  height: 220px;
  display: block;
}

.device-info-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-top: 20px;
}

.device-info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.device-info-row:last-child {
  border-bottom: none;
}

.device-info-label {
  color: var(--text-secondary);
}

.device-info-value {
  font-weight: 600;
}

.video-container {
  background: #000;
  border-radius: var(--radius);
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-placeholder {
  text-align: center;
  color: var(--text-secondary);
}

.video-placeholder-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.video-placeholder-text {
  font-size: 18px;
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.stat-item {
  background: var(--bg);
  padding: 16px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-light);
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.control-bar {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  background: var(--bg-light);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
}

.admin-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  padding: 0 8px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.admin-menu {
  list-style: none;
}

.admin-menu-item {
  margin-bottom: 4px;
}

.admin-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.admin-menu-link:hover,
.admin-menu-link.active {
  background: var(--primary);
  color: white;
}

.admin-menu-icon {
  font-size: 18px;
}

.admin-content {
  padding: 32px;
  overflow-x: auto;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.admin-header h1 {
  font-size: 28px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-light);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.stat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.stat-card-title {
  font-size: 14px;
  color: var(--text-secondary);
}

.stat-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 20px;
}

.stat-card-icon-blue {
  background: rgba(14, 165, 233, 0.15);
  color: var(--secondary);
}

.stat-card-icon-green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.stat-card-icon-purple {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
}

.stat-card-icon-orange {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.stat-card-value {
  font-size: 32px;
  font-weight: 700;
}

.stat-card-change {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.admin-section {
  background: var(--bg-light);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.admin-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.admin-section-title {
  font-size: 18px;
  font-weight: 600;
}

.admin-section-body {
  padding: 16px 24px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.data-table th {
  color: var(--text-secondary);
  font-weight: 500;
  background: var(--bg);
}

.data-table tr:hover td {
  background: rgba(99, 102, 241, 0.05);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.table-actions {
  display: flex;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.badge-blue {
  background: rgba(14, 165, 233, 0.15);
  color: var(--secondary);
}

.badge-yellow {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.badge-gray {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-secondary);
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 16px;
}

.loading-spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 16px 24px;
  border-radius: var(--radius-sm);
  background: var(--bg-light);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 1000;
  animation: slideIn 0.3s;
  max-width: 400px;
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-error {
  border-left: 4px solid var(--danger);
}

.toast-info {
  border-left: 4px solid var(--secondary);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.capture-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.capture-option {
  padding: 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.capture-option:hover {
  border-color: var(--primary-light);
}

.capture-option.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

.capture-option-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.capture-option-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.section-hidden {
  display: none;
}

@media (max-width: 768px) {
  .nav {
    padding: 16px 20px;
  }
  
  .hero-title {
    font-size: 36px;
  }
  
  .cast-container {
    padding: 16px;
  }
  
  .main-grid {
    grid-template-columns: 1fr;
  }
  
  .admin-layout {
    grid-template-columns: 1fr;
  }
  
  .admin-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  .stats-panel {
    grid-template-columns: 1fr;
  }
}
