/* ===========================================================
   Video Repurpose Studio - Dark Theme Styles
   =========================================================== */

:root {
  --bg-primary: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-hover: #1c2b4a;
  --bg-input: #0f0f23;
  --accent: #e94560;
  --accent-hover: #ff6b81;
  --accent-glow: rgba(233, 69, 96, 0.3);
  --text-primary: #eaeaea;
  --text-secondary: #a0a0b8;
  --text-muted: #6c6c8a;
  --border: #2a2a4a;
  --success: #2ed573;
  --warning: #ffa502;
  --danger: #ff4757;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --transition: 0.25s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- Header ---- */
.header {
  text-align: center;
  padding: 28px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.header h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---- Layout ---- */
.studio {
  display: flex;
  gap: 0;
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - 120px);
}

.panel {
  flex: 1;
  min-width: 0;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-left: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.panel-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---- Arrows between panels ---- */
.arrow-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  flex-shrink: 0;
  color: var(--accent);
  font-size: 24px;
  opacity: 0.6;
}

/* ---- Inputs ---- */
input[type="text"],
textarea,
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}
input[type="text"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}
.btn-success {
  background: var(--success);
  color: #000;
}
.btn-success:hover {
  filter: brightness(1.2);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}
.btn-lg {
  padding: 14px 36px;
  font-size: 16px;
  border-radius: var(--radius);
}
.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ---- Style selector ---- */
.style-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.style-tag {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-input);
  color: var(--text-secondary);
}
.style-tag:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}
.style-tag.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---- Text display area ---- */
.text-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Avatar cards ---- */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.avatar-card {
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.avatar-card:hover {
  border-color: var(--accent-hover);
  background: var(--bg-card-hover);
}
.avatar-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(233, 69, 96, 0.08);
}
.avatar-thumb {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 10px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
}
.avatar-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}
.avatar-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- Voice list ---- */
.voice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.voice-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.voice-item:hover {
  border-color: var(--accent-hover);
  background: var(--bg-card-hover);
}
.voice-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
  background: rgba(233, 69, 96, 0.06);
}
.voice-info {
  display: flex;
  flex-direction: column;
}
.voice-name {
  font-weight: 600;
  font-size: 14px;
}
.voice-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.voice-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: var(--transition);
}
.voice-play:hover {
  background: var(--accent-hover);
}

/* ---- Progress bar ---- */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  display: none;
}
.progress-bar.active {
  display: block;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 4px;
  width: 0%;
  transition: width 0.4s ease;
  animation: progressPulse 1.5s ease-in-out infinite;
}
@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ---- Video player ---- */
.video-preview {
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}
.video-preview video {
  width: 100%;
  display: block;
  border-radius: var(--radius);
}

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: #fff;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  max-width: 360px;
}
.toast.success { background: var(--success); color: #000; }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); color: #000; }
.toast.info { background: #3742fa; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

/* ---- Loading spinner ---- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Responsive ---- */
@media (max-width: 1200px) {
  .studio {
    flex-direction: column;
  }
  .panel + .panel {
    margin-left: 0;
    margin-top: 16px;
  }
  .arrow-sep {
    width: 100%;
    height: 32px;
    transform: rotate(90deg);
  }
}

@media (max-width: 768px) {
  .studio {
    padding: 12px;
  }
  .panel {
    padding: 16px;
  }
  .avatar-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .header h1 {
    font-size: 22px;
  }
}
