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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f0f;
  color: #e1e1e1;
  min-height: 100vh;
}

.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 40px 20px;
}

h1 {
  text-align: center;
  font-size: 28px;
  margin-bottom: 8px;
  color: #fff;
}

h1 span { color: #ff4444; }

.subtitle {
  text-align: center;
  color: #888;
  margin-bottom: 32px;
  font-size: 14px;
}

.input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.input-wrap {
  flex: 1;
  position: relative;
}

.input-wrap input[type="text"] {
  width: 100%;
  padding: 14px 40px 14px 18px;
  border: 2px solid #333;
  border-radius: 12px;
  background: #1a1a1a;
  color: #fff;
  font-size: 16px;
  outline: none;
  transition: border-color .2s;
}

.input-wrap input[type="text"]:focus { border-color: #ff4444; }
.input-wrap input[type="text"]::placeholder { color: #555; }

.clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  line-height: 1;
  display: none;
}

.clear-btn:hover { color: #ff4444; background: #252525; }
.clear-btn.visible { display: block; }

button {
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}

.btn-primary {
  background: #ff4444;
  color: #fff;
}

.btn-primary:hover { background: #e03333; }
.btn-primary:disabled { background: #555; cursor: not-allowed; }

.btn-secondary {
  background: #2a2a2a;
  color: #ccc;
  padding: 10px 20px;
  font-size: 14px;
}

.btn-secondary:hover { background: #333; }

/* Video Info Card */
.video-card {
  background: #1a1a1a;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
  display: none;
}

.video-card.visible { display: block; }

.video-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.video-info { padding: 20px; }

.video-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
}

.video-meta {
  color: #888;
  font-size: 13px;
  margin-bottom: 16px;
}

/* Mode Toggle */
.mode-toggle {
  display: flex;
  background: #252525;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 16px;
}

.mode-toggle button {
  flex: 1;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: #888;
  transition: all .2s;
}

.mode-toggle button.active {
  background: #ff4444;
  color: #fff;
}

.mode-toggle button:not(.active):hover { color: #ccc; }

/* Audio format selector */
.audio-formats {
  display: none;
  margin-bottom: 16px;
}

.audio-formats.visible { display: block; }

.audio-formats label {
  font-size: 13px;
  color: #888;
  margin-bottom: 8px;
  display: block;
}

.audio-format-row {
  display: flex;
  gap: 8px;
}

.audio-format-btn {
  padding: 8px 18px;
  background: #252525;
  border: 2px solid #333;
  border-radius: 10px;
  color: #ccc;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  font-size: 14px;
  font-weight: 600;
}

.audio-format-btn:hover { border-color: #ff4444; color: #fff; }

.audio-format-btn.selected {
  border-color: #ff4444;
  background: #2a1515;
  color: #ff4444;
}

.format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.format-btn {
  padding: 10px 12px;
  background: #252525;
  border: 2px solid #333;
  border-radius: 10px;
  color: #ccc;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  font-size: 14px;
}

.format-btn:hover { border-color: #ff4444; color: #fff; }

.format-btn.selected {
  border-color: #ff4444;
  background: #2a1515;
  color: #ff4444;
}

.format-btn .quality { font-weight: 700; font-size: 16px; }
.format-btn .size { font-size: 11px; color: #777; margin-top: 2px; }

/* Action buttons row */
.action-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-transcript {
  background: #2a2a2a;
  color: #ccc;
  padding: 14px 24px;
}

.btn-transcript:hover { background: #333; color: #fff; }

.download-section { text-align: center; }

.dl-progress {
  display: none;
  margin-top: 16px;
}

.dl-progress.visible { display: block; }

.dl-progress-bar-bg {
  height: 8px;
  background: #252525;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.dl-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #ff4444, #ff6666);
  border-radius: 4px;
  width: 0%;
  transition: width .3s;
}

.dl-progress-bar.indeterminate {
  animation: indeterminate 1.5s ease-in-out infinite;
}

.dl-progress-text {
  color: #aaa;
  font-size: 13px;
  text-align: center;
}

.dl-progress-steps {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 8px;
}

.dl-step {
  color: #555;
  font-size: 12px;
  transition: color .3s;
}

.dl-step.active { color: #ff4444; }
.dl-step.done { color: #6bff6b; }

/* Transcript Area */
.transcript-area {
  display: none;
  margin-top: 16px;
}

.transcript-area.visible { display: block; }

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

.transcript-header span {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

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

.transcript-actions button {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.transcript-box {
  background: #111;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 14px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
  color: #ccc;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.transcript-box::-webkit-scrollbar { width: 6px; }
.transcript-box::-webkit-scrollbar-track { background: #111; }
.transcript-box::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

.transcript-langs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.lang-btn {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
  background: #252525;
  border: 1px solid #333;
  color: #aaa;
  cursor: pointer;
  transition: all .2s;
}

.lang-btn:hover { border-color: #ff4444; color: #fff; }
.lang-btn.selected { border-color: #ff4444; color: #ff4444; background: #2a1515; }

/* Progress */
.progress-area {
  display: none;
  margin-bottom: 24px;
}

.progress-area.visible { display: block; }

.progress-bar-bg {
  height: 6px;
  background: #252525;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  height: 100%;
  background: #ff4444;
  border-radius: 3px;
  width: 0%;
  animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
  0% { width: 0%; margin-left: 0; }
  50% { width: 60%; margin-left: 20%; }
  100% { width: 0%; margin-left: 100%; }
}

.progress-text {
  color: #888;
  font-size: 14px;
  text-align: center;
}

/* Status Messages */
.status {
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  display: none;
}

.status.visible { display: block; }

.status.error {
  background: #2a1515;
  color: #ff6b6b;
  border: 1px solid #3a2020;
}

.status.success {
  background: #152a15;
  color: #6bff6b;
  border: 1px solid #203a20;
}

/* Downloads List */
.downloads-section { margin-top: 40px; }

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

.downloads-header h2 {
  font-size: 18px;
  color: #fff;
}

.clear-all-btn {
  background: none;
  border: 1px solid #333;
  color: #888;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
}

.clear-all-btn:hover { border-color: #ff4444; color: #ff4444; }

.download-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #1a1a1a;
  border-radius: 10px;
  margin-bottom: 8px;
}

.download-item-name {
  font-size: 14px;
  color: #ccc;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 12px;
}

.download-item-size {
  color: #666;
  font-size: 12px;
  margin-right: 12px;
  white-space: nowrap;
}

.download-item a {
  color: #ff4444;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.download-item a:hover { text-decoration: underline; }

.delete-btn {
  background: none;
  border: none;
  color: #555;
  font-size: 15px;
  cursor: pointer;
  padding: 2px 6px;
  margin-left: 10px;
  border-radius: 4px;
  transition: all .2s;
}

.delete-btn:hover { color: #ff4444; background: #2a1515; }

.empty-state {
  text-align: center;
  color: #555;
  padding: 24px;
  font-size: 14px;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 32px 20px 24px;
  color: #555;
  font-size: 13px;
}

.site-footer a {
  color: #ff4444;
  text-decoration: none;
  font-weight: 600;
}

.site-footer a:hover {
  text-decoration: underline;
}
