/* ==========================================================================
   PowerPrompt Studio — app design system (creator relaunch, 2026-07)
   Used by index.html (the generator app). Legacy pages keep styles.css.
   ========================================================================== */

:root {
  --bg: #0b0e1a;
  --bg-soft: #11152a;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #eef1fb;
  --muted: #98a0c3;
  --accent: #6c7bff;
  --accent-2: #35e0dc;
  --accent-grad: linear-gradient(93deg, #6c7bff 0%, #35e0dc 100%);
  --danger: #ff6b81;
  --success: #3ee08f;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

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

html { color-scheme: dark; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(900px 500px at 85% -10%, rgba(108, 123, 255, 0.16), transparent 60%),
    radial-gradient(700px 420px at -10% 25%, rgba(53, 224, 220, 0.10), transparent 55%),
    radial-gradient(800px 600px at 50% 120%, rgba(160, 108, 255, 0.10), transparent 60%);
  background-attachment: fixed;
}

.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.6rem;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  background: rgba(11, 14, 26, 0.7);
  position: sticky; top: 0; z-index: 50;
}
.topbar .brand { display: flex; align-items: center; gap: 0.65rem; }
.topbar .brand img { height: 34px; border-radius: 8px; }
.topbar .brand strong { font-size: 1.05rem; letter-spacing: 0.2px; }
.topbar .brand span.badge {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar nav { display: flex; align-items: center; gap: 0.6rem; }

.chip {
  display: inline-flex; align-items: center; gap: 0.45rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel); color: var(--muted);
  padding: 0.42rem 0.85rem; font-size: 0.78rem; text-decoration: none;
  transition: border-color .15s ease, color .15s ease;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.chip.warn .dot { background: #ffc53d; }

.btn {
  border: none; cursor: pointer; font-family: inherit;
  border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem;
  padding: 0.6rem 1.1rem; color: var(--text);
  background: var(--panel-strong); border: 1px solid var(--border);
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.btn-primary {
  background: var(--accent-grad); color: #0a1020; border: none;
  box-shadow: 0 8px 26px rgba(76, 116, 255, 0.35);
}
.btn-primary:hover { box-shadow: 0 12px 32px rgba(76, 116, 255, 0.5); }
.btn-ghost { background: transparent; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ---------- layout ---------- */
.shell { max-width: 1060px; margin: 0 auto; padding: 2rem 1.4rem 4rem; }

.headline { text-align: center; margin: 0.6rem 0 1.8rem; }
.headline h1 { font-size: clamp(1.5rem, 3.2vw, 2.2rem); font-weight: 800; letter-spacing: -0.4px; }
.headline h1 em {
  font-style: normal; background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.headline p { color: var(--muted); margin-top: 0.45rem; font-size: 0.95rem; }

/* ---------- mode tabs ---------- */
.mode-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem;
  background: var(--panel); border: 1px solid var(--border);
  padding: 0.45rem; border-radius: 16px; margin-bottom: 1.4rem;
}
.mode-tab {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  padding: 0.85rem 0.6rem; border-radius: 12px; cursor: pointer;
  border: 1px solid transparent; text-align: center;
  transition: background .15s ease, border-color .15s ease;
}
.mode-tab i { font-size: 1.15rem; margin-bottom: 0.2rem; color: var(--muted); }
.mode-tab .t { font-weight: 700; font-size: 0.95rem; }
.mode-tab .d { font-size: 0.72rem; color: var(--muted); }
.mode-tab.active { background: var(--panel-strong); border-color: var(--border-strong); }
.mode-tab.active i { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- cards / sections ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.35rem 1.4rem; margin-bottom: 1.1rem;
}
.card > label.section-label, .section-label {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.85rem;
}
.section-label i { color: var(--accent); }
.section-label .opt { font-weight: 500; letter-spacing: 0; text-transform: none; opacity: 0.7; }

textarea#prompt {
  width: 100%; min-height: 120px; resize: vertical;
  background: rgba(0, 0, 0, 0.25); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.9rem 1rem; font-family: inherit; font-size: 0.95rem; line-height: 1.55;
}
textarea#prompt:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 123, 255, 0.18); }

/* ---------- segmented pills ---------- */
.segmented { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.segmented input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.segmented label.pill {
  cursor: pointer; user-select: none;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.5rem 1rem; font-size: 0.85rem; color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
  transition: all .14s ease; display: inline-flex; align-items: center; gap: 0.45rem;
}
.segmented label.pill:hover { color: var(--text); border-color: var(--border-strong); }
.segmented input:checked + label.pill {
  color: #0a1020; background: var(--accent-grad); border-color: transparent; font-weight: 700;
}
.segmented input:disabled + label.pill { opacity: 0.4; cursor: not-allowed; }

/* ---------- context inputs ---------- */
.context-body { margin-top: 0.9rem; }
.file-drop {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm);
  padding: 1.5rem 1rem; text-align: center; color: var(--muted); cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  position: relative;
}
.file-drop:hover, .file-drop.drag { border-color: var(--accent); background: rgba(108, 123, 255, 0.06); }
.file-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-drop i { font-size: 1.5rem; margin-bottom: 0.4rem; display: block; color: var(--accent); }
.file-drop small { display: block; margin-top: 0.35rem; font-size: 0.72rem; opacity: 0.75; }
.file-name { margin-top: 0.5rem; font-size: 0.82rem; color: var(--accent-2); }

input[type="url"], select.control, input[type="text"].control {
  width: 100%; background: rgba(0, 0, 0, 0.25); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem; font-family: inherit; font-size: 0.9rem;
}
input[type="url"]:focus, select.control:focus { outline: none; border-color: var(--accent); }
select.control option { background: #141830; }

/* ---------- sliders ---------- */
.range-row { display: flex; align-items: center; gap: 1rem; }
.range-row output { min-width: 92px; text-align: right; font-weight: 700; font-size: 0.92rem; color: var(--accent-2); }
input[type="range"] {
  flex: 1; appearance: none; -webkit-appearance: none; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 30%), rgba(255,255,255,0.12) var(--fill, 30%));
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent); cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent); cursor: pointer;
}

/* ---------- theme gallery ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 0.7rem; }
.theme-card {
  border: 1.5px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer;
  background: rgba(0, 0, 0, 0.2); transition: transform .13s ease, border-color .13s ease, box-shadow .15s ease;
}
.theme-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 123, 255, 0.25); }
.theme-thumb { height: 84px; position: relative; padding: 10px 12px; }
.theme-thumb .bar { height: 7px; border-radius: 3px; width: 70%; margin-bottom: 6px; }
.theme-thumb .bar.b2 { width: 45%; height: 5px; opacity: 0.75; }
.theme-thumb .blob { position: absolute; right: -14px; bottom: -18px; width: 58px; height: 58px; border-radius: 50%; opacity: 0.5; }
.theme-thumb .chipset { position: absolute; left: 12px; bottom: 10px; display: flex; gap: 4px; }
.theme-thumb .chipset span { width: 16px; height: 10px; border-radius: 3px; }
.theme-name { padding: 0.5rem 0.75rem; font-size: 0.8rem; font-weight: 600; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 0.4rem; }
.theme-card.auto .theme-thumb {
  background: conic-gradient(from 210deg at 60% 40%, #6c7bff, #a06cff, #35e0dc, #6c7bff);
}
.theme-card.auto .theme-name i { color: #ffc53d; }

/* ---------- video format cards ---------- */
.format-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.7rem; }
.format-card {
  position: relative; border: 1.5px solid var(--border); border-radius: 12px;
  padding: 0.95rem 0.9rem 0.85rem; cursor: pointer; background: rgba(0, 0, 0, 0.2);
  transition: transform .13s ease, border-color .13s ease, box-shadow .15s ease;
}
.format-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.format-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 123, 255, 0.25); }
.format-card i { font-size: 1.15rem; color: var(--accent-2); }
.format-card .t { font-weight: 700; font-size: 0.88rem; margin: 0.45rem 0 0.2rem; }
.format-card .d { font-size: 0.72rem; color: var(--muted); line-height: 1.45; }
.format-card.locked { opacity: 0.45; cursor: not-allowed; }
.format-card.locked::after {
  content: '\f023  Upgrade / configure'; font-family: 'Font Awesome 6 Free', sans-serif; font-weight: 900;
  position: absolute; top: 8px; right: 10px; font-size: 0.6rem; color: #ffc53d;
}

/* ---------- caption style chips ---------- */
.caption-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 0.6rem; }
.caption-chip {
  border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer;
  padding: 0.7rem 0.5rem; text-align: center; background: rgba(0, 0, 0, 0.28);
  transition: border-color .13s ease, box-shadow .13s ease;
}
.caption-chip.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 123, 255, 0.22); }
.caption-chip .demo { font-weight: 800; font-size: 0.82rem; display: block; margin-bottom: 0.3rem; }
.caption-chip .n { font-size: 0.68rem; color: var(--muted); }
.demo-bold { color: #fff; text-shadow: -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px 1.5px 0 #000, 1.5px 1.5px 0 #000; text-transform: uppercase; }
.demo-karaoke .hl { color: #ffd400; } .demo-karaoke { color: #fff; text-transform: uppercase; }
.demo-lower { background: rgba(0,0,0,0.72); color: #fff; padding: 1px 7px; border-radius: 3px; font-weight: 600; }
.demo-minimal { color: #e8e8e8; font-weight: 500; }
.demo-neon { color: #c8ff3e; text-shadow: 0 0 9px rgba(200, 255, 62, 0.9); text-transform: uppercase; }
.demo-auto { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px; background: rgba(255,255,255,0.14);
  transition: background .15s ease; cursor: pointer;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .15s ease;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); }

.subrow { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-top: 0.9rem; }
.subrow .field label { display: block; font-size: 0.72rem; color: var(--muted); margin-bottom: 0.35rem; font-weight: 600; }

/* ---------- generate button ---------- */
.generate-wrap { margin-top: 1.4rem; }
#generate-btn {
  width: 100%; padding: 1rem; font-size: 1.02rem; font-weight: 800; letter-spacing: 0.2px;
  border-radius: 14px; border: none; cursor: pointer; color: #0a1020;
  background: var(--accent-grad);
  box-shadow: 0 10px 34px rgba(76, 116, 255, 0.4);
  transition: transform .12s ease, box-shadow .16s ease, filter .15s ease;
}
#generate-btn:hover { transform: translateY(-1.5px); box-shadow: 0 16px 44px rgba(76, 116, 255, 0.55); filter: saturate(1.1); }
#generate-btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.quota-hint { text-align: center; color: var(--muted); font-size: 0.75rem; margin-top: 0.6rem; }
.quota-hint a { color: var(--accent-2); text-decoration: none; }

/* ---------- status: loading / error / download ---------- */
.loading-container { text-align: center; padding: 3.2rem 1rem; }
.loading-spinner {
  width: 54px; height: 54px; margin: 0 auto 1.2rem; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.12); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-container h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.loading-container p { color: var(--muted); font-size: 0.85rem; }
#loading-step { margin-top: 0.9rem; color: var(--accent-2); font-size: 0.82rem; min-height: 1.2em; }

.error-container {
  border: 1px solid rgba(255, 107, 129, 0.45); background: rgba(255, 107, 129, 0.08);
  border-radius: var(--radius); padding: 1.4rem; text-align: center; margin-bottom: 1rem;
}
.error-container i { color: var(--danger); font-size: 1.5rem; margin-bottom: 0.5rem; }
.error-container h3 { margin-bottom: 0.3rem; font-size: 1rem; }
.error-container p { color: var(--muted); font-size: 0.87rem; margin-bottom: 0.9rem; }

.download-section {
  position: relative; text-align: center;
  border: 1px solid rgba(62, 224, 143, 0.4); background: rgba(62, 224, 143, 0.07);
  border-radius: var(--radius); padding: 2rem 1.4rem; margin-bottom: 1rem;
}
.download-section .close-download-btn {
  position: absolute; top: 8px; right: 14px; background: none; border: none; color: var(--muted);
  font-size: 1.3rem; cursor: pointer;
}
.download-section h3 { margin-bottom: 0.3rem; }
.download-section p { color: var(--muted); font-size: 0.85rem; margin-bottom: 1.1rem; }
.download-actions { display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; }

/* ---------- modals ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 1rem;
  background: rgba(5, 7, 15, 0.72); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .25s ease;
}
.modal-overlay.active { opacity: 1; }
.modal-card {
  width: 100%; max-width: 460px; background: #141830;
  border: 1px solid var(--border-strong); border-radius: 18px; padding: 1.8rem;
  box-shadow: var(--shadow); position: relative;
}
.modal-card .close-button {
  position: absolute; top: 10px; right: 16px; font-size: 1.4rem; color: var(--muted); cursor: pointer;
  background: none; border: none;
}
.modal-card h2 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.modal-card p { color: var(--muted); font-size: 0.9rem; line-height: 1.55; margin-bottom: 1.1rem; }
.modal-card textarea {
  width: 100%; min-height: 120px; background: rgba(0, 0, 0, 0.3); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.8rem; font-family: inherit;
  margin-bottom: 0.9rem;
}
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; flex-wrap: wrap; }
.feedback-status { font-size: 0.82rem; margin-top: 0.6rem; }
.feedback-status.success { color: var(--success); }
.feedback-status.error { color: var(--danger); }

/* ---------- footer ---------- */
footer.app-footer { text-align: center; color: var(--muted); font-size: 0.78rem; padding: 1.6rem 0 0.4rem; }
footer.app-footer a { color: var(--accent-2); text-decoration: none; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .shell { padding: 1.2rem 0.9rem 3rem; }
  .topbar { padding: 0.7rem 0.9rem; }
  .topbar .brand strong { display: none; }
  .subrow { grid-template-columns: 1fr; }
  .mode-tab .d { display: none; }
}
