/* =========================
    TEST CHAMPS — PAGE
   ========================= */

.field-test-page h1 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--accent);
}

.field-nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 480px) {
    .field-nav {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 768px) {
    .field-nav {
        grid-template-columns: repeat(8, 1fr);
    }
}

.field-nav a {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 2rem;
    padding: 0.3rem 0.9rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-main);
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
}

.field-nav a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Sections */
.field-test-page .demo-sections {
    align-items: flex-start;
}

.section {
    flex: 1 1 260px;
    min-width: 0;
    overflow: hidden;
    border-radius: 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 1.25rem;
}

.section h2 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    font-size: 0.65rem;
    color: var(--text-main);
    background: var(--border);
    border-radius: 3px;
    padding: 1px 5px;
    margin-left: 0.4rem;
    vertical-align: middle;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
}

/* Grille — colonne unique dans les sections flex */
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

/* Champs */
.field-box {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-base);
    overflow: hidden;
}

/* Forcer tous les inputs à rester dans leur colonne */
.field-box input,
.field-box select,
.field-box textarea {
    max-width: 100%;
    box-sizing: border-box;
}

.field-helper-text {
    display: none;
}

/* Actions */
.actions {
    text-align: center;
    margin-top: 2rem;
}

/* Formulaire test inline */
#test_new_form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* =========================
    RESPONSIVE
   ========================= */

@media (max-width: 768px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

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

    .section {
        padding: 1rem;
    }
}

.section summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.section summary::after {
    content: "▸";
    transition: transform 0.2s ease;
}

.section details[open] summary::after {
    transform: rotate(90deg);
}
.field-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.field-toolbar .field-nav {
    margin-bottom: 0;
}

.field-filter select {
    padding: 0.4rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    color: var(--text-main);
    font-size: 0.9rem;
    cursor: pointer;
}

.field-groups-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem;
}

.field-section {
    flex: 1 1 260px;
    min-width: 220px;
    max-width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
}

.field-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.6rem 1rem;
    cursor: pointer;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--accent);
}

.field-section-title::after {
    content: "▾";
    transition: transform 0.2s;
}

.field-section[open] > .field-section-title::after {
    transform: rotate(180deg);
}

.field-section .field-details {
    border-bottom: 1px solid var(--border);
    border-radius: 0;
}

.field-section .field-details:last-child {
    border-bottom: none;
}

@media (max-width: 640px) {
    .field-section {
        flex: 1 1 100%;
    }
}

/* Classes html_preview — remplacent les styles inline (CSP) */
.fp-range   { width: 100%; }
.fp-range-val { margin-left: .5rem; }
.fp-row     { display: flex; align-items: center; gap: .5rem; }
.fp-col     { display: flex; flex-direction: column; gap: .25rem; margin-top: .25rem; }
.fp-muted   { color: var(--text-muted); font-style: italic; }
.fp-small   { color: var(--text-muted); font-size: .85em; }
