/* puppet-show shared styles */
:root {
  --bg: #0c0b0d;
  --surface: #18171b;
  --surface-hi: #1f1d23;
  --ink: #ecebee;
  --muted: #928f98;
  --line: #201e24;
  --line-strong: #312f36;
  --brand: #6f4915;
  --brand-strong: #95631d;
  --accent: #a7752e;
  --accent-ink: #efc78f;
  --green: #2d8a4e;
  --green-ink: #8fefb5;
  --red: #8a2d2d;
  --red-ink: #ef8f8f;
  --shadow: 0 18px 44px rgba(0,0,0,0.32);
  --radius: 1rem;
  --radius-sm: 0.6rem;
}

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

body {
  min-height: 100vh;
  font-family: 'Outfit', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 12%, rgba(255,255,255,0.06), transparent 34%),
    radial-gradient(circle at 88% 20%, rgba(255,255,255,0.05), transparent 40%),
    linear-gradient(160deg, var(--bg) 0%, #06060a 100%);
  display: flex;
  flex-direction: column;
}

/* ---- Buttons ---- */
.btn {
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--brand);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  box-shadow: 0 8px 18px rgba(0,0,0,0.28);
}
.btn-primary:hover { background: var(--brand-strong); }

.btn-secondary {
  background: var(--surface-hi);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn-secondary:hover { border-color: var(--accent); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  padding: 0.52rem 0.85rem;
  font-size: 0.82rem;
}
.btn-ghost:hover { color: var(--ink); border-color: var(--muted); }

.btn-danger {
  background: var(--red);
  color: var(--red-ink);
  border: 1px solid rgba(255,100,100,0.3);
}
.btn-danger:hover { background: #a03333; }

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 0.5rem;
  border-radius: 0.5rem;
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.card-header {
  padding: 1rem 1.1rem 0.8rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.card-body { padding: 1rem 1.1rem; }

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label { font-size: 0.82rem; color: var(--muted); font-weight: 500; }

input[type=text], input[type=number], textarea, select {
  background: var(--surface-hi);
  border: 1px solid var(--line-strong);
  border-radius: 0.55rem;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.8rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
input[type=text]:focus,
input[type=number]:focus,
textarea:focus,
select:focus { border-color: var(--accent); }

input[type=range] { accent-color: var(--accent); width: 100%; }

textarea { resize: vertical; min-height: 72px; }
select { cursor: pointer; }

/* ---- Modal ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 1.2rem;
  box-shadow: var(--shadow);
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in 200ms ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-head {
  padding: 1.1rem 1.2rem 0.9rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 { font-family: 'Sora', sans-serif; font-size: 1rem; }

.modal-body { padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.8rem; }
.modal-foot {
  padding: 0.8rem 1.2rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

/* ---- Tabs ---- */
.tabs { display: flex; gap: 0.3rem; border-bottom: 1px solid var(--line); padding: 0 0.2rem; }
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.7rem 0.85rem 0.6rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
  color: var(--accent-ink);
  border-bottom-color: var(--accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Tag / badge ---- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: color-mix(in srgb, var(--brand) 30%, var(--surface));
  border: 1px solid var(--accent);
  color: var(--accent-ink);
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-pending { background: rgba(180,140,50,0.2); color: #e0b840; }
.badge-running { background: rgba(50,120,200,0.2); color: #6ab0f5; }
.badge-complete { background: rgba(50,180,90,0.2); color: var(--green-ink); }
.badge-failed  { background: rgba(180,50,50,0.2);  color: var(--red-ink); }

/* ---- Utility ---- */
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 0.8rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.muted { color: var(--muted); font-size: 0.88rem; }
.text-sm { font-size: 0.85rem; }
.text-error { color: var(--red-ink); font-size: 0.85rem; }
.text-success { color: var(--green-ink); font-size: 0.85rem; }
.font-sora { font-family: 'Sora', sans-serif; }

/* ---- Image placeholder ---- */
.img-placeholder {
  background: linear-gradient(135deg, var(--surface-hi), var(--line-strong));
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  padding: 0.5rem;
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.6rem; opacity: 0.5; }
.empty-state p { font-size: 0.9rem; line-height: 1.5; }

/* ---- Animations ---- */
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.rise { animation: rise 380ms ease-out; }

@keyframes spin {
  to { transform: rotate(360deg); }
}
.spin { animation: spin 0.8s linear infinite; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
