/*
  playground-theme.css — shared visual layer for playground.php / demo.php / registry.php.
  Static, database-free. Resolves playground-scoped vars from the site palette defined in
  style.css (which switches via html[data-theme="dark"]). No PHP, no DB.
  Linked AFTER /assets/style.css so playground vars win where they overlap.
*/
:root {
    --surface: var(--bg-alt, #ffffff);
    --border: var(--line, #e4e4e0);
    --text: var(--ink, #1a1a1a);
    --text-muted: var(--ink-soft, #555);
    --primary: #2563eb;            /* playground blue accent — preserved across both themes */
}
html[data-theme="dark"] {
    --surface: var(--bg-alt);     /* #221d19 cards */
    --border: var(--line);         /* #3a322c borders */
    --text: var(--ink);            /* #ece3da */
    --text-muted: var(--ink-soft); /* #a89c8f */
    --primary: #2563eb;            /* keeps playground.php's blue-on-dark identity */
}

/* ---- layout ---- */
.playground-container { max-width: 1100px; margin: 0 auto; padding: 24px; }
.playground-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 24px; }
@media (max-width: 900px) { .playground-grid { grid-template-columns: 1fr; } }
.demo-container { max-width: 1000px; margin: 0 auto; padding: 24px; }
.reg-container { max-width: 900px; margin: 0 auto; padding: 24px; }

/* ---- cards / panels ---- */
.panel,
.model-card,
.cfg-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius, 10px);
    padding: 20px;
}
.panel h3 { margin: 0 0 16px; font-size: 1.1rem; }
.panel h3 .stepbadge { font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--primary); color: #fff; margin-left: 8px; }
.model-card { margin-bottom: 20px; }
.model-card h3 { margin: 0 0 8px; font-size: 1.1rem; }
.model-card .subtitle { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 12px; }
.model-card .response {
    min-height: 80px;
    background: var(--surface);
    border-radius: var(--radius, 10px);
    padding: 12px;
    margin: 12px 0;
    font-size: 0.9rem;
    white-space: pre-wrap;
    color: var(--text);
}
.model-card .meta { font-size: 0.75rem; color: var(--text-muted); }
.cfg-card { padding: 16px; margin-bottom: 16px; }
.cfg-card h3 { margin: 0 0 4px; font-size: 1rem; }
.cfg-card .meta { font-size: .75rem; color: var(--text-muted); margin-bottom: 8px; }
.cfg-card .actions { display: flex; gap: 8px; margin-top: 12px; }

/* ---- forms / inputs ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: .85rem; font-weight: 500; color: var(--text-muted); }
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: var(--radius, 10px); font-family: inherit; font-size: .9rem;
    box-sizing: border-box; background: var(--surface); color: var(--text);
}
.form-group textarea { min-height: 110px; resize: vertical; font-family: 'Monaco','Menlo','Ubuntu Mono',monospace; font-size: .85rem; line-height: 1.5; }
.form-group small { display: block; margin-top: 4px; font-size: .75rem; color: var(--text-muted); }
.field-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.field-row input[type="checkbox"] { margin: 0; width: 16px; height: 16px; }
.field-label { flex: 1; font-size: .85rem; }
.field-label input { width: 100%; font-size: .8rem; padding: 4px 8px; }
.field-type { width: 130px; }

/* ---- buttons (unified: base .btn is the blue playground primary) ---- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border: none; border-radius: var(--radius, 10px);
    font-size: .9rem; font-weight: 500; cursor: pointer;
    background: var(--primary); color: #fff;
    transition: background .15s ease, border-color .15s ease, color .18s ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); }
.btn-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; font-size: .75rem; }
.btn-danger:hover { background: #fecaca; }
.btn-group { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

/* ---- playground kreator extras ---- */
.result-panel { min-width: 260px; }
.result-tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.result-tab { padding: 8px 16px; border: none; background: transparent; cursor: pointer; font-size: .85rem; color: var(--text-muted); border-radius: 6px 6px 0 0; transition: all .15s; }
.result-tab.active { background: var(--primary); color: #fff; }
.result-tab:hover:not(.active) { background: var(--surface); }
.result-content { min-height: 220px; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.result-content pre { margin: 0; padding: 16px; background: #1e1e1e; color: #d4d4d4; border-radius: var(--radius, 10px); overflow: auto; font-family: 'Monaco','Menlo','Ubuntu Mono',monospace; font-size: .8rem; line-height: 1.5; max-height: 480px; }
.result-content .placeholder { display: flex; align-items: center; justify-content: center; height: 200px; color: var(--text-muted); font-style: italic; }
.validation-result { padding: 12px 16px; border-radius: var(--radius, 10px); font-size: .85rem; margin: 12px 0; }
.validation-result.valid { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.validation-result.invalid { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.tree { font-size: .8rem; background: #1e1e1e; color: #d4d4d4; padding: 12px; border-radius: var(--radius, 10px); overflow: auto; max-height: 240px; font-family: 'Monaco','Menlo','Ubuntu Mono',monospace; }
.hero { margin-bottom: 24px; }
.hero h1 { margin: 0 0 6px; }
.hero p.slogan { color: var(--text-muted); }
.insights-link { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ---- demo arena / yaml / tools ---- */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; }
@media (max-width: 700px) { .compare-grid { grid-template-columns: 1fr; } }
.prompt-area { margin-bottom: 20px; }
.prompt-area textarea {
    width: 100%; padding: 12px; border: 1px solid var(--border);
    border-radius: var(--radius, 10px); font: inherit; font-size: 0.9rem;
    min-height: 80px; resize: vertical; box-sizing: border-box;
    background: var(--surface); color: var(--text);
}
.info-box {
    background: var(--surface);
    border-radius: var(--radius, 10px);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: var(--text);
}
.info-box code { background: var(--border); padding: 1px 5px; border-radius: 4px; font-size: 0.8rem; }
.tool-select { width: 100%; min-width: 220px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius, 10px); font-size: 0.9rem; background: var(--surface); color: var(--text); }

/* ---- registry ---- */
.empty { color: var(--text-muted); font-style: italic; padding: 24px 0; }
pre { background: #1e1e1e; color: #d4d4d4; border-radius: var(--radius, 10px); padding: 12px; overflow: auto; font-family: Monaco,Menlo,monospace; font-size: .75rem; max-height: 200px; margin: 8px 0; }

/* ---- spinner ---- */
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid transparent; border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
