/* TuTa Seedance Studio Online - Hallmark UI Standards */
:root {
  --bg-main: #090d16;
  --bg-surface: #111827;
  --bg-card: #1a2234;
  --bg-elevated: #242f46;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(56, 189, 248, 0.35);
  --border-emerald: rgba(16, 185, 129, 0.35);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-cyan: #38bdf8;
  --accent-blue: #2563eb;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;

  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 15px rgba(56, 189, 248, 0.2);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

/* App Shell */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-hex {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-glow);
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  font-style: normal;
}

.brand-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid var(--border-accent);
  margin-left: 8px;
  vertical-align: middle;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

/* 4-Chain System Status Capsules */
.system-capsules {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.capsule {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.capsule.live {
  border-color: var(--border-emerald);
  color: var(--accent-emerald);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse 2s infinite;
}

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

/* Tab Navigation Dock */
.nav-dock {
  display: flex;
  gap: 8px;
  padding: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-dock::-webkit-scrollbar {
  display: none;
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.nav-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab-btn:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.nav-tab-btn.active {
  background: var(--bg-card);
  color: var(--accent-cyan);
  border-color: var(--border-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Tab Panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Card */
.studio-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

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

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

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  font-style: normal;
}

.badge-count {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  font-size: 11px;
  font-weight: 700;
}

/* Quick Style Chips */
.style-chips-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.chip-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-cyan);
  white-space: nowrap;
}

.style-chip {
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.style-chip:hover {
  border-color: var(--border-accent);
  color: #fff;
}

.style-chip.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.studio-textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #fff;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 90px;
  transition: var(--transition);
}

.studio-textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: var(--shadow-glow);
}

.params-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.studio-input, .studio-select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  transition: var(--transition);
}

.studio-input:focus, .studio-select:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

/* Action Buttons (8 States) */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
  transition: var(--transition);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #0284c7);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.45);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  border-color: var(--border-accent);
  color: #fff;
}

.btn-secondary:active {
  transform: scale(0.98);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fca5a5;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
  color: #fff;
}

/* Glowing Dropzone for Images */
.dropzone-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 20px;
  border: 2px dashed var(--border-accent);
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.03);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.dropzone-box:hover, .dropzone-box.drag-over {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
  box-shadow: var(--shadow-glow);
}

.dropzone-icon {
  font-size: 32px;
}

.dropzone-text strong {
  color: #fff;
  display: block;
  font-size: 14px;
}

.dropzone-text small {
  color: var(--text-secondary);
  font-size: 11px;
}

/* Image Gallery Grid */
.image-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 14px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.image-card-item {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.image-card-item:hover {
  border-color: var(--border-accent);
}

.image-card-thumb {
  width: 100%;
  height: 100px;
  object-fit: cover;
  background: #000;
}

.image-card-info {
  padding: 6px 8px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.image-card-name {
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-card-meta {
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.image-card-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.image-card-remove:hover {
  background: var(--accent-rose);
}

.pair-banner {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid var(--border-accent);
  color: var(--accent-cyan);
  font-size: 12px;
  font-weight: 600;
  margin: 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Video Results List */
.video-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.video-preview-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: #000;
}

.video-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.video-prompt-text {
  font-size: 12px;
  color: #fff;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-tags-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-pill {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-elevated);
  font-size: 10px;
  color: var(--text-secondary);
}

.video-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* Console Log Box */
.console-box {
  background: #06090e;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: 12px;
  color: #38bdf8;
  height: 320px;
  overflow-y: auto;
  line-height: 1.6;
}

.log-entry {
  display: flex;
  gap: 8px;
}

.log-time {
  color: var(--text-muted);
}

.log-msg.info { color: #38bdf8; }
.log-msg.success { color: #34d399; }
.log-msg.warn { color: #fbbf24; }
.log-msg.error { color: #f87171; }

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-container {
    padding: 10px;
    gap: 12px;
  }

  .app-header {
    padding: 10px 14px;
  }

  .params-grid {
    grid-template-columns: 1fr;
  }

  .video-results-grid {
    grid-template-columns: 1fr;
  }
}
