/* Prompt Tools Platform — public styles */
:root {
  --aptf-bg: #081C1C;
  --aptf-card: #0D2E2E;
  --aptf-panel: #0D2E2E;
  --aptf-text: #FAFBFB;
  --aptf-muted: #B0BEC5;
  --aptf-accent: #26A69A;
  --aptf-accent-hover: #1e8f84;
  --aptf-border: rgba(176, 190, 197, 0.18);
  --aptf-radius: 16px;
}

.aptf-theme-light {
  --aptf-bg: #f1f5f9;
  --aptf-card: #ffffff;
  --aptf-panel: #ffffff;
  --aptf-text: #0f172a;
  --aptf-muted: #64748b;
  --aptf-border: rgba(15, 23, 42, 0.12);
}

body.aptf-theme-dark {
  background: var(--aptf-bg);
  color: var(--aptf-text);
}

.aptf-body.aptf-theme-light,
body.aptf-theme-light .aptf-catalog,
body.aptf-theme-light .aptf-tool-runner {
  background: var(--aptf-bg);
  color: var(--aptf-text);
}

.aptf-catalog,
.aptf-tool-runner {
  max-width: 1200px;
  margin: 24px auto;
  padding: 24px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.5;
  box-sizing: border-box;
}

/* Inside MPT app shell — use full content width */
.mpt-app-content .aptf-catalog,
.mpt-app-content .aptf-tool-runner,
.mpt-app-content .aptf-module-runner {
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.mpt-app-content .aptf-tool-runner .aptf-theme-toggle-wrap,
.mpt-app-content .aptf-module-runner .aptf-theme-toggle-wrap,
.mpt-app-wrap .aptf-theme-toggle-wrap {
  display: none !important;
}

.aptf-tool-runner.aptf-standalone {
  max-width: 1100px;
}

.aptf-theme-toggle-wrap {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 16px;
}

.aptf-theme-btn {
  background: var(--aptf-card);
  border: 1px solid var(--aptf-border);
  color: var(--aptf-muted);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}

.aptf-theme-btn.aptf-theme-active {
  color: var(--aptf-bg);
  background: var(--aptf-accent);
  border-color: var(--aptf-accent);
}

/* Tool runner light/dark scoped to runner (works inside MPT app) */
.aptf-tool-runner.aptf-theme-light {
  --aptf-bg: #f1f5f9;
  --aptf-card: #ffffff;
  --aptf-panel: #ffffff;
  --aptf-text: #0f172a;
  --aptf-muted: #64748b;
  --aptf-border: rgba(15, 23, 42, 0.12);
  background: var(--aptf-bg);
  color: var(--aptf-text);
}
.aptf-tool-runner.aptf-theme-dark {
  background: var(--aptf-bg);
  color: var(--aptf-text);
}
.mpt-app-content .aptf-tool-runner.aptf-theme-light .aptf-input-panel,
.mpt-app-content .aptf-tool-runner.aptf-theme-light .aptf-output-panel,
.mpt-app-content .aptf-tool-runner.aptf-theme-light .aptf-form-field input,
.mpt-app-content .aptf-tool-runner.aptf-theme-light .aptf-form-field select,
.mpt-app-content .aptf-tool-runner.aptf-theme-light .aptf-form-field textarea,
.mpt-app-content .aptf-module-runner.aptf-theme-light .aptf-input-panel,
.mpt-app-content .aptf-module-runner.aptf-theme-light .aptf-output-panel,
.mpt-app-content .aptf-module-runner.aptf-theme-light .aptf-form-field input,
.mpt-app-content .aptf-module-runner.aptf-theme-light .aptf-form-field select,
.mpt-app-content .aptf-module-runner.aptf-theme-light .aptf-form-field textarea {
  background: #fff;
  color: #0f172a;
}

.mpt-theme-light .aptf-mm-picker-wrap {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.12);
}
.mpt-theme-light .aptf-mm-picker-label { color: #0f172a; }

.aptf-hero {
  text-align: center;
  margin-bottom: 32px;
}

.aptf-badge {
  display: inline-block;
  background: rgba(45, 212, 191, 0.15);
  color: var(--aptf-accent);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.aptf-hero-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin: 0 0 12px;
  line-height: 1.2;
}

.aptf-hero-sub {
  color: var(--aptf-muted);
  max-width: 720px;
  margin: 0 auto 16px;
}

.aptf-features {
  list-style: none;
  padding: 0;
  margin: 16px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.aptf-features li {
  background: var(--aptf-card);
  border: 1px solid var(--aptf-border);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
}

.aptf-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .aptf-layout {
    grid-template-columns: 1fr;
  }
}

.aptf-input-panel,
.aptf-output-panel {
  background: var(--aptf-panel);
  border: 1px solid var(--aptf-border);
  border-radius: var(--aptf-radius);
  padding: 20px;
}

.aptf-input-panel h2,
.aptf-output-panel h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.aptf-field {
  margin-bottom: 16px;
}

.aptf-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 14px;
}

.aptf-required {
  color: #f87171;
}

.aptf-field input[type="text"],
.aptf-field textarea,
.aptf-field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--aptf-border);
  background: var(--aptf-bg);
  color: var(--aptf-text);
  font-size: 14px;
  box-sizing: border-box;
}

.aptf-field textarea {
  min-height: 90px;
  resize: vertical;
}

.aptf-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 400;
  margin-bottom: 8px;
  font-size: 14px;
}

.aptf-form-actions,
.aptf-output-actions,
.aptf-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.aptf-output-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.aptf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}

.aptf-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.aptf-btn-primary {
  background: var(--aptf-accent);
  color: #042f2e;
}

.aptf-btn-primary:hover:not(:disabled) {
  background: var(--aptf-accent-hover);
}

.aptf-btn-secondary {
  background: var(--aptf-card);
  color: var(--aptf-text);
  border: 1px solid var(--aptf-border);
}

.aptf-cards-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.aptf-prompt-card {
  background: var(--aptf-card);
  border: 1px solid var(--aptf-border);
  border-radius: 10px;
  overflow: hidden;
}

.aptf-card-header {
  margin: 0;
}

.aptf-card-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: transparent;
  border: none;
  color: var(--aptf-text);
  cursor: pointer;
  text-align: left;
}

.aptf-card-title {
  display: block;
  font-size: 15px;
}

.aptf-card-desc {
  display: block;
  color: var(--aptf-muted);
  font-size: 13px;
  font-weight: 400;
  margin-top: 4px;
}

.aptf-card-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(45, 212, 191, 0.2);
  color: var(--aptf-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.aptf-card-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--aptf-border);
}

.aptf-card-label {
  font-size: 12px;
  color: var(--aptf-muted);
  margin: 12px 0 8px;
}

.aptf-prompt-text {
  background: var(--aptf-bg);
  border: 1px solid var(--aptf-border);
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 280px;
  overflow: auto;
  margin: 0 0 12px;
}

.aptf-empty {
  color: var(--aptf-muted);
  font-size: 14px;
}

.aptf-footer {
  margin-top: 32px;
  text-align: center;
  color: var(--aptf-muted);
  font-size: 13px;
}

.aptf-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--aptf-accent);
  color: #042f2e;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 99999;
}

.aptf-toast.aptf-toast-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Catalog */
.aptf-catalog-hero {
  text-align: center;
  margin-bottom: 32px;
}

.aptf-catalog-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  margin: 0 0 8px;
}

.aptf-catalog-hero h1 span {
  color: var(--aptf-accent);
}

.aptf-catalog-hero p {
  color: var(--aptf-muted);
  max-width: 640px;
  margin: 0 auto;
}

.aptf-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.aptf-tool-card {
  background: var(--aptf-card);
  border: 1px solid var(--aptf-border);
  border-radius: var(--aptf-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s, transform 0.15s;
}

.aptf-tool-card:hover {
  border-color: var(--aptf-accent);
  transform: translateY(-2px);
}

.aptf-tool-card-num {
  font-size: 12px;
  color: var(--aptf-accent);
  font-weight: 700;
}

.aptf-tool-card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.aptf-tool-card p {
  margin: 0;
  color: var(--aptf-muted);
  font-size: 14px;
  flex: 1;
}

.aptf-notice {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecaca;
  padding: 16px;
  border-radius: 8px;
}

.aptf-notice a {
  color: var(--aptf-accent);
}

.aptf-muted { color: var(--aptf-muted); font-size: 14px; }

.aptf-plan-line { margin-top: 12px; }
.aptf-plan-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(45, 212, 191, 0.2);
  color: var(--aptf-accent);
}
.aptf-plan-free { background: rgba(148,163,184,0.2); color: var(--aptf-muted); }
.aptf-plan-bronze { background: rgba(180,120,60,0.25); color: #d4a574; }
.aptf-plan-silver { background: rgba(180,180,200,0.25); color: #c0c0d8; }
.aptf-plan-gold { background: rgba(255,200,80,0.25); color: #ffd966; }

.aptf-lock-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(248,113,113,0.2);
  color: #fca5a5;
  width: fit-content;
}
.aptf-tool-locked { opacity: 0.85; }
.aptf-tool-locked:hover { transform: none; border-color: var(--aptf-border); }
.aptf-plan-lock { text-align: center; padding: 32px; }
.aptf-shortcode-hint { font-size: 11px; word-break: break-all; }

/* Member dashboard */
.aptf-member-dashboard {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--aptf-text);
}
@media (max-width: 768px) {
  .aptf-member-dashboard { grid-template-columns: 1fr; }
}
.aptf-sidebar {
  background: var(--aptf-card);
  border: 1px solid var(--aptf-border);
  border-radius: var(--aptf-radius);
  padding: 20px;
  height: fit-content;
  position: sticky;
  top: 24px;
}
.aptf-sidebar-brand { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.aptf-sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.aptf-nav-item {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--aptf-muted);
  text-decoration: none;
  font-size: 14px;
}
.aptf-nav-item:hover, .aptf-nav-active {
  background: rgba(45,212,191,0.12);
  color: var(--aptf-accent);
}
.aptf-sidebar-upgrade { margin-top: 16px; width: 100%; text-align: center; }
.aptf-dash-main { min-width: 0; }
.aptf-dash-section { margin-bottom: 40px; scroll-margin-top: 24px; }
.aptf-dash-section h1, .aptf-dash-section h2 { margin: 0 0 12px; }
.aptf-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.aptf-stat-card {
  background: var(--aptf-card);
  border: 1px solid var(--aptf-border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.aptf-stat-num { display: block; font-size: 1.75rem; font-weight: 700; color: var(--aptf-accent); }
.aptf-stat-label { font-size: 12px; color: var(--aptf-muted); }
.aptf-locked-heading { margin-top: 32px; color: var(--aptf-muted); }
.aptf-locked-grid .aptf-tool-card { border-style: dashed; }
.aptf-vault-list { display: flex; flex-direction: column; gap: 12px; }
.aptf-vault-item {
  background: var(--aptf-card);
  border: 1px solid var(--aptf-border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.aptf-vault-item strong { flex: 1; min-width: 160px; }
.aptf-settings-list { list-style: none; padding: 0; }
.aptf-settings-list li { padding: 8px 0; border-bottom: 1px solid var(--aptf-border); }

/* AI Workspace */
.aptf-ai-workspace {
  max-width: 960px;
  margin: 24px auto;
  padding: 24px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.aptf-ai-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 16px;
}

.aptf-ai-tab {
  background: var(--aptf-card);
  border: 1px solid var(--aptf-border);
  color: var(--aptf-muted);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}

.aptf-ai-tab.aptf-ai-tab-active {
  background: var(--aptf-accent);
  border-color: var(--aptf-accent);
  color: var(--aptf-bg);
}

.aptf-ai-panel { display: none; }
.aptf-ai-panel.aptf-ai-panel-active { display: block; }

.aptf-ai-form {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}

.aptf-ai-gate {
  background: var(--aptf-card);
  border: 1px solid var(--aptf-border);
  border-radius: var(--aptf-radius);
  padding: 24px;
  text-align: center;
  margin-top: 24px;
}

.aptf-ai-gate-warn { border-color: rgba(251, 191, 36, 0.4); }

.aptf-ai-result-card {
  background: var(--aptf-card);
  border: 1px solid var(--aptf-border);
  border-radius: var(--aptf-radius);
  padding: 20px;
  margin-top: 16px;
}

.aptf-ai-result-card h3 { margin: 0 0 8px; }

.aptf-ai-json,
.aptf-ai-instructions {
  background: var(--aptf-panel);
  border: 1px solid var(--aptf-border);
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  max-height: 320px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.aptf-ai-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.aptf-ai-error { color: #f87171; }

.aptf-card-locked .aptf-card-body { position: relative; }
.aptf-card-lock-overlay {
  text-align: center;
  padding: 20px;
  background: rgba(10, 22, 40, 0.85);
  border-radius: 8px;
  margin-bottom: 12px;
}
.aptf-card-lock-overlay p { color: var(--aptf-muted); margin: 8px 0; }

.aptf-one-shot-list { display: flex; flex-direction: column; gap: 16px; }
.aptf-one-shot-card {
  background: var(--aptf-card);
  border: 1px solid var(--aptf-border);
  border-radius: var(--aptf-radius);
  padding: 20px;
}
.aptf-one-shot-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.aptf-one-shot-cat {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--aptf-accent);
  letter-spacing: 0.05em;
}
.aptf-one-shot-text {
  background: var(--aptf-panel);
  border: 1px solid var(--aptf-border);
  border-radius: 8px;
  padding: 12px;
  white-space: pre-wrap;
  font-size: 13px;
  max-height: 200px;
  overflow: auto;
  margin-bottom: 12px;
}
.aptf-project-form {
  display: grid;
  gap: 10px;
  max-width: 520px;
  margin-bottom: 20px;
}
.aptf-project-form input,
.aptf-project-form textarea {
  background: var(--aptf-card);
  border: 1px solid var(--aptf-border);
  border-radius: 8px;
  padding: 10px;
  color: var(--aptf-text);
}

/* Per-tool PTF theme accents (fallback when JS vars not injected) */
.aptf-tool-runner.aptf-tool-theme-your-missing-millions .aptf-badge { background: rgba(212, 168, 83, 0.2); color: #d4a853; }
.aptf-tool-runner.aptf-tool-theme-cart-bump-chaos .aptf-badge { background: rgba(232, 67, 147, 0.2); color: #e84393; }
.aptf-tool-runner.aptf-tool-theme-pocket-arcade-machine .aptf-badge { background: rgba(0, 245, 255, 0.15); color: #00f5ff; }
.aptf-tool-runner.aptf-tool-theme-lead-magnet-machine .aptf-badge { background: rgba(38, 166, 154, 0.2); color: #26A69A; }
.aptf-tool-runner.aptf-tool-theme-micro-saas-without-saas .aptf-badge { background: rgba(99, 102, 241, 0.2); color: #6366f1; }
.aptf-tool-runner.aptf-tool-theme-make-boring-things-useful .aptf-badge { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.aptf-tool-runner.aptf-tool-theme-lead-gen-creator .aptf-badge { background: rgba(48, 191, 255, 0.2); color: #30bfff; }
.aptf-tool-runner.aptf-tool-theme-sell-sheet-creator .aptf-badge { background: rgba(244, 207, 122, 0.2); color: #f4cf7a; }
.aptf-tool-runner.aptf-tool-theme-cta-commander .aptf-badge { background: rgba(255, 107, 74, 0.2); color: #ff6b4a; }
.aptf-tool-runner.aptf-tool-theme-local-visibility-scorecard .aptf-badge { background: rgba(37, 99, 235, 0.2); color: #2563eb; }

.mpt-catalog-themed .aptf-catalog-hero h1 span {
  background: linear-gradient(135deg, #26A69A, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
