/* ═══════════════════════════════════════════════════════════
   QBP Runtime CSS — Styles for QBP transpiled pages
   ═══════════════════════════════════════════════════════════ */

/* ── QBP Base ──────────────────────────────────────────────── */
.qbp-app {
  min-height: 100vh;
  background: var(--bg-primary, #0a0e1a);
  color: var(--text-primary, #e8edf5);
  font-family: var(--font-ui, 'Inter', -apple-system, sans-serif);
}
.qbp-page { padding: 24px; max-width: 1200px; margin: 0 auto; }

/* ── Layout ──────────────────────────────────────────────── */
.qbp-layout { display: flex; min-height: 100vh; }
.qbp-layout[data-type="sidebar"] { flex-direction: row; }
.qbp-layout[data-type="stack"] { flex-direction: column; }

.qbp-header {
  padding: 12px 24px; display: flex; align-items: center;
  background: var(--bg-secondary, #0f1422);
  border-bottom: 1px solid var(--border, #1e2a45);
}
.qbp-footer {
  padding: 16px 24px; text-align: center;
  background: var(--bg-secondary, #0f1422);
  border-top: 1px solid var(--border, #1e2a45);
  color: var(--text-dim, #5a6480); font-size: 12px;
}
.qbp-sidebar {
  width: 240px; padding: 16px; flex-shrink: 0;
  background: var(--bg-tertiary, #141928);
  border-right: 1px solid var(--border, #1e2a45);
  overflow-y: auto;
}
.qbp-content { flex: 1; padding: 24px; overflow-y: auto; }

/* ── Grid ────────────────────────────────────────────────── */
.qbp-grid { display: grid; gap: 16px; }
.qbp-grid[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
.qbp-grid[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.qbp-grid[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }
.qbp-row { display: flex; gap: 16px; }
.qbp-col { flex: 1; }

/* ── Components ──────────────────────────────────────────── */
.qbp-section { margin-bottom: 24px; }
.qbp-divider { border: none; border-top: 1px solid var(--border, #1e2a45); margin: 16px 0; }
.qbp-card {
  background: var(--bg-surface, #1a2035);
  border: 1px solid var(--border, #1e2a45);
  border-radius: 8px; padding: 20px;
  transition: all .2s ease;
}
.qbp-card:hover { border-color: var(--accent, #00d4ff); box-shadow: 0 0 12px rgba(0,212,255,.08); }
.qbp-panel {
  background: var(--bg-surface, #1a2035);
  border: 1px solid var(--border, #1e2a45);
  border-radius: 8px; padding: 16px;
}
.qbp-text { color: var(--text-secondary, #8b95b0); line-height: 1.7; }

/* ── Quantum Components ──────────────────────────────────── */
.qbp-circuit {
  background: var(--bg-primary, #0a0e1a);
  border: 1px solid var(--border, #1e2a45);
  border-radius: 8px; padding: 16px; margin: 12px 0;
}
.qbp-circuit .circuit-editor {
  width: 100%; min-height: 120px; padding: 12px;
  background: transparent; border: none; outline: none;
  color: var(--accent-green, #00ffaa);
  font-family: var(--font-mono, monospace); font-size: 13px;
  resize: vertical;
}
.qbp-circuit .circuit-status {
  padding: 8px 12px; border-top: 1px solid var(--border, #1e2a45);
  font-size: 11px; color: var(--text-dim, #5a6480);
}

.qbp-result {
  background: var(--bg-surface, #1a2035);
  border: 1px solid var(--border, #1e2a45);
  border-radius: 8px; padding: 16px;
}
.qbp-result canvas { width: 100%; height: 200px; }

.qbp-chart {
  background: var(--bg-surface, #1a2035);
  border: 1px solid var(--border, #1e2a45);
  border-radius: 8px; padding: 16px;
}

/* ── Interactive ─────────────────────────────────────────── */
.qbp-button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border: none; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent, #00d4ff), #0090cc);
  color: #fff; font-weight: 600; font-size: 14px;
  cursor: pointer; transition: all .2s ease;
  font-family: var(--font-ui, sans-serif);
}
.qbp-button:hover { filter: brightness(1.15); transform: translateY(-1px); }
.qbp-button[data-variant="secondary"] {
  background: var(--bg-surface, #1a2035);
  border: 1px solid var(--border, #1e2a45);
  color: var(--text-secondary, #8b95b0);
}
.qbp-button[data-variant="ghost"] { background: transparent; color: var(--accent, #00d4ff); }

.qbp-input {
  width: 100%; padding: 10px 14px;
  background: var(--bg-surface, #1a2035);
  border: 1px solid var(--border, #1e2a45);
  border-radius: 6px; color: var(--text-primary, #e8edf5);
  font-size: 14px; transition: border .2s;
}
.qbp-input:focus { border-color: var(--accent, #00d4ff); outline: none; }

.qbp-slider { width: 100%; accent-color: var(--accent, #00d4ff); }

/* ── Navigation ──────────────────────────────────────────── */
.qbp-menu { display: flex; flex-direction: column; gap: 4px; }
.qbp-link {
  display: block; padding: 8px 12px; border-radius: 6px;
  color: var(--text-secondary, #8b95b0); text-decoration: none;
  transition: all .2s ease; font-size: 13px;
}
.qbp-link:hover { background: rgba(0,212,255,.06); color: var(--accent, #00d4ff); }

.qbp-tabs { display: flex; border-bottom: 1px solid var(--border, #1e2a45); }
.qbp-tab {
  padding: 10px 16px; border: none; background: none;
  color: var(--text-secondary, #8b95b0); cursor: pointer;
  border-bottom: 2px solid transparent; font-size: 13px;
}
.qbp-tab.active { color: var(--accent, #00d4ff); border-bottom-color: var(--accent, #00d4ff); }

/* ── Overlays ────────────────────────────────────────────── */
.qbp-modal {
  position: fixed; inset: 0; z-index: 5000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6); backdrop-filter: blur(8px);
}
.qbp-modal .modal-content {
  background: var(--bg-secondary, #0f1422);
  border: 1px solid var(--border, #1e2a45);
  border-radius: 12px; padding: 24px;
  max-width: 500px; width: 90%;
}
.qbp-notification {
  position: fixed; top: 16px; right: 16px; z-index: 6000;
  padding: 12px 20px; border-radius: 8px;
  background: var(--bg-elevated, #1e2640);
  border: 1px solid var(--border, #1e2a45);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  animation: slide-in .3s ease;
}
@keyframes slide-in { from { transform: translateX(100%); opacity: 0; } }
.qbp-tooltip {
  position: relative;
}
.qbp-tooltip::after {
  content: attr(data-tip); position: absolute;
  bottom: 100%; left: 50%; transform: translateX(-50%);
  padding: 6px 10px; border-radius: 4px;
  background: var(--bg-elevated, #1e2640);
  border: 1px solid var(--border, #1e2a45);
  font-size: 12px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.qbp-tooltip:hover::after { opacity: 1; }

/* ── Progress / Loading ──────────────────────────────────── */
.qbp-progress {
  height: 4px; background: var(--border, #1e2a45);
  border-radius: 4px; overflow: hidden;
}
.qbp-progress .bar {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent, #00d4ff), var(--accent-green, #00ffaa));
  transition: width .3s ease;
}
.qbp-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border, #1e2a45);
  border-top-color: var(--accent, #00d4ff);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Data Display ────────────────────────────────────────── */
.qbp-table {
  width: 100%; border-collapse: collapse;
}
.qbp-table th, .qbp-table td {
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border, #1e2a45);
}
.qbp-table th {
  font-size: 11px; text-transform: uppercase;
  color: var(--text-dim, #5a6480); letter-spacing: 1px;
}
.qbp-table tr:hover { background: rgba(0,212,255,.04); }

.qbp-code {
  background: var(--bg-primary, #0a0e1a);
  border: 1px solid var(--border, #1e2a45);
  border-radius: 8px; padding: 16px;
  font-family: var(--font-mono, monospace); font-size: 13px;
  color: var(--accent-green, #00ffaa); overflow-x: auto;
}

.qbp-image { max-width: 100%; border-radius: 8px; }

/* ── Special Apps ────────────────────────────────────────── */
.qbp-game {
  background: radial-gradient(ellipse at center, #0c1428, var(--bg-primary, #0a0e1a));
  border: 1px solid var(--border, #1e2a45);
  border-radius: 8px; min-height: 300px; position: relative;
}
.qbp-tool {
  background: var(--bg-surface, #1a2035);
  border: 1px solid var(--border, #1e2a45);
  border-radius: 8px; padding: 20px;
}
.qbp-ai {
  background: var(--bg-surface, #1a2035);
  border: 1px solid var(--border, #1e2a45);
  border-radius: 8px; padding: 20px;
}
.qbp-doc {
  background: var(--bg-surface, #1a2035);
  border: 1px solid var(--border, #1e2a45);
  border-radius: 8px; padding: 20px;
  line-height: 1.8;
}
.qbp-widget {
  background: var(--bg-surface, #1a2035);
  border: 1px solid var(--border, #1e2a45);
  border-radius: 8px; padding: 16px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .qbp-layout[data-type="sidebar"] { flex-direction: column; }
  .qbp-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .qbp-grid[data-cols="3"],
  .qbp-grid[data-cols="4"] { grid-template-columns: repeat(2, 1fr); }
  .qbp-row { flex-direction: column; }
}
