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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #f5f5f5;
  min-height: 100vh;
  color: #333;
}

/* Top Bar & Branding */
.top-bar {
  background: white;
  border-bottom: 1px solid #e0e0e0;
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

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

.main-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: #333;
  text-align: center;
  flex: 1;
  margin: 0;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.language-selector {
  padding: 8px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.language-selector:hover {
  border-color: #999;
  background: #f9f9f9;
}

.get-started-btn {
  background: #1a1a1a;
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.get-started-btn:hover {
  background: #333;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.profile-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #e0e0e0;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: #666;
}

.profile-icon:hover {
  border-color: #999;
  background: #f9f9f9;
  color: #333;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px;
}

.section-heading {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 24px;
}

.generation-section {
  margin-top: 40px;
}

.selected-template-info {
  margin-bottom: 24px;
  padding: 16px;
  background: #f8f9ff;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.selected-template-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #666;
  font-size: 0.95rem;
}

.selected-template-badge span {
  color: #999;
}

.selected-template-badge strong {
  color: #667eea;
  font-weight: 600;
}

.text-input-group {
  margin-bottom: 24px;
}

.text-input-group label {
  display: block;
  margin-bottom: 12px;
  font-weight: 600;
  color: #333;
  font-size: 1rem;
}

.prompt-input {
  width: 100%;
  padding: 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
  background: white;
  line-height: 1.6;
}

.prompt-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Template Section */
.template-section {
  margin-bottom: 60px;
}

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

.see-all-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #667eea;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
}

.see-all-link:hover {
  color: #5568d3;
}

.template-grid {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
  scrollbar-color: #e0e0e0 transparent;
}

.template-grid::-webkit-scrollbar {
  height: 8px;
}

.template-grid::-webkit-scrollbar-track {
  background: transparent;
}

.template-grid::-webkit-scrollbar-thumb {
  background: #e0e0e0;
  border-radius: 4px;
}

.template-grid::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}

.template-item {
  flex: 0 0 200px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.template-item:hover {
  transform: translateY(-4px);
}

.template-item.selected {
  border: 3px solid #667eea;
  border-radius: 12px;
  padding: 4px;
}

.template-item.selected .template-thumbnail {
  border: 2px solid #667eea;
}

.template-item.selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  background: #667eea;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.template-thumbnail {
  width: 200px;
  height: 120px;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  position: relative;
}

.template-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.template-placeholder {
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  padding: 12px;
}

.template-title {
  font-size: 0.9rem;
  color: #666;
  text-align: center;
  margin: 0;
}

/* Hidden Sections (for functionality) */
.hidden-section {
  display: none;
}

.card {
  background: white;
  border-radius: 16px;
  padding: 30px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #e0e0e0;
}

.card h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: #333;
}

/* Preview */
.preview-container {
  margin-top: 20px;
}

.preview-wrapper {
  position: relative;
  display: inline-block;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.preview-wrapper img,
.preview-wrapper video {
  max-width: 100%;
  max-height: 400px;
  display: block;
}

.remove-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 0, 0, 0.8);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.remove-btn:hover {
  background: rgba(255, 0, 0, 1);
}

/* Input Tabs */
.input-tabs {
  margin-top: 20px;
}

.tab-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #eee;
}

.tab-button {
  padding: 12px 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
}

.tab-button:hover {
  color: #667eea;
}

.tab-button.active {
  color: #667eea;
  border-bottom-color: #667eea;
  font-weight: 600;
}

.tab-panel {
  display: none;
  padding: 20px 0;
}

.tab-panel.active {
  display: block;
}

/* Recording Instructions */
.recording-instructions {
  margin-bottom: 24px;
  padding: 20px;
  background: #f8f9ff;
  border-radius: 12px;
  border: 2px solid #e0e0e0;
}

.instruction-text {
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
  font-size: 1rem;
}

.reference-sentence {
  background: white;
  padding: 16px;
  border-radius: 8px;
  border: 2px solid #667eea;
}

.reference-sentence p {
  margin: 0;
  font-size: 1.1rem;
  color: #333;
  line-height: 1.6;
  font-style: italic;
  text-align: center;
}

.info-box {
  padding: 16px;
  background: #e8f5e9;
  border: 2px solid #4caf50;
  border-radius: 8px;
  margin-bottom: 20px;
}

.info-box p {
  margin: 0;
  color: #2e7d32;
  font-size: 0.95rem;
}

/* Recording Controls */
.recording-controls {
  text-align: center;
}

.record-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 12px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 auto;
  transition: transform 0.2s, box-shadow 0.2s;
}

.record-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.record-btn:active {
  transform: translateY(0);
}

.record-btn.recording {
  background: #ff4444;
}

.record-icon {
  font-size: 1.5rem;
}

.recording-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  color: #ff4444;
  font-weight: 600;
}

.pulse {
  width: 12px;
  height: 12px;
  background: #ff4444;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

/* Upload Area */
.upload-area {
  border: 3px dashed #667eea;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #f8f9ff;
}

.upload-area:hover {
  border-color: #764ba2;
  background: #f0f2ff;
}

.upload-area.small {
  padding: 20px;
}

.upload-area.dragover {
  border-color: #764ba2;
  background: #e8ebff;
}

.upload-content svg {
  color: #667eea;
  margin-bottom: 12px;
}

.upload-content p {
  margin: 8px 0;
  color: #666;
}

.upload-hint {
  font-size: 0.9rem;
  color: #999;
}

/* Audio Preview */
.audio-preview-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 2px solid #e0e0e0;
}

.audio-preview-section h3 {
  font-size: 1.2rem;
  margin-bottom: 16px;
  color: #333;
}

.preview-btn {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.preview-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.preview-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.preview-audio-container {
  margin-top: 20px;
  padding: 20px;
  background: #f8f9ff;
  border-radius: 12px;
  border: 2px solid #28a745;
}

.preview-label {
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
}

.preview-audio-container audio {
  width: 100%;
  margin-bottom: 12px;
}

.preview-note {
  font-size: 0.9rem;
  color: #666;
  font-style: italic;
  margin: 0;
  padding: 12px;
  background: white;
  border-radius: 8px;
}

/* Upload Toggle */
.upload-toggle-section {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  padding: 8px;
  background: #f5f5f5;
  border-radius: 12px;
  width: fit-content;
}

.upload-toggle-btn {
  padding: 10px 24px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  color: #666;
}

.upload-toggle-btn:hover {
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
}

.upload-toggle-btn.active {
  background: #667eea;
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Upload Section */
.upload-section {
  margin-top: 24px;
}

.upload-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 20px;
}

.upload-option {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upload-label {
  font-weight: 600;
  color: #333;
  font-size: 1rem;
}

.upload-preview {
  position: relative;
  margin-top: 12px;
  display: inline-block;
}

/* Voice and Style Selection */
.voice-style-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.voice-selector-group,
.style-selector-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.voice-selector-group label,
.style-selector-group label {
  font-weight: 600;
  color: #333;
  font-size: 1rem;
}

.voice-select,
.style-select {
  padding: 10px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: white;
  cursor: pointer;
  transition: border-color 0.3s;
}

.voice-select:focus,
.style-select:focus {
  outline: none;
  border-color: #667eea;
}

/* Quality Selector */
.quality-selector {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.quality-selector label {
  font-weight: 600;
  color: #333;
  font-size: 1rem;
}

.quality-select {
  flex: 1;
  max-width: 200px;
  padding: 10px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: white;
  cursor: pointer;
  transition: border-color 0.3s;
}

.quality-select:focus {
  outline: none;
  border-color: #667eea;
}

/* Generate Button */
.generate-btn {
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 18px 32px;
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.generate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px 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 */
.progress-container {
  margin-top: 20px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  width: 0%;
  transition: width 0.3s;
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.progress-text {
  text-align: center;
  color: #666;
  font-size: 0.9rem;
}

/* Result */
.result-container {
  text-align: center;
}

.result-container video {
  width: 100%;
  max-width: 480px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  margin-bottom: 20px;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.download-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s;
}

.download-btn:hover {
  background: #218838;
}

.generate-btn.secondary {
  background: #667eea;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.generate-btn.secondary:hover {
  background: #5568d3;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
  .top-bar-content {
    padding: 0 20px;
    flex-wrap: wrap;
  }

  .main-title {
    font-size: 1.25rem;
    width: 100%;
    order: 1;
    margin-bottom: 12px;
  }

  .top-bar-actions {
    order: 2;
    width: 100%;
    justify-content: flex-end;
  }

  .container {
    padding: 20px;
  }

  .asset-input-box {
    padding: 20px;
  }

  .template-item {
    flex: 0 0 160px;
  }

  .template-thumbnail {
    width: 160px;
    height: 96px;
  }

  .upload-options {
    grid-template-columns: 1fr;
  }

  .voice-style-section {
    grid-template-columns: 1fr;
  }
}
