/* =========================
    DEMO LAYOUT — mobile first
   ========================= */

.demo-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: start;
    width: 100%;
    margin: 0 auto;
}

/* Tablette et + */
@media (min-width: 768px) {
    .demo-layout {
        gap: 2rem;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .demo-layout {
        grid-template-columns: 1fr 1fr;
    }
}
@media (min-width: 1524px) {
    .demo-layout {
        width: 80%;
    }
}
/* =========================
    FORM PANEL (gauche)
   ========================= */

.demo-form-panel {
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem 2rem;
    background: var(--bg-base);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.demo-form-panel form {
    width: 100%;
    margin: 0;
}

/* =========================
    CODE PANEL (droite)
   ========================= */

.demo-code {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
}

.demo-code-title {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem;
    font-size: 0.78rem;
    color: #8b949e;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.demo-code-title::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ce9178;
}

.demo-code pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.75rem;
    line-height: 1.7;
    color: var(--text-main);
}

@media (min-width: 768px) {
    .demo-code pre {
        padding: 1.25rem 1.5rem;
        font-size: 0.82rem;
    }
}

.demo-code code {
    font-family: inherit;
}

/* =========================
    BOUTON SUBMIT
   ========================= */

.btn-submit {
    width: 50%;
    padding: 0.8rem 1rem;
    border-radius: 1rem;
    font-size: 0.95rem;
}

/* =========================
    BADGE contextuel (title)
   ========================= */

.demo-code-badge {
    margin-left: auto;
    background: var(--accent, #2563eb);
    color: #fff;
    font-size: 0.68rem;
    padding: 0.1rem 0.5rem;
    border-radius: 0.4rem;
    font-family: inherit;
    letter-spacing: 0.02em;
}

/* =========================
    CHAMPS FORMULAIRE
   ========================= */

.field-details {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    background: var(--bg-base);
}

.field-details summary {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.field-details summary::-webkit-details-marker { display: none; }

.field-details[open] summary {
    border-bottom: 1px solid var(--border);
}

.field-type {
    color: #ffa657;
    font-size: 0.82rem;
}

.field-body {
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
}

.field-body p { margin: 0 0 0.5rem; }

.field-body pre {
    margin: 0;
    padding: 0.75rem 1rem;
    overflow-x: auto;
    font-size: 0.78rem;
    line-height: 1.6;
    background: var(--bg-surface);
    border-radius: 0.4rem;
}

/* Syntax — classes légères */
.kw  { color: #ff7b72; }   /* keywords: pub, fn, async, let, match, struct, impl */
.ty  { color: #ffa657; }   /* types: String, Result, Vec, i32, bool */
.st  { color: #a5d6ff; }   /* strings: "..." */
.cm  { color: #8b949e; font-style: italic; } /* comments */
.at  { color: #d2a8ff; }   /* attributes: #[form(...)] */
.mc  { color: #d2a8ff; }   /* macros: Set!, impl_form_access! */
.fn_ { color: #d2a8ff; }   /* function names */
.nb  { color: #79c0ff; }   /* numbers, booleans */
.op  { color: #ff7b72; }   /* operators */
.field { color: #e6edf3; } /* field names */

/* Rendu visuel champ — field_test.html */
.field-visual {
    margin: 0.75rem 0;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
}

.field-preview {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.field-preview label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.field-preview input,
.field-preview select,
.field-preview textarea {
    width: 100%;
    padding: 0.4rem 0.6rem;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 0.3rem;
    color: var(--text-main);
    font-size: 0.85rem;
}
