/**
 * SynthNova MVP+ UI Styles
 * Stage 2: Dashboard / Assets / Generate / Gallery / Job Details / Queue Monitor
 */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
}

/* Header */
.header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.project-controls input {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
  width: 280px;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

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

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

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

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

.btn-success:hover {
  background: #059669;
}

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

.btn-danger:hover {
  background: #dc2626;
}

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

.btn-outline {
  background: transparent;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.btn-outline:hover {
  background: var(--gray-100);
}

.btn-xs {
  padding: 4px 8px;
  font-size: 12px;
}

.btn-accent {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border: none;
}

.btn-accent:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

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

/* Project Selector Dropdowns */
.project-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-dropdown-wrapper {
  position: relative;
}

.dropdown-arrow {
  font-size: 10px;
  margin-left: 4px;
  transition: transform 0.2s ease;
}

.project-dropdown-wrapper.open .dropdown-arrow {
  transform: rotate(180deg);
}

.project-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 280px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  display: none;
  max-height: 400px;
  overflow: hidden;
}

.project-dropdown-wide {
  min-width: 350px;
}

.project-dropdown-wrapper.open .project-dropdown {
  display: block;
}

.dropdown-header {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dropdown-search {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  font-size: 13px;
  max-width: 180px;
}

.dropdown-list {
  max-height: 300px;
  overflow-y: auto;
}

.dropdown-item {
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.1s ease;
  border-bottom: 1px solid var(--gray-100);
}

.dropdown-item:hover {
  background: var(--gray-50);
}

.dropdown-item-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--gray-900);
  margin-bottom: 2px;
}

.dropdown-item-id {
  font-size: 11px;
  color: var(--gray-500);
  font-family: monospace;
}

.dropdown-item-date {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 2px;
}

.dropdown-empty, .dropdown-loading, .dropdown-error {
  padding: 20px 16px;
  text-align: center;
  color: var(--gray-500);
  font-size: 13px;
}

.dropdown-error {
  color: var(--danger);
}

.dropdown-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--gray-500);
  background: var(--gray-50);
}

/* Connection Status */
.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-500);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-300);
}

.status-dot.connected {
  background: var(--success);
}

.status-dot.disconnected {
  background: var(--danger);
}

/* Tabs */
.tabs {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
}

.tabs-list {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  gap: 4px;
}

.tab-btn {
  padding: 12px 20px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--gray-700);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Main Content */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.tab-content {
  display: none;
}

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

/* N-Target Generator Styles */
.generate-mode-toggle {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: var(--gray-100);
  border-radius: 8px;
  width: fit-content;
}

.mode-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mode-btn:hover:not(.active) {
  color: var(--gray-900);
}

.ntarget-config {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.config-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.config-row label {
  font-weight: 500;
  min-width: 120px;
}

.config-input {
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 16px;
  width: 150px;
}

.config-input-sm {
  padding: 6px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
  width: 80px;
}

.config-hint {
  color: var(--gray-500);
  font-size: 13px;
}

.config-section {
  background: var(--gray-50);
  padding: 16px;
  border-radius: 8px;
}

.config-section h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--gray-700);
}

.slot-structure {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.slot-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 20px;
  border-radius: 8px;
  min-width: 80px;
}

.slot-hook { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border: 1px solid #f59e0b; }
.slot-mid { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); border: 1px solid #3b82f6; }
.slot-cta { background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%); border: 1px solid #22c55e; }

.slot-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--gray-700);
}

.slot-count {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
}

.slot-arrow {
  color: var(--gray-400);
  font-size: 20px;
}

.pool-info {
  color: var(--gray-600);
  font-size: 13px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.setting-item label {
  font-weight: 500;
  font-size: 13px;
  min-width: 140px;
}

.setting-hint {
  font-size: 11px;
  color: var(--gray-500);
  width: 100%;
  margin-left: 148px;
}

.generate-controls {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.ntarget-status {
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  margin-left: 12px;
}

.ntarget-status.status-running {
  color: var(--info);
  background: #eff6ff;
}

.ntarget-status.status-paused {
  color: var(--warning);
  background: #fffbeb;
}

.ntarget-status.status-completed {
  color: var(--success);
  background: #ecfdf5;
}

.ntarget-status.status-exhausted {
  color: #d97706;
  background: #fef3c7;
  border: 1px solid #fbbf24;
}

.ntarget-status.status-cancelled {
  color: var(--danger);
  background: #fef2f2;
}

.progress-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.progress-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar-large {
  height: 24px;
  background: var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
}

.progress-fill-large {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, #8b5cf6 100%);
  border-radius: 12px;
  transition: width 0.3s ease;
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--gray-700);
}

#ntarget-progress-percent {
  font-weight: 700;
  font-size: 18px;
  color: var(--primary);
}

.rejection-stats h4, .coverage-stats h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--gray-700);
}

.rejection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.rejection-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: 6px;
}

.rejection-label {
  font-size: 13px;
  color: var(--gray-600);
}

.rejection-count {
  font-weight: 600;
  color: var(--danger);
}

.coverage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.coverage-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.coverage-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.coverage-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.coverage-fill {
  height: 100%;
  background: var(--success);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Cards */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  padding: 20px;
  margin-bottom: 20px;
}

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

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--gray-900);
}

.stat-label {
  font-size: 12px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.stat-card.created .stat-value { color: var(--info); }
.stat-card.processing .stat-value { color: var(--warning); }
.stat-card.completed .stat-value { color: var(--success); }
.stat-card.failed .stat-value { color: var(--danger); }

/* Asset Counters */
.asset-counters {
  display: flex;
  gap: 24px;
  margin-top: 16px;
}

.asset-counter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.asset-counter-badge {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: white;
}

.asset-counter-badge.hook { background: #8b5cf6; }
.asset-counter-badge.mid { background: #06b6d4; }
.asset-counter-badge.cta { background: #f97316; }

.asset-counter-label {
  font-size: 13px;
  color: var(--gray-700);
}

/* Expected Count Banner */
.expected-banner {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: white;
  border-radius: 8px;
  padding: 16px 20px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.expected-text {
  font-size: 14px;
}

.expected-count {
  font-size: 24px;
  font-weight: 700;
}

/* Upload Form */
.upload-section {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.upload-card {
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  transition: all 0.15s ease;
}

.upload-card:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.02);
}

.upload-card.hook { border-color: #8b5cf6; }
.upload-card.mid { border-color: #06b6d4; }
.upload-card.cta { border-color: #f97316; }

.upload-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.upload-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.upload-hint {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 12px;
}

.upload-input {
  display: none;
}

.upload-btn {
  width: 100%;
}

.upload-status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--gray-500);
  min-height: 18px;
}

.upload-status.uploading {
  color: var(--primary);
}

.upload-status.done {
  color: var(--success);
}

.upload-status.error {
  color: var(--danger);
}

/* Assets List */
.assets-list {
  display: grid;
  gap: 8px;
}

.asset-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--gray-50);
  border-radius: 8px;
}

.asset-type-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: white;
}

.asset-type-badge.hook { background: #8b5cf6; }
.asset-type-badge.mid { background: #06b6d4; }
.asset-type-badge.cta { background: #f97316; }

.asset-name {
  flex: 1;
  font-size: 14px;
  color: var(--gray-700);
}

.asset-size {
  font-size: 12px;
  color: var(--gray-500);
}

/* Progress Bar */
.progress-container {
  margin: 20px 0;
}

.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 8px;
}

/* Generate Section */
.generate-section {
  text-align: center;
  padding: 40px;
}

.generate-info {
  max-width: 500px;
  margin: 0 auto 24px;
}

.generate-formula {
  font-family: monospace;
  font-size: 16px;
  background: var(--gray-100);
  padding: 12px 24px;
  border-radius: 8px;
  margin: 16px 0;
}

.batch-settings {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.batch-settings label {
  font-size: 14px;
  color: var(--gray-500);
}

.batch-settings select {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
}

/* Gallery Grid */
.gallery-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  font-size: 14px;
  color: var(--gray-500);
}

.filter-group select {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.gallery-item {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.15s ease;
}

.gallery-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.gallery-video {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--gray-900);
  position: relative;
  z-index: 1;
}

.gallery-info {
  padding: 12px;
}

.gallery-id {
  font-size: 12px;
  font-family: monospace;
  color: var(--gray-500);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.gallery-status.created { background: #dbeafe; color: #1d4ed8; }
.gallery-status.processing { background: #fef3c7; color: #b45309; }
.gallery-status.completed { background: #d1fae5; color: #047857; }
.gallery-status.failed { background: #fee2e2; color: #b91c1c; }

.gallery-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.gallery-actions .btn {
  flex: 1;
  justify-content: center;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.pagination .btn {
  min-width: 40px;
  justify-content: center;
}

.pagination-info {
  font-size: 14px;
  color: var(--gray-500);
  padding: 0 16px;
}

/* Job Details */
.job-details-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.sequence-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sequence-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--gray-50);
  border-radius: 8px;
}

.sequence-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.sequence-asset {
  flex: 1;
  font-size: 14px;
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-left: 2px solid var(--gray-200);
  margin-left: 8px;
  padding-left: 20px;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 20px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.timeline-content {
  flex: 1;
}

.timeline-type {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.timeline-time {
  font-size: 12px;
  color: var(--gray-500);
}

/* Queue Monitor */
.queue-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.events-log {
  max-height: 400px;
  overflow-y: auto;
}

.event-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--gray-100);
}

.event-type {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-700);
}

.event-type.JOB_ENQUEUED { background: #dbeafe; color: #1d4ed8; }
.event-type.JOB_STARTED { background: #fef3c7; color: #b45309; }
.event-type.JOB_COMPLETED { background: #d1fae5; color: #047857; }
.event-type.JOB_FAILED { background: #fee2e2; color: #b91c1c; }

.event-info {
  flex: 1;
  font-size: 13px;
  color: var(--gray-700);
}

.event-time {
  font-size: 11px;
  color: var(--gray-500);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state-text {
  font-size: 16px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--gray-900);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Loading Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Generation Progress (Dashboard) */
.generation-progress {
  margin-top: 16px;
}

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

.progress-label {
  color: var(--gray-700);
  font-size: 14px;
}

.progress-percent {
  font-weight: 600;
  color: var(--primary);
  font-size: 18px;
}

.progress-bar-container {
  height: 12px;
  background: var(--gray-200);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 6px;
  transition: width 0.3s ease;
}

.progress-complete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--success);
  font-weight: 500;
}

.progress-hint {
  color: var(--gray-500);
  font-size: 14px;
}

.btn-accent {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border: none;
  font-weight: 500;
}

.btn-accent:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.btn-accent:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
  }
  
  .project-controls {
    flex-direction: column;
  }
  
  .project-controls input {
    width: 100%;
  }
  
  .upload-section {
    grid-template-columns: 1fr;
  }
  
  .job-details-container {
    grid-template-columns: 1fr;
  }
  
  .queue-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==================== FINALS GALLERY STYLES ==================== */

/* Finals Gallery Stats */
.finals-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.finals-stat-card {
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 120px;
}

.finals-stat-card .stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

.finals-stat-card .stat-label {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
}

.finals-stat-card.completed .stat-value { color: #22c55e; }
.finals-stat-card.failed .stat-value { color: #ef4444; }
.finals-stat-card.processing .stat-value { color: #f59e0b; }
.finals-stat-card.pending .stat-value { color: #888; }

/* Finals Gallery Cards */
.finals-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 16px;
}

.finals-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.finals-card:hover {
  border-color: rgba(99,102,241,0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.finals-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0,0,0,0.2);
}

.finals-card-body {
  padding: 16px;
}

.finals-card-preview {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.finals-card-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.finals-card-preview .play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  font-size: 48px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.finals-card:hover .play-overlay {
  opacity: 1;
}

.finals-card-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12px;
}

.finals-card-info .info-label {
  color: #888;
}

.finals-card-info .info-value {
  color: #fff;
  font-family: monospace;
  word-break: break-all;
}

/* Finals Badges */
.finals-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge-audio {
  background: linear-gradient(135deg, #8b5cf6, #a855f7);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge-preset {
  background: rgba(99,102,241,0.2);
  color: #818cf8;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

/* Finals Filters */
.finals-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  margin-bottom: 16px;
}

.finals-filters select,
.finals-filters input {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
  min-width: 140px;
}

.finals-filters select:focus,
.finals-filters input:focus {
  border-color: #6366f1;
  outline: none;
}

/* Finals Pagination */
.finals-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 16px;
  margin-top: 16px;
}

.finals-pagination button {
  background: rgba(99,102,241,0.2);
  border: none;
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.finals-pagination button:hover:not(:disabled) {
  background: rgba(99,102,241,0.4);
}

.finals-pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.finals-pagination .page-info {
  color: #888;
  font-size: 13px;
}

/* Finals Preview Modal */
.finals-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.finals-modal-content {
  background: #1a1a2e;
  border-radius: 16px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
}

.finals-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.finals-modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
}

.finals-modal-close:hover {
  color: #fff;
}

.finals-modal-video {
  aspect-ratio: 16/9;
  background: #000;
}

.finals-modal-video video {
  width: 100%;
  height: 100%;
}

.finals-modal-details {
  padding: 20px;
}

.finals-modal-details .detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.finals-modal-details .detail-item {
  background: rgba(255,255,255,0.03);
  padding: 12px;
  border-radius: 8px;
}

.finals-modal-details .detail-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.finals-modal-details .detail-value {
  font-size: 14px;
  color: #fff;
  word-break: break-all;
}

/* Export Finals Button */
.btn-export-finals {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-export-finals:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

/* Finals Export Dropdown */
.finals-export-dropdown {
  position: relative;
  display: inline-block;
}

.finals-export-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 100;
  display: none;
}

.finals-export-menu.show {
  display: block;
}

.finals-export-menu a {
  display: block;
  padding: 10px 16px;
  color: #fff;
  text-decoration: none;
  transition: background 0.2s;
}

.finals-export-menu a:hover {
  background: rgba(99,102,241,0.2);
}

/* Empty/Loading states */
.finals-gallery-grid .loading-state,
.finals-gallery-grid .empty-state,
.finals-gallery-grid .error-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state-text {
  color: #888;
  font-size: 14px;
}

.error-state {
  color: #ef4444;
}

/* ========== MASTERS SCENARIO BUILDER STYLES ========== */

/* Card styling */
.scenario-builder-card {
    border: 2px solid #6366f1;
    background: linear-gradient(135deg, #f0f0ff 0%, #ffffff 100%);
}

.scenario-builder-card .card-header {
    border-bottom: 1px solid #e0e0ff;
}

.scenario-builder-card .card-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-subtitle {
    font-size: 12px;
    color: #666;
    display: block;
    margin-top: 4px;
}

.badge-new {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Scenario config */
.scenario-config {
    padding: 16px;
}

.scenario-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.scenario-field {
    flex: 1;
    min-width: 200px;
}

.scenario-field > label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
}

.scenario-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

/* K-Policy selector */
.k-policy-selector {
    display: flex;
    gap: 16px;
    padding: 8px 0;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: normal;
}

.radio-label input[type="radio"] {
    margin: 0;
}

/* K-Policy values */
.k-policy-values {
    background: #f8f8ff;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e0e0ff;
}

.k-policy-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.k-policy-input label {
    font-weight: 600;
    min-width: 50px;
}

.input-hint {
    font-size: 12px;
    color: #888;
}

/* Checkbox label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Target field */
.target-field {
    max-width: 250px;
}

/* Scenario actions */
.scenario-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.scenario-status {
    margin-left: auto;
    font-size: 14px;
}

.scenario-status.loading {
    color: #f59e0b;
}

.scenario-status.success {
    color: #10b981;
}

.scenario-status.error {
    color: #ef4444;
}

/* Preflight panel */
.preflight-panel {
    margin-top: 16px;
    padding: 16px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
}

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

.preflight-header h4 {
    margin: 0;
    color: #0369a1;
}

.preflight-strategy {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.preflight-strategy.badge-success {
    background: #d1fae5;
    color: #047857;
}

.preflight-strategy.badge-warning {
    background: #fef3c7;
    color: #b45309;
}

.preflight-strategy.badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

/* Preflight grid */
.preflight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.preflight-stat {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e0e7ff;
}

.preflight-stat.highlight {
    background: #ecfdf5;
    border-color: #6ee7b7;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
}

/* Preflight plan */
.preflight-plan {
    background: white;
    padding: 16px;
    border-radius: 6px;
    border: 1px solid #e0e7ff;
}

.plan-summary p {
    margin: 4px 0;
}

.plan-explanation {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #ccc;
    font-size: 14px;
}

/* Preflight error */
.preflight-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 16px;
}

.error-message {
    color: #991b1b;
}

/* JSON preview */
.scenario-json-preview {
    margin-top: 16px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 6px;
}

.scenario-json-preview summary {
    cursor: pointer;
    font-size: 13px;
    color: #64748b;
}

.scenario-json-preview pre {
    margin-top: 8px;
    padding: 12px;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    overflow-x: auto;
}

/* Toast notification */
.scenario-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 24px;
    background: #1e293b;
    color: white;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.scenario-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.scenario-toast.success {
    background: #047857;
}

.scenario-toast.error {
    background: #b91c1c;
}

/* Responsive */
@media (max-width: 768px) {
    .scenario-row {
        flex-direction: column;
    }
    
    .scenario-field {
        min-width: 100%;
    }
    
    .k-policy-selector {
        flex-direction: column;
        gap: 8px;
    }
    
    .scenario-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .scenario-status {
        margin-left: 0;
        text-align: center;
    }
}

/* ========== END MASTERS SCENARIO BUILDER STYLES ========== */

/* ========== SCENARIO HELP STYLES ========== */

/* Help container */
.scenario-help {
    margin: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.scenario-help[open] {
    background: white;
}

.help-toggle {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #475569;
    user-select: none;
    list-style: none;
}

.help-toggle::-webkit-details-marker {
    display: none;
}

.help-icon {
    font-size: 16px;
}

.help-arrow {
    margin-left: auto;
    transition: transform 0.2s;
    font-size: 10px;
}

.scenario-help[open] .help-arrow {
    transform: rotate(180deg);
}

.help-toggle:hover {
    background: #f1f5f9;
    border-radius: 8px;
}

/* Help content */
.help-content {
    padding: 0 16px 16px;
    max-height: 500px;
    overflow-y: auto;
}

.help-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.help-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.help-section h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    color: #1e293b;
}

.help-steps {
    margin: 0;
    padding-left: 20px;
}

.help-steps li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.help-hint {
    font-size: 12px;
    color: #64748b;
    margin: 4px 0 12px;
}

/* Presets grid */
.presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

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

.preset-count {
    font-size: 18px;
    font-weight: 700;
}

.preset-desc {
    font-size: 10px;
    opacity: 0.9;
    margin-top: 2px;
}

/* Parameter blocks */
.param-block {
    margin-bottom: 12px;
}

.param-block strong {
    display: block;
    color: #334155;
    margin-bottom: 4px;
}

.param-block ul {
    margin: 0;
    padding-left: 20px;
}

.param-block li {
    margin-bottom: 4px;
    font-size: 13px;
    color: #475569;
}

.param-block code {
    background: #e2e8f0;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #6366f1;
}

/* Formula table */
.formula-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 12px 0;
}

.formula-table th,
.formula-table td {
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
    text-align: left;
}

.formula-table th {
    background: #f1f5f9;
    font-weight: 600;
    color: #334155;
}

.formula-table td {
    color: #475569;
}

.help-example {
    background: #fef3c7;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 8px;
}

/* Status list */
.status-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

/* Mini badges */
.badge-mini {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-mini.success {
    background: #d1fae5;
    color: #047857;
}

.badge-mini.warning {
    background: #fef3c7;
    color: #b45309;
}

.badge-mini.danger {
    background: #fee2e2;
    color: #b91c1c;
}

/* Responsive */
@media (max-width: 600px) {
    .presets-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .help-content {
        max-height: 400px;
    }
    
    .formula-table {
        font-size: 11px;
    }
    
    .formula-table th,
    .formula-table td {
        padding: 6px 8px;
    }
}

/* ========== END SCENARIO HELP STYLES ========== */

/* ========== SMART RECOMMENDATIONS & TYPICAL TASKS ========== */

/* Recommendation box */
.recommendation-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.recommendation-box.scenario-rec {
    background: linear-gradient(135deg, #ede9fe 0%, #f3e8ff 100%);
    border-color: #c4b5fd;
}

.recommendation-box.ntarget-rec {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #6ee7b7;
}

.rec-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.rec-text {
    font-size: 13px;
    line-height: 1.5;
    color: #334155;
}

.rec-text strong {
    color: #6366f1;
}

/* Typical tasks */
.typical-tasks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.task-card {
    padding: 14px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.task-card:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.task-goal {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
}

.task-recipe {
    font-size: 13px;
    color: #6366f1;
    margin-bottom: 4px;
}

.task-hint {
    font-size: 11px;
    color: #64748b;
}

/* Copy JSON button */
.json-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.copy-json-btn {
    padding: 4px 10px;
    font-size: 11px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-json-btn:hover {
    background: #4f46e5;
}

.copy-json-btn.copied {
    background: #10b981;
}

/* Responsive */
@media (max-width: 600px) {
    .typical-tasks {
        grid-template-columns: 1fr;
    }
    
    .recommendation-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* ========== END SMART RECOMMENDATIONS ========== */

/* ========== EXCLUSIVE MODE STYLES ========== */

/* Three-button toggle */
.generate-mode-toggle {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mode-btn {
    flex: 1;
    min-width: 140px;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.mode-btn:hover {
    border-color: #6366f1;
    background: #f8f7ff;
}

.mode-btn.active {
    border-color: #6366f1;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

/* Mode badge on generate buttons */
.mode-badge {
    display: inline-block;
    padding: 2px 8px;
    margin-left: 8px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 10px;
    background: rgba(255,255,255,0.2);
    vertical-align: middle;
}

/* Panel transitions */
#scenario-builder-panel,
#ntarget-panel,
#combinatorics-panel {
    transition: opacity 0.2s, transform 0.2s;
}

#scenario-builder-panel[style*="none"],
#ntarget-panel[style*="none"],
#combinatorics-panel[style*="none"] {
    opacity: 0;
    transform: translateY(-10px);
}

/* Warning banner when panels hidden */
.mode-hint {
    padding: 12px 16px;
    margin: 12px 0;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    font-size: 13px;
    color: #92400e;
    display: none;
}

.mode-hint.visible {
    display: block;
}

/* ========== END EXCLUSIVE MODE STYLES ========== */

/* ========== JOB UX STYLES ========== */

/* Active Job Indicator in Header */
.active-job-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fcd34d;
    border-radius: 20px;
    font-size: 12px;
    margin-right: 12px;
    animation: pulse-indicator 2s infinite;
}

@keyframes pulse-indicator {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.job-indicator-icon {
    animation: spin 2s linear infinite;
}

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

.job-indicator-text {
    color: #92400e;
    font-weight: 500;
}

.job-indicator-btn {
    padding: 2px 8px;
    background: #f59e0b;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 600;
}

.job-indicator-btn:hover {
    background: #d97706;
}

/* Gallery Info Banner */
.gallery-info-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border: 1px solid #7dd3fc;
    border-radius: 8px;
    gap: 16px;
    flex-wrap: wrap;
}

.banner-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
}

.banner-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.banner-text {
    font-size: 13px;
    line-height: 1.5;
    color: #0c4a6e;
}

.banner-text a {
    color: #0369a1;
    font-weight: 600;
    text-decoration: underline;
}

.banner-text a:hover {
    color: #0284c7;
}

.banner-actions {
    flex-shrink: 0;
}

.banner-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.banner-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Progress Hint under Generate */
.progress-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
    font-size: 12px;
    color: #64748b;
    flex-wrap: wrap;
}

.auto-open-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.auto-open-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
}

.hint-text {
    font-style: italic;
}

/* Card status overlay for queued/processing */
.video-card.status-queued::after,
.video-card.status-processing::after {
    content: 'Not live view. Check Job Details.';
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    padding: 4px 8px;
    background: rgba(0,0,0,0.7);
    color: #fcd34d;
    font-size: 10px;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .gallery-info-banner {
        flex-direction: column;
        align-items: stretch;
    }
    
    .banner-actions {
        margin-top: 8px;
    }
    
    .progress-hint {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ========== END JOB UX STYLES ========== */

/* ==================== UX FIX: Mode Badges & Warnings ==================== */
.mode-badge {
  display: inline-block;
  padding: 3px 10px;
  margin-left: 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

.badge-scenario {
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
  color: white;
}

.badge-ntarget {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.badge-combinatorics {
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  color: white;
}

/* N-Target Limit Warning */
.ntarget-limit-warning {
  margin-top: 16px;
  padding: 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid #ef4444;
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: shakeWarning 0.5s ease-in-out;
}

.warning-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.warning-content {
  flex: 1;
}

.warning-content strong {
  display: block;
  color: #991b1b;
  font-size: 16px;
  margin-bottom: 8px;
}

.warning-content p {
  color: #7f1d1d;
  margin: 4px 0;
  font-size: 14px;
}

.warning-content code {
  background: rgba(127, 29, 29, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 13px;
}

.warning-content .btn {
  margin-top: 12px;
}

@keyframes shakeWarning {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  max-width: 450px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(102, 126, 234, 0.5);
  overflow: hidden;
  animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  display: flex;
  align-items: stretch;
  gap: 0;
}

.toast-icon {
  font-size: 32px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bounce 1s infinite;
}

.toast-content {
  flex: 1;
  padding: 16px;
}

.toast-content h4 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 700;
}

.toast-content p {
  margin: 4px 0;
  font-size: 14px;
  opacity: 0.95;
}

.toast-job-id {
  font-family: monospace;
  font-size: 12px;
  opacity: 0.7;
  margin-top: 8px !important;
}

.toast-progress {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.2);
  margin-top: 12px;
  border-radius: 2px;
  overflow: hidden;
}

.toast-progress-fill {
  height: 100%;
  background: white;
  width: 0%;
  transition: width 2s linear;
}

.toast-action {
  padding: 20px 16px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.toast-action:hover {
  background: rgba(255, 255, 255, 0.25);
}

.toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.toast-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.4);
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Inactive Mode Overlay */
.generator-panel-inactive {
  position: relative;
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(70%);
}

.generator-panel-inactive::before {
  content: "⚠️ Неактивен";
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 193, 7, 0.95);
  color: #000;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

/* =============================================
   QUEUE HEALTH PANEL
   ============================================= */

.queue-health {
  padding: 20px;
  background: #fff;
  border-radius: 8px;
}

.health-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.health-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 4px solid #ddd;
}

.health-item.status-ok {
  border-left-color: #10b981;
  background: #f0fdf4;
}

.health-item.status-warning {
  border-left-color: #f59e0b;
  background: #fffbeb;
}

.health-item.status-error {
  border-left-color: #ef4444;
  background: #fef2f2;
}

.health-label {
  font-weight: 600;
  font-size: 14px;
  color: #374151;
}

.health-status {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.health-status.ok {
  color: #10b981;
  font-weight: 600;
}

.health-status.warning {
  color: #f59e0b;
  font-weight: 600;
}

.health-status.error {
  color: #ef4444;
  font-weight: 600;
}

#refresh-health-btn {
  min-width: 140px;
  transition: all 0.2s;
}

#refresh-health-btn:hover {
  transform: scale(1.05);
}

#refresh-health-btn.refreshing {
  animation: spin 1s linear infinite;
}

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


/* =============================================
   DUPLICATE JOB MODAL (TASK B)
   ============================================= */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  animation: slideUp 0.3s ease;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: #f59e0b;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f3f4f6;
  color: #111827;
}

.modal-body {
  padding: 24px;
}

.job-details {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}

.job-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e5e7eb;
}

.job-detail-row:last-child {
  border-bottom: none;
}

.job-detail-row .label {
  font-weight: 600;
  color: #374151;
}

.job-detail-row .value {
  color: #6b7280;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.job-detail-row .value code {
  background: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
}

.job-detail-row .status-pending {
  color: #f59e0b;
  font-weight: 600;
}

.job-detail-row .status-running {
  color: #3b82f6;
  font-weight: 600;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-footer .btn {
  padding: 10px 20px;
  border-radius: 6px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-footer .btn-secondary {
  background: #e5e7eb;
  color: #374151;
}

.modal-footer .btn-secondary:hover {
  background: #d1d5db;
}

.modal-footer .btn-info {
  background: #3b82f6;
  color: white;
}

.modal-footer .btn-info:hover {
  background: #2563eb;
}

.modal-footer .btn-primary {
  background: #6366f1;
  color: white;
}

.modal-footer .btn-primary:hover {
  background: #4f46e5;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* =============================================
   WEBSOCKET INDICATOR
   ============================================= */

.ws-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.3s;
}

.ws-connected {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}

.ws-disconnected {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

.ws-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

/* =============================================
   MODAL OVERLAY (for errors and duplicate jobs)
   ============================================= */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f9fafb;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: #111827;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #e5e7eb;
  color: #111827;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background: #f9fafb;
}

.job-details {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}

.job-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e5e7eb;
}

.job-detail-row:last-child {
  border-bottom: none;
}

.job-detail-row .label {
  font-weight: 600;
  color: #374151;
}

.job-detail-row .value {
  color: #6b7280;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.job-detail-row .value code {
  background: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
}

.status-pending { color: #f59e0b; font-weight: 600; }
.status-running { color: #3b82f6; font-weight: 600; }
.status-completed { color: #10b981; font-weight: 600; }
.status-failed { color: #ef4444; font-weight: 600; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}


/* ===========================================
   ERROR BADGES (FAILED REASON UX)
   =========================================== */

.error-badge {
  background: #fee;
  border: 1px solid #fcc;
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.error-badge .error-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.error-badge .error-text {
  font-size: 13px;
  color: #c33;
  line-height: 1.4;
  word-break: break-word;
}

.error-details {
  background: #fee;
  border: 2px solid #f44;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.error-details h4 {
  margin: 0 0 8px 0;
  color: #c33;
}

.error-details pre {
  background: #fff;
  border: 1px solid #fcc;
  border-radius: 4px;
  padding: 8px;
  margin: 0;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #333;
}


/* ===========================================
   UNIQUIFY TAB STYLES
   =========================================== */

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.radio-label:hover {
  border-color: var(--primary);
  background: var(--gray-50);
}

.radio-label input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.radio-label input[type="radio"]:checked + span {
  color: var(--primary);
  font-weight: 600;
}

.preflight-result {
  padding: 20px;
  border-radius: 12px;
  border: 2px solid;
}

.preflight-result.success {
  background: #f0fdf4;
  border-color: #10b981;
}

.preflight-result.warning {
  background: #fffbeb;
  border-color: #f59e0b;
}

.preflight-result.error {
  background: #fef2f2;
  border-color: #ef4444;
}

.preflight-result h4 {
  margin: 0 0 12px 0;
  font-size: 18px;
}

.preflight-result p {
  margin: 0 0 16px 0;
  font-size: 14px;
}

.preflight-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.preflight-stats .stat {
  padding: 12px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
}

.preflight-stats .stat .label {
  display: block;
  font-size: 12px;
  color: var(--gray-600);
  margin-bottom: 4px;
}

.preflight-stats .stat .value {
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
}

/* BGM Controls */
#bgm-controls input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  outline: none;
}

#bgm-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
}

#bgm-controls input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

#bgm-upload-status {
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: 6px;
  font-size: 13px;
}


/* Selection Controls */
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.gallery-item {
  position: relative;
}

.master-select-checkbox {
  background: white;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  position: relative;
  z-index: 100 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  accent-color: #3b82f6 !important;
  transform: scale(1.5);
  width: 20px !important;
  height: 20px !important;
}


.btn-danger {
  background: #ef4444;
  color: white;
  border: none;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-danger:disabled {
  background: #fca5a5;
  cursor: not-allowed;
}

