/* ══════════════════════════════════════════════════════════════════════════════
   SCRIPT GENERATOR STYLES
   Styles for Script Generator route
   ══════════════════════════════════════════════════════════════════════════════ */

/* ─── Form Styles ─── */
.script-gen-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.script-gen-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.script-gen-form label {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.script-gen-form input,
.script-gen-form select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg3);
  color: var(--text);
  transition: all 0.2s;
  font-family: inherit;
}

.script-gen-form input::placeholder {
  color: var(--text-dim);
}

/* ─── Custom Dropdown ─── */
.custom-select-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
}

.custom-select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--bg3);
  color: var(--text);
  transition: all 0.2s;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
}

.custom-select::after {
  content: '';
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M0 3l6 6 6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}

.custom-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.custom-select.open::after {
  transform: rotate(180deg);
}

.custom-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  margin-top: -1px;
}

.custom-options.show {
  display: block;
}

.custom-option {
  padding: 10px 12px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.custom-option:last-child {
  border-bottom: none;
}

.custom-option:hover {
  background: var(--bg3);
  color: var(--accent);
}

.custom-option.selected {
  background: var(--accent);
  color: white;
  font-weight: 500;
}

.custom-option.selected:hover {
  background: #2563eb;
}

.script-gen-form select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M0 3l6 6 6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  color-scheme: light dark;
  accent-color: var(--accent);
}

.script-gen-form select option {
  background: var(--bg2);
  color: var(--text);
  padding: 8px;
}

.script-gen-form select option:checked {
  background: var(--accent);
  color: white;
}

.script-gen-form input:focus,
.script-gen-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background-color: var(--bg3);
}

.script-gen-form textarea {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg3);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
  transition: all 0.2s;
}

.script-gen-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.script-gen-form small {
  font-size: 12px;
  color: var(--text-dim);
}

/* ─── Button Styles (Global) ─── */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  text-decoration: none;
  outline: none;
}

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

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

/* Button Variants */
.btn-primary {
  background: var(--accent, #3b82f6);
  color: white;
  border: 1px solid var(--accent, #3b82f6);
}

.btn-primary:hover:not(:disabled) {
  background: #2563eb;
  border-color: #2563eb;
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--bg3);
  border-color: var(--accent);
}

.btn-success {
  background: #10b981;
  color: white;
  border: 1px solid #10b981;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
  border-color: #059669;
}

.btn-error {
  background: #ef4444;
  color: white;
  border: 1px solid #ef4444;
}

.btn-error:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
}

/* Button Sizes */
.btn-block {
  width: 100%;
  display: flex;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
}

/* ─── Quick Topics ─── */
.quick-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.script-gen-chip {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg2);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-weight: 500;
}

.script-gen-chip:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: translateY(-1px);
}

.script-gen-chip:active {
  transform: translateY(0);
}

.script-gen-chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Results Container ─── */
.script-gen-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.script-gen-result-placeholder {
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Script Display Card ─── */
.script-display-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.script-display-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.script-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
}

.script-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.script-text-area {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.script-text-area p {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.copy-script-btn {
  align-self: flex-start;
}

/* ─── Scenes Container ─── */
.scenes-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.scenes-container h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.scenes-meta {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
}

/* ─── Scene Card ─── */
.scene-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s;
}

.scene-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.scene-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.scene-number {
  font-weight: 600;
  background: var(--accent);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.scene-keyword {
  font-weight: 500;
  color: var(--text);
  flex: 1;
}

.scene-duration {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg3);
  padding: 4px 8px;
  border-radius: 4px;
}

.scene-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ─── Narration Box ─── */
.narration-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.narration-box h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.narration-box p {
  background: var(--bg3);
  border-left: 3px solid var(--accent);
  padding: 12px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
}

/* ─── Prompt Options ─── */
.prompt-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.prompt-tab-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.prompt-tab-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.prompt-tab-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--bg3);
  border-radius: 6px;
}

.prompt-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.prompt-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompt-text {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  overflow-x: auto;
}

.prompt-text code {
  font-family: "Fira Code", "Monaco", "Courier New", monospace;
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}

.copy-prompt-btn {
  align-self: flex-start;
  font-size: 12px;
  padding: 6px 12px;
}

/* ─── Fallback Badge ─── */
.fallback-badge {
  display: inline-block;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #f59e0b;
  margin-top: 8px;
}

/* ─── Combined Narrations Card ─── */
.narration-combined-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.narration-combined-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.narration-combined-meta {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
}

.narration-combined-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}

.narration-combined-box p {
  font-family: "Fira Code", "Monaco", "Courier New", monospace;
  font-size: 13px;
  color: var(--text);
  line-height: 2;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.copy-combined-narration-btn {
  align-self: flex-start;
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.copy-combined-narration-btn:hover {
  background: #2563eb;
  border-color: #2563eb;
  transform: translateY(-1px);
}

.copy-combined-narration-btn:active {
  transform: translateY(0);
}

/* ─── Export Card ─── */
.export-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.export-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.export-card p {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
}

.export-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.export-buttons .btn {
  flex: 1;
  min-width: 140px;
  padding: 10px 14px;
  font-size: 13px;
}

/* ─── Copy Button ─── */
.copy-script-btn,
.copy-prompt-btn {
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.copy-script-btn:hover,
.copy-prompt-btn:hover {
  background: #2563eb;
  border-color: #2563eb;
  transform: translateY(-1px);
}

.copy-script-btn:active,
.copy-prompt-btn:active {
  transform: translateY(0);
}

.copy-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 16px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.copy-btn:hover {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
  border-radius: 4px;
}

/* ─── Loading State ─── */
.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 20px;
  min-height: 300px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-card p {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0;
}

/* ─── Progress Area ─── */
.progress-area {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.progress-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.progress-header .spinner {
  width: 24px;
  height: 24px;
  border-width: 2px;
}

.progress-header-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.progress-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.progress-percent {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}

.progress-track {
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  transition: width 0.3s ease;
  border-radius: 3px;
}

.progress-steps {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg3);
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.3s;
}

.progress-step.pending {
  opacity: 0.5;
  color: var(--text-dim);
}

.progress-step.active {
  background: var(--accent);
  color: white;
  opacity: 1;
}

.progress-step.completed {
  background: var(--success-color, #10b981);
  color: white;
  opacity: 1;
}

.step-icon {
  font-size: 14px;
}

.step-label {
  font-weight: 500;
}

/* ─── Output Card ─── */
.output-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── Live Events ─── */
.live-events {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  font-family: "Monaco", "Courier New", monospace;
  font-size: 11px;
}

.live-event {
  padding: 8px;
  border-radius: 4px;
  line-height: 1.4;
  word-break: break-word;
}

.live-event.info {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border-left: 2px solid #3b82f6;
  padding-left: 12px;
}

.live-event.success {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border-left: 2px solid #10b981;
  padding-left: 12px;
}

.live-event.error {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-left: 2px solid #ef4444;
  padding-left: 12px;
}

.live-event.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border-left: 2px solid #f59e0b;
  padding-left: 12px;
}

/* ─── Panel Layout ─── */
.panel {
  background: var(--bg);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 0;
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.panel-form {
  background: var(--bg);
  max-width: 600px;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}

.panel-results {
  background: var(--bg);
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 120px);
}

@media (max-width: 768px) {
  .panel-form {
    max-width: none;
    width: 100%;
    padding: 16px;
  }

  .panel-results {
    max-height: none;
  }
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 24px 0;
}

/* ─── Radio Group (Visual Prompt Quality) ─── */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg2);
}

.radio-card:hover {
  border-color: var(--accent);
  background: var(--bg3);
}

.radio-card input[type="radio"] {
  margin-top: 4px;
  cursor: pointer;
  flex-shrink: 0;
}

.radio-card input[type="radio"]:checked + .radio-title {
  color: var(--accent);
  font-weight: 600;
}

.radio-title {
  font-weight: 500;
  color: var(--text);
  display: block;
}

.radio-desc {
  font-size: 12px;
  color: var(--text-dim);
  display: block;
  line-height: 1.4;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .quick-topics {
    gap: 6px;
  }

  .script-gen-chip {
    padding: 6px 10px;
    font-size: 11px;
  }

  .script-meta {
    gap: 8px;
  }

  .scene-header {
    gap: 8px;
  }

  .export-buttons {
    flex-direction: column;
  }

  .export-buttons .btn {
    width: 100%;
  }

  .script-text-area {
    max-height: 300px;
  }
}

/* ─── Empty State ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 48px;
}

.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.empty-hint {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.5;
}
