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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #333;
}

.app {
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px 30px;
}

header h1 {
  font-size: 28px;
  margin-bottom: 15px;
}

nav {
  display: flex;
  gap: 10px;
}

.nav-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.2);
  color: white;
  cursor: pointer;
  transition: all 0.3s;
}

.nav-btn:hover, .nav-btn.active {
  background: white;
  color: #667eea;
}

main {
  padding: 30px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}

.page-header h2 {
  font-size: 24px;
}

.btn-primary {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: #667eea;
  color: white;
  cursor: pointer;
  font-size: 14px;
}

.btn-primary:hover {
  background: #5568d3;
}

.btn-success {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: #10b981;
  color: white;
  cursor: pointer;
  font-size: 14px;
}

.btn-success:hover {
  background: #0da272;
}

.btn-danger {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: #ef4444;
  color: white;
  cursor: pointer;
  font-size: 14px;
}

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

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.action-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.action-card h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.action-card p {
  color: #666;
  font-size: 14px;
  margin: 5px 0;
}

.card-actions {
  margin-top: 15px;
  display: flex;
  gap: 10px;
}

.collect-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.collect-controls select, .collect-controls input {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}

.collect-container {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#video {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#canvas {
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  background: #000;
}

.collect-info {
  margin-top: 15px;
  display: flex;
  gap: 30px;
  font-size: 16px;
}

.table-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
}

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

th, td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

th {
  background: #f8f9fa;
  font-weight: 600;
}

.replay-container {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#replay-canvas {
  width: 100%;
  max-width: 800px;
  border-radius: 8px;
  background: #1a1a1a;
}

.replay-controls {
  margin-top: 20px;
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.replay-controls input[type="range"] {
  flex: 1;
  min-width: 200px;
}

.filter-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-controls select, .filter-controls input {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
}

.modal-content {
  background: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  position: relative;
}

.close {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 28px;
  cursor: pointer;
}

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

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-large {
  max-width: 800px !important;
}

.frame-management {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.crop-controls {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
}

.crop-controls h4 {
  margin: 0 0 15px 0;
  color: #333;
}

.crop-range {
  display: flex;
  gap: 15px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.range-input {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.range-input label {
  font-size: 14px;
  font-weight: 500;
}

.range-input input {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  width: 120px;
}

.frame-preview {
  background: #1a1a1a;
  padding: 20px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

#frame-canvas {
  border-radius: 6px;
  background: #2a2a2a;
}

.frame-info {
  display: flex;
  gap: 30px;
  color: #fff;
  font-size: 16px;
}

.frame-nav {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.frame-nav input[type="range"] {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}
