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

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-hover: #1a1a1a;
  --border: #2a2a2a;
  --text: #ffffff;
  --text-muted: #888888;
  --primary: #e1306c;
  --primary-hover: #c52d5f;
  --success: #22c55e;
  --error: #ef4444;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
}

main {
  flex: 1;
}

/* Upload Form */
.upload-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.upload-box {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: all 0.2s;
  overflow: hidden;
}

.upload-box:hover,
.upload-box.dragover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.upload-box.has-file {
  border-style: solid;
  border-color: var(--success);
}

.upload-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.upload-box label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  min-height: 180px;
}

.upload-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.upload-text strong {
  display: block;
  margin-bottom: 0.25rem;
}

.upload-text span {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.preview {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
}

.preview.active {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}

.preview img,
.preview video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.preview .preview-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* Submit Button */
.submit-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.submit-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

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

.btn-loading {
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.btn-loading:not([hidden]) {
  display: flex;
}

[hidden] {
  display: none !important;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Progress Section */
.progress-section,
.result-section {
  margin-top: 2rem;
}

.progress-card,
.result-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
}

.progress-header h2 {
  margin-bottom: 0.5rem;
}

.progress-header p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.progress-bar-container {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
  animation: pulse 2s ease-in-out infinite;
}

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

.progress-status {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.task-id {
  font-family: monospace;
  font-size: 0.75rem;
}

/* Result Section */
.result-card h2 {
  margin-bottom: 1rem;
}

.result-card.success h2 {
  color: var(--success);
}

.result-card.error h2 {
  color: var(--error);
}

.result-card video {
  width: 100%;
  max-height: 400px;
  border-radius: 8px;
  margin-bottom: 1rem;
  background: black;
}

.result-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
  border: none;
}

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

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

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

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

/* Footer */
footer {
  text-align: center;
  padding-top: 2rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

footer strong {
  color: var(--primary);
}
