:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --background: #0f172a;
  --surface: #1e293b;
  --text: #f8fafc;
  --text-secondary: #94a3b8;
  --error: #ef4444;
  --success: #22c55e;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

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

h1 {
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.upload-section {
  margin-bottom: 2rem;
}

.upload-area {
  border: 2px dashed var(--text-secondary);
  border-radius: 1rem;
  padding: 3rem;
  text-align: center;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-area:hover {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.1);
}

.upload-area input[type="file"] {
  display: none;
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.upload-icon {
  fill: var(--text-secondary);
}

.upload-hint {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.primary-button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s ease;
  width: 100%;
}

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

.processing-status {
  text-align: center;
  margin: 2rem 0;
}

.processing-status.hidden {
  display: none;
}

.hidden {
  display: none!important;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--text-secondary);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 1s linear infinite;
}

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

.progress-steps {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  position: relative;
}

.progress-steps::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text-secondary);
  z-index: 1;
}

.step {
  background: var(--background);
  padding: 0.5rem 1rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  position: relative;
  z-index: 2;
  color: var(--text-secondary);
}

.step.active {
  color: var(--primary-color);
  font-weight: 500;
}

.error-message {
  background: var(--error);
  color: white;
  padding: 1rem;
  border-radius: 0.5rem;
  margin: 1rem 0;
  text-align: center;
}

.video-section {
  margin-top: 2rem;
}

.video-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.video-loading,
.video-error {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  z-index: 1;
  pointer-events: none;
}

.video-loading .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

.video-error {
  background: rgba(220, 38, 38, 0.9);
  pointer-events: auto;
}

.video-error .primary-button {
  margin-top: 1rem;
}

video {
  width: 100%;
  display: block;
}

#subtitle-overlay {
  position: absolute;
  left: 50%;
  bottom: 10%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  font-size: 24px;
  font-family: Arial, sans-serif;
  white-space: nowrap;
  transition: all 0.3s ease;
  z-index: 1000;
  min-width: 100px;
  text-align: center;
}

.word {
  display: inline-block;
  margin: 0 4px;
  opacity: 0.5;
  transform: scale(0.9);
  transition: all 0.2s ease;
}

.word.active {
  opacity: 1;
  transform: scale(1.1);
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.word.past {
  opacity: 0.3;
  transform: scale(0.9);
}

.word.future {
  opacity: 0.3;
  transform: scale(0.9);
}

/* Add smooth transition for word changes */
#subtitle-overlay {
  transition: opacity 0.3s ease;
}

/* Ensure words don't jump around */
.word {
  min-width: 1em;
  text-align: center;
}

.controls-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

.subtitle-editor, .style-editor {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: 1rem;
}

h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

textarea {
  width: 100%;
  background: var(--background);
  border: 1px solid var(--text-secondary);
  border-radius: 0.5rem;
  padding: 1rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  resize: vertical;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.style-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.style-group label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.style-group input {
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--text-secondary);
  background: var(--background);
  color: var(--text);
}

.position-controls {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--text-secondary);
}

.position-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.editor-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.5rem;
  background: var(--surface);
  border-radius: 0.5rem;
}

.toolbar-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--background);
  border: 1px solid var(--text-secondary);
  border-radius: 0.25rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.toolbar-button:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.toolbar-button svg {
  fill: currentColor;
}

.subtitle-list {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 1rem;
  background: var(--surface);
  border-radius: 0.5rem;
  padding: 0.5rem;
}

.subtitle-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--background);
  border-radius: 0.25rem;
  margin-bottom: 0.5rem;
}

.subtitle-item.active {
  background: var(--primary-color);
}

.subtitle-time {
  font-family: monospace;
  color: var(--text-secondary);
  min-width: 100px;
}

.subtitle-text {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  padding: 0.25rem;
  resize: none;
}

.subtitle-text:focus {
  outline: 1px solid var(--primary-color);
  border-radius: 0.25rem;
}

.style-input {
  width: 100%;
  padding: 0.5rem;
  background: var(--background);
  border: 1px solid var(--text-secondary);
  border-radius: 0.25rem;
  color: var(--text);
  font-family: inherit;
}

.style-input[type="range"] {
  -webkit-appearance: none;
  height: 4px;
  background: var(--text-secondary);
  border-radius: 2px;
  margin: 1rem 0;
}

.style-input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
}

.range-value {
  display: block;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
} 