/* ====================================================================
   Shared theme for the merged BytePlus demo app.
   Adapted from seedance/portrait_asset_demo/web/static/styles.css —
   keeps the same dark palette (#0d0d14 / #15151f / purple #6e60ff) and
   adds a left nav rail listing each demo case.
   ==================================================================== */

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
body {
  background: #0d0d14;
  color: #e2e2eb;
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  overflow: hidden;
}
a { color: #7e76ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- left nav rail ---------- */
.nav-rail {
  background: #11111a;
  border-right: 1px solid #23232f;
  padding: 18px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 6px 12px;
  border-bottom: 1px solid #1f1f2b;
}
.nav-brand-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg,#7e76ff,#52d0e8);
  color: #fff; font-weight: 700; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.nav-brand-name {
  font-weight: 600; font-size: 13px; color: #fff;
}
.nav-brand-sub {
  font-size: 10px; color: #7f7f8e; margin-top: 1px;
}

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-title {
  font-size: 10px; color: #6a6a7a;
  text-transform: uppercase; letter-spacing: 1.2px;
  padding: 4px 8px;
}
.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  color: #b6b6c4;
  text-decoration: none;
  cursor: pointer;
}
.nav-link:hover { background: #1a1a26; color: #e2e2eb; text-decoration: none; }
.nav-link.active {
  background: linear-gradient(135deg, rgba(126,118,255,.18), rgba(82,208,232,.10));
  color: #fff;
  border: 1px solid #2a2a44;
}
.nav-icon {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
}

/* ---------- main column ---------- */
.app-main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.topbar {
  height: 52px;
  border-bottom: 1px solid #23232f;
  display: flex; align-items: center; padding: 0 20px;
  gap: 16px; background: #0d0d14;
}
.topbar h1 {
  font-size: 14px; font-weight: 600; margin: 0;
  color: #e2e2eb;
}
.topbar .crumb {
  font-size: 11px; color: #6a6a7a; letter-spacing: 1px;
  text-transform: uppercase;
}
.status-pill {
  margin-left: auto;
  font-size: 11px; color: #9b9bab;
  display: flex; align-items: center; gap: 6px;
}
.status-pill .dot {
  width: 8px; height: 8px;
  background: #2bd478; border-radius: 50%;
}

/* ---------- working area split: settings sidebar (right of nav) + content ---------- */
.work-area {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 320px 1fr;
  overflow: hidden;
}
.work-sidebar {
  background: #15151f;
  border-right: 1px solid #23232f;
  padding: 18px 16px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.work-content {
  overflow: auto;
  padding: 24px;
  display: flex; flex-direction: column; gap: 16px;
}

/* When a page wants a single-column layout (no settings sidebar), use .work-area.single */
.work-area.single { grid-template-columns: 1fr; }

/* ---------- common form controls ---------- */
.section { display: flex; flex-direction: column; gap: 8px; }
.section-title {
  font-size: 11px; color: #8f8fa0;
  letter-spacing: 1px; margin-bottom: 4px;
}
.setting-label { font-size: 12px; color: #c0c0d0; margin: 6px 0 4px; }
.setting-label.inline { margin: 0; }
.opt-tag { color: #6a6a7a; font-weight: 400; font-size: 11px; }
.hint { font-size: 11px; color: #6a6a7a; margin-top: 4px; }
.hint.small { font-size: 10px; }
.hint code {
  background: #1a1a26; padding: 1px 5px; border-radius: 4px;
  font-size: 10.5px;
}

textarea, .num-input, input[type="text"], input[type="number"], input[type="search"], select {
  width: 100%;
  background: #1a1a26;
  border: 1px solid #28283a;
  border-radius: 8px;
  color: #e2e2eb;
  padding: 9px 12px;
  font-size: 12px;
  resize: vertical;
  font-family: inherit;
}
textarea::placeholder, input::placeholder { color: #5a5a6a; }
textarea:focus, input:focus, select:focus {
  outline: none; border-color: #6e60ff;
}

.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  padding: 5px 10px;
  background: #1a1a26;
  border: 1px solid #28283a;
  border-radius: 6px;
  color: #b6b6c4;
  font-size: 11px;
  cursor: pointer;
}
.pill.active { background: #6e60ff; color: #fff; border-color: #6e60ff; }

.chip {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid #2c2c3c;
  border-radius: 999px;
  color: #b6b6c4;
  font-size: 11px;
  cursor: pointer;
}
.chip:hover { border-color: #6e60ff; color: #d6d6e6; }

input[type="range"] { width: 100%; accent-color: #6e60ff; margin: 4px 0; }
.dur-val { color: #6e60ff; font-weight: 600; float: right; }

.row-flex { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 10px; }

.switch { position: relative; display: inline-block; width: 38px; height: 20px; flex-shrink: 0; }
.switch input { display: none; }
.slider-sw {
  position: absolute; inset: 0; cursor: pointer;
  background: #2a2a3a; border-radius: 999px; transition: background .15s;
}
.slider-sw::before {
  content: ""; position: absolute; height: 14px; width: 14px;
  left: 3px; top: 3px; background: #ddd; border-radius: 50%;
  transition: transform .15s;
}
.switch input:checked + .slider-sw { background: #6e60ff; }
.switch input:checked + .slider-sw::before { transform: translateX(18px); background: #fff; }

.btn-primary, .btn-generate {
  padding: 11px 16px;
  background: linear-gradient(135deg,#7e76ff,#5247ff);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.btn-primary:disabled, .btn-generate:disabled { opacity: .55; cursor: not-allowed; }
.btn-generate { margin-top: auto; padding: 12px; font-size: 14px; }

.btn-secondary {
  padding: 7px 12px;
  background: #1a1a26;
  border: 1px solid #28283a;
  border-radius: 7px;
  color: #d4d4e0;
  font-size: 12px;
  cursor: pointer;
}
.btn-secondary:hover { border-color: #6e60ff; }

/* ---------- result panels ---------- */
.result-card {
  background: #11111a;
  border: 1px solid #1f1f2b;
  border-radius: 14px;
  padding: 18px;
}
.empty-state {
  text-align: center; color: #8f8fa0;
  padding: 40px 24px;
}
.empty-state .big-icon {
  width: 64px; height: 64px;
  background: #1f1f2b; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #6e60ff;
  margin: 0 auto 18px;
}
.empty-state h2 { color: #e2e2eb; font-size: 22px; font-weight: 600; margin: 0 0 8px; }
.empty-state p { font-size: 13px; line-height: 1.6; max-width: 480px; margin: 0 auto; }

.task-log {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; color: #8f8fa0;
  background: #0a0a12; border: 1px solid #1f1f2b; border-radius: 8px;
  padding: 10px; max-height: 180px; overflow: auto;
  white-space: pre-wrap;
}
.task-log:empty { display: none; }
.error {
  color: #ff7676; font-size: 12px; padding: 8px 0;
}

audio { width: 100%; }
video { width: 100%; max-height: 540px; border-radius: 10px; background: #000; }
.img-result {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.img-result img {
  width: 100%; border-radius: 10px; border: 1px solid #1f1f2b;
  background: #0a0a12;
}

details {
  background: #0a0a12; border: 1px solid #1f1f2b; border-radius: 8px;
  padding: 10px 12px; font-size: 12px;
}
details summary { cursor: pointer; color: #8f8fa0; }
pre {
  background: transparent; color: #c0c0d0; font-size: 11px;
  overflow-x: auto; margin: 8px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- home / hub landing ---------- */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.hub-card {
  background: #11111a;
  border: 1px solid #1f1f2b;
  border-radius: 14px;
  padding: 18px;
  text-decoration: none;
  color: inherit;
  transition: transform .12s, border-color .12s;
  display: flex; flex-direction: column; gap: 8px;
}
.hub-card:hover { transform: translateY(-2px); border-color: #6e60ff; text-decoration: none; }
.hub-card .tag {
  font-size: 10px; color: #6a6a7a;
  letter-spacing: 1.2px; text-transform: uppercase;
}
.hub-card h3 { margin: 0; font-size: 16px; color: #fff; }
.hub-card p { margin: 0; font-size: 12.5px; color: #9b9bab; line-height: 1.5; }

/* ---------- drag-and-drop dropzone ---------- */
.dropzone {
  position: relative;
  border: 1.5px dashed rgba(126,118,255,0.55);
  border-radius: 12px;
  background: #0e0e18;
  padding: 24px 16px 22px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.dropzone:hover {
  border-color: #7e76ff;
  background: #12122a;
}
.dropzone.drag {
  border-color: #7e76ff;
  background: #161635;
}
.dropzone.busy { cursor: wait; }

/* Emoji icon, big and centered (read from data-icon, with a sensible default). */
.dropzone::before {
  content: attr(data-icon);
  font-size: 28px;
  line-height: 1;
  display: block;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.4));
}
.dropzone:not([data-icon])::before { content: "📁"; }
.dropzone.busy::before { animation: dz-pulse 1.2s ease-in-out infinite; }
@keyframes dz-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: .7; }
}

.dropzone .dz-title {
  font-size: 13px;
  color: #c0c0d0;
  font-weight: 400;
}
.dropzone .dz-title strong {
  color: #e2e2eb;
  font-weight: 600;
}
.dropzone .dz-sub {
  font-size: 11px;
  color: #6a6a7a;
}
.dropzone .dz-status { font-size: 11px; min-height: 14px; color: #8f8fa0; }
.dropzone .dz-status.ok { color: #2bd478; }
.dropzone .dz-status.err { color: #ff7676; }
.dropzone .dz-progress {
  width: 70%;
  height: 3px;
  background: #0a0a12;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}
.dropzone .dz-progress div {
  height: 100%;
  background: linear-gradient(135deg,#7e76ff,#5247ff);
  width: 0%;
  transition: width .15s ease;
}

/* ---------- generated-content history panel ---------- */
.history-panel {
  background: #11111a;
  border: 1px solid #1f1f2b;
  border-radius: 10px;
  padding: 12px 16px;
}
.history-panel > summary {
  cursor: pointer;
  color: #c0c0d0;
  font-size: 13px;
  font-weight: 500;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-panel > summary::-webkit-details-marker { display: none; }
.history-panel > summary::before {
  content: "▸";
  color: #6a6a7a;
  transition: transform .15s;
}
.history-panel[open] > summary::before { transform: rotate(90deg); }
.history-panel .hist-count {
  font-size: 11px;
  background: #1a1a26;
  border: 1px solid #2a2a3a;
  color: #b6b6c4;
  padding: 1px 8px;
  border-radius: 999px;
  margin-left: 4px;
}
.history-panel .hist-actions {
  display: flex;
  justify-content: flex-end;
  margin: 10px 0 0;
}
.history-panel .hist-actions button { font-size: 11px; padding: 4px 10px; }
.history-panel .hist-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}
.history-panel .hist-empty {
  color: #6a6a7a;
  font-size: 12px;
  padding: 12px;
  text-align: center;
}
.hist-item {
  background: #0a0a12;
  border: 1px solid #1f1f2b;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
}
.hist-item .hist-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 10.5px;
  color: #6a6a7a;
  margin-bottom: 6px;
}
.hist-item .hist-meta .tag {
  background: #1a1a26;
  border: 1px solid #2a2a3a;
  color: #b6b6c4;
  border-radius: 4px;
  padding: 1px 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.hist-item .hist-prompt {
  color: #c0c0d0;
  line-height: 1.5;
  margin-bottom: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 4.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.hist-item .hist-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
  margin-top: 6px;
}
.hist-item .hist-thumbs img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 6px; background: #0a0a12; border: 1px solid #1f1f2b;
}
.hist-item .hist-actions-row {
  display: flex; gap: 6px; margin-top: 8px;
}
.hist-item .hist-actions-row button,
.hist-item .hist-actions-row a {
  font-size: 11px; padding: 4px 9px;
  text-decoration: none;
}
