/*
 * Editor space: screen 5e « Catalogue et fiches d’action »
 * (templates/editor/catalog.html.twig, catalog_new.html.twig), after
 * docs/wireframes/5e-catalogue-et-fiches.html. Colour tokens of app.css only,
 * for the dark theme.
 */

.ecat-layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.ecat-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

/* Connectors column */
.ecat-connectors {
    flex: 1 1 220px; display: flex; flex-direction: column; gap: 4px; padding: 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.ecat-connector {
    min-height: 52px; padding: 6px 12px; border-radius: 8px; display: flex; align-items: center; gap: 10px;
    color: var(--text); text-decoration: none; font-size: 14px;
}
.ecat-connector:hover { background: var(--accent-tint); color: var(--text); }
.ecat-connector[aria-current="true"] { background: var(--selected); color: var(--accent-text); font-weight: 600; }
.ecat-connector-mark {
    width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px; display: flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--accent-text); border: 1px solid var(--accent-border); font-size: 12px; font-weight: 800;
}
.ecat-connector-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ecat-connector-name { overflow-wrap: anywhere; }
.ecat-connector-meta { font-size: 12px; font-weight: 400; color: var(--text-muted); }

/* Connector head */
.ecat-title { display: flex; flex-direction: column; gap: 4px; }
.ecat-title h2 { margin: 0; font-size: 20px; font-weight: 700; }
.ecat-title-meta, .ecat-description { margin: 0; font-size: 14px; color: var(--text-muted); overflow-wrap: anywhere; }
.ecat-description { color: var(--text-soft); }
/* How members connect their account: OAuth scopes are long URLs. */
.ecat-connection { margin: 0; overflow-wrap: anywhere; }
.ecat-main code, .ecat-new code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

.ecat-draft {
    display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
    padding: 14px 16px; border-radius: 12px; border: 1px dashed var(--border-strong); background: var(--surface);
}
.ecat-draft p { flex: 1 1 320px; margin: 0; font-size: 14px; line-height: 1.5; }
.ecat-draft form { margin: 0; }

/* « Changement détecté » on the server's list of tools (App\Editor\ToolListChange). */
.ecat-change-count { color: var(--warning); font-weight: 600; }
.ecat-change {
    display: flex; flex-direction: column; gap: 8px;
    padding: 14px 16px; border-radius: 12px; border: 1px solid var(--warning-border); background: var(--warning-bg); color: var(--text);
}
.ecat-change p { margin: 0; font-size: 14px; line-height: 1.5; }
.ecat-change-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--warning); }
.ecat-change-details { display: flex; flex-direction: column; gap: 10px; }
.ecat-change-tool { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.ecat-change-versions { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; min-width: 0; }
.ecat-change-versions > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 13px; }
.ecat-change-versions .editor-snippet { max-height: 320px; overflow: auto; }
.ecat-change-accept { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 4px 0 0; }

/* Buttons: app.css declares .button after .button--secondary, the secondary look is restated here. */
.ecat-main .button, .ecat-new .button { min-height: 44px; padding: 0 16px; border: none; border-radius: 10px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; gap: 8px; }
.ecat-main .button--secondary, .ecat-new .button--secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.ecat-main .button--secondary:hover, .ecat-new .button--secondary:hover { background: var(--accent-tint); color: var(--text); }
.ecat-main .button:disabled { background: var(--surface); color: var(--text-muted); border: 1px dashed var(--border-strong); cursor: not-allowed; }

/* Actions table */
.ecat-actions .editor-table td { padding-top: 12px; padding-bottom: 12px; vertical-align: middle; }
.ecat-actions .editor-table a { text-decoration: none; }
.ecat-actions .editor-table a:hover code { text-decoration: underline; }
.ecat-row--open { background: var(--selected); }

/* Panels opened by a summary: add an action, change a sheet or a field. */
.ecat-panel { border-top: 1px solid var(--divider); padding-top: 10px; }
.ecat-actions .ecat-panel { margin-top: 4px; }
.ecat-summary {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer;
    font-size: 14px; font-weight: 600; color: var(--text); list-style: none;
}
.ecat-summary::-webkit-details-marker { display: none; }
.ecat-summary--button {
    padding: 0 16px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
}
.ecat-summary--button:hover { background: var(--accent-tint); border-color: var(--accent); }
.ecat-summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* Forms */
.ecat-form { display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 12px 0 4px; }
.ecat-new { gap: 20px; padding: 24px; }
.ecat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 16px; align-items: start; }
.ecat-grid--indent { padding-left: 30px; }
.ecat-input { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ecat-input > label:not(.ecat-check) { font-size: 14px; font-weight: 500; }
.ecat-input input[type="text"], .ecat-input input[type="url"], .ecat-example textarea {
    width: 100%; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 10px;
    background: var(--surface); color: var(--text); font: inherit; font-size: 15px;
}
.ecat-input input[type="text"], .ecat-input input[type="url"] { height: 48px; }
.ecat-input input::placeholder, .ecat-example textarea::placeholder { color: var(--text-muted); }
.ecat-input input:focus-visible, .ecat-example textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.ecat-main [aria-invalid="true"], .ecat-new [aria-invalid="true"] { border-color: var(--danger-border); }
.ecat-choices, .ecat-formula-choice { margin: 0; padding: 0; border: none; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ecat-choices legend, .ecat-formula-choice legend { padding: 0 0 6px; font-size: 14px; font-weight: 500; }
.ecat-formula-choice { gap: 10px; }
.ecat-check { display: flex; gap: 10px; align-items: center; min-height: 32px; font-size: 14px; cursor: pointer; }
.ecat-check input { width: 20px; height: 20px; margin: 0; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }
.ecat-form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.ecat-help { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.ecat-error { font-size: 13px; line-height: 1.4; color: var(--danger); }
.ecat-error p { margin: 0; }
.ecat-muted { color: var(--text-muted); font-weight: 400; }

/* The open sheet */
.ecat-sheet {
    display: flex; flex-direction: column; gap: 4px; padding: 20px 24px; scroll-margin-top: 16px;
    background: var(--surface); border: 2px solid var(--accent); border-radius: 12px;
}
.ecat-sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 8px; }
.ecat-sheet-heading { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ecat-sheet-heading h3 { margin: 0; font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.ecat-overline { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-text); }

.ecat-field { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-top: 1px solid var(--divider); }
.ecat-field-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-height: 36px; padding-right: 110px; }
.ecat-field-label { font-size: 14px; font-weight: 600; }
.ecat-field-name { color: var(--text-muted); }
.ecat-formula {
    display: block; padding: 10px 12px; border-radius: 8px; background: var(--bg);
    overflow-x: auto; white-space: nowrap;
}
/* « Modifier » sits at the right of the field's name; its form opens below the formula. */
.ecat-field-edit > .ecat-summary { position: absolute; top: 12px; right: 0; min-height: 36px; font-size: 13px; }
.ecat-none { margin: 0; padding: 12px 0; border-top: 1px solid var(--divider); font-size: 14px; color: var(--text-soft); }

.ecat-example { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-top: 1px solid var(--divider); scroll-margin-top: 16px; }
.ecat-example .ecat-form { padding: 0; gap: 8px; }
.ecat-example textarea {
    padding: 12px 14px; background: var(--bg); resize: vertical; line-height: 1.6;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px;
}
.ecat-computed { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 8px; font-size: 14px; }
.ecat-computed div { display: flex; gap: 6px; flex-wrap: wrap; }
.ecat-computed dt::after { content: " :"; }
.ecat-computed dd { margin: 0; }
.ecat-failed { color: var(--warning); font-weight: 600; }

.ecat-sheet-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--divider); }
.ecat-sheet-foot .ecat-panel { flex: 0 1 auto; border-top: none; padding-top: 0; }
.ecat-sheet-foot .ecat-panel[open] { flex: 1 1 100%; }
.ecat-sheet-foot > .ecat-help { padding-top: 4px; }
.ecat-sheet > .ecat-help { padding-top: 8px; }

@media (max-width: 520px) {
    .ecat-sheet { padding: 16px; }
    .ecat-grid--indent { padding-left: 0; }
    .ecat-field-head { padding-right: 0; }
    .ecat-field-edit > .ecat-summary { position: static; }
}
