/* Arcana Studio NLE — Right AI Copilot, Export Modal & Responsive */
/* ── Right AI Copilot Panel (Google Flow-style) ──────────────────────────── */
.st-copilot {
  width: 332px;
  flex-shrink: 0;
  background: var(--st-surface);
  border-left: 1px solid var(--st-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: width var(--st-dur-panel, 200ms) var(--st-ease-out, ease-out), opacity var(--st-dur-med, 180ms) var(--st-ease-out, ease-out);
}
.st-copilot.collapsed { width: 0; border-left: none; overflow: hidden; opacity: 0; pointer-events: none; }

.st-copilot-head {
  height: 46px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--st-border);
}
.st-copilot-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}
.st-spark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--st-accent), var(--st-accent-2));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
}

.st-copilot-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.st-copilot-hero {
  padding: 12px 4px 4px;
}
.st-copilot-hero h2 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: #f8fafc;
  margin-bottom: 6px;
}
.st-copilot-hero p { font-size: 12.5px; color: var(--st-muted); line-height: 1.45; }

.st-quick-cards { display: flex; flex-direction: column; gap: 8px; }
.st-quick-card {
  width: 100%;
  text-align: left;
  background: var(--st-card);
  border: 1px solid var(--st-border);
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--st-text);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.st-quick-card:hover {
  background: var(--st-card-hover);
  border-color: rgba(124, 92, 255, 0.55);
  transform: translateY(-1px);
}
.st-quick-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--st-accent-soft);
  color: #c4b5fd;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.st-quick-card strong { display: block; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.st-quick-card span { display: block; font-size: 11.5px; color: var(--st-muted); line-height: 1.35; }

.st-ai-msg {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.45;
  word-break: break-word;
}
.st-ai-msg.user {
  align-self: flex-end;
  max-width: 88%;
  background: linear-gradient(135deg, #4338ca, #2563eb);
  color: #fff;
}
.st-ai-msg.assistant {
  align-self: flex-start;
  width: 100%;
  background: var(--st-card);
  border: 1px solid var(--st-border);
  color: var(--st-text);
}

.st-copilot-composer {
  padding: 12px 14px;
  border-top: 1px solid var(--st-border);
  background: var(--st-panel);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.st-prompt-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--st-bg);
  border: 1px solid var(--st-border-strong);
  border-radius: 13px;
  padding: 8px 8px 8px 12px;
}
.st-prompt-box:focus-within { border-color: var(--st-accent); }
.st-prompt-box textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--st-text);
  font-size: 13px;
  line-height: 1.4;
  resize: none;
  outline: none;
  min-height: 22px;
  max-height: 92px;
}
.st-prompt-send {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  border: none;
  background: linear-gradient(135deg, var(--st-accent), var(--st-accent-2));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* ── Export Modal & Toast ────────────────────────────────────────────────── */
.st-modal-bg {
  position: fixed;
  inset: 0;
  z-index: 6000;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.st-modal-bg.open { display: flex; }
.st-modal {
  width: 100%;
  max-width: 440px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--st-panel);
  border: 1px solid var(--st-border-strong);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}
.st-export-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.st-export-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}
.st-export-quick-dl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.36);
}
.st-export-quick-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.st-export-quick-kicker {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #6ee7b7;
}
.st-export-quick-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--st-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.st-export-quick-meta {
  font-size: 11px;
  color: var(--st-muted);
}
.st-export-quick-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: transform 140ms var(--st-ease-out, ease-out), filter 140ms ease-out;
}
.st-export-quick-btn:hover { filter: brightness(1.08); }
.st-export-quick-btn:active { transform: scale(0.97); }
.st-export-prog-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.st-export-prog-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--st-accent), var(--st-accent-2));
  transition: width 220ms var(--st-ease-out, ease-out);
}
.st-export-abort-btn {
  border-color: rgba(248, 113, 113, 0.38) !important;
  color: #fca5a5 !important;
  background: rgba(248, 113, 113, 0.1) !important;
}
.st-export-done-banner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 13px;
  border-radius: 11px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.st-export-done-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.st-export-done-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--st-border-strong);
}
.st-export-done-item.single {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.st-export-done-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.st-export-done-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--st-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.st-export-done-meta {
  font-size: 11px;
  color: var(--st-muted);
}
.st-export-save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.32);
  transition: transform 140ms var(--st-ease-out, ease-out), filter 140ms ease-out;
}
.st-export-save-btn.full {
  width: 100%;
  min-height: 44px;
  font-size: 13.5px;
}
.st-export-save-btn:hover { filter: brightness(1.08); }
.st-export-save-btn:active { transform: scale(0.98); }
.st-export-error-banner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 13px;
  border-radius: 11px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
}
.st-export-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.2);
}
.st-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px) scale(0.98);
  z-index: 6500;
  background: #1a1e2a;
  color: #fff;
  border: 1px solid var(--st-border-strong);
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--st-dur-med, 180ms) var(--st-ease-out, ease-out), transform var(--st-dur-med, 180ms) var(--st-ease-out, ease-out);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}
.st-toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }

/* ── Custom Context Menu ─────────────────────────────────────────────────── */
.st-ctx-menu {
  position: fixed;
  z-index: 6800;
  min-width: 218px;
  max-width: 270px;
  padding: 5px;
  border-radius: 10px;
  background: rgba(21, 24, 33, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.62), 0 2px 6px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 1px;
  opacity: 0;
  transform: scale(0.96) translateY(-3px);
  pointer-events: none;
  transition: opacity 130ms var(--st-ease-out, cubic-bezier(0.22, 1, 0.36, 1)), transform 130ms var(--st-ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}
.st-ctx-menu.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}
.st-ctx-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--st-border);
  font-size: 11px;
  font-weight: 600;
  color: var(--st-muted);
}
.st-ctx-header > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.st-ctx-tag {
  flex-shrink: 0;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--st-text);
}
.st-ctx-item {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--st-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  transition: background var(--st-dur-fast, 120ms) var(--st-ease-out, ease-out), color var(--st-dur-fast, 120ms) var(--st-ease-out, ease-out);
}
.st-ctx-item:hover:not(:disabled),
.st-ctx-item:focus-visible:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  outline: none;
}
.st-ctx-item.danger { color: #fca5a5; }
.st-ctx-item.danger:hover:not(:disabled),
.st-ctx-item.danger:focus-visible:not(:disabled) {
  background: rgba(248, 113, 113, 0.16);
  color: #fecaca;
}
.st-ctx-item:disabled { opacity: 0.4; cursor: not-allowed; }
.st-ctx-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.st-ctx-icon {
  width: 14px;
  text-align: center;
  font-size: 11.5px;
  opacity: 0.85;
  flex-shrink: 0;
}
.st-ctx-kbd {
  flex-shrink: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  color: var(--st-dim);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 1px 5px;
}
.st-ctx-sep {
  height: 1px;
  background: var(--st-border);
  margin: 4px 4px;
}
.st-rename-modal { max-width: 360px; }

@media (prefers-reduced-motion: reduce) {
  #studioWorkspace *,
  #studioWorkspace *::before,
  #studioWorkspace *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 1024px) {
  .st-drawer { width: 240px; }
  .st-copilot { width: 280px; }
}
