/*
 * Votons — Notices et aides modifiables (3.20.0).
 * 1. Textes et liens « Modifier ce texte » (back-office et console front).
 * 2. Page d'administration « Notices et aides ».
 */

/* ============================================================
 * 1. Textes affichés et liens de modification
 * ============================================================ */

.cfdtvote-help-text > :first-child { margin-top: 0; }
.cfdtvote-help-text > :last-child { margin-bottom: 0; }
.cfdtvote-help-text p { margin: 0 0 .6em; }
.cfdtvote-help-text ul,
.cfdtvote-help-text ol { margin: .3em 0 .6em 1.4em; }

.cfdtvote-help-edit {
    margin: 6px 0 0;
    text-align: right;
    font-size: 12px;
    line-height: 1.4;
}

.cfdtvote-help-edit-link,
.cfdtvote-help-edit-icon {
    color: #6b7280;
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
    opacity: .85;
}

.cfdtvote-help-edit-link:hover,
.cfdtvote-help-edit-link:focus,
.cfdtvote-help-edit-icon:hover,
.cfdtvote-help-edit-icon:focus {
    color: #2271b1;
    opacity: 1;
}

.cfdtvote-help-edit-icon {
    display: inline-block;
    margin-left: 4px;
    border-bottom: 0;
    font-size: .9em;
}

.cfdtvote-help-edit-sep { color: #9ca3af; }

@media print {
    .cfdtvote-help-edit,
    .cfdtvote-help-edit-icon { display: none !important; }
}

/* ============================================================
 * 2. Page « Notices et aides »
 * ============================================================ */

.cfdtvote-help {
    --help-border: #dcdcde;
    --help-soft: #f6f7f7;
    --help-accent: #2271b1;
    --help-custom: #2e7d32;
    --help-custom-bg: #edf7ee;
    --help-warn: #b45309;
    --help-warn-bg: #fff7ed;
    max-width: 1400px;
}

.cfdtvote-help-intro {
    background: #fff;
    border: 1px solid var(--help-border);
    border-left: 4px solid var(--help-accent);
    border-radius: 6px;
    padding: 12px 16px;
    margin: 16px 0;
}

.cfdtvote-help-intro p { margin: .3em 0; font-size: 13px; }

.cfdtvote-help-inline-demo {
    color: #6b7280;
    border-bottom: 1px dotted currentColor;
    font-size: 12px;
}

/* Cartes de synthèse (filtres rapides) */
.cfdtvote-help-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 14px;
}

.cfdtvote-help-stat {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid var(--help-border);
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.cfdtvote-help-stat strong { font-size: 22px; line-height: 1; }
.cfdtvote-help-stat span { color: #50575e; }
.cfdtvote-help-stat:hover { border-color: var(--help-accent); }
.cfdtvote-help-stat.is-active { border-color: var(--help-accent); box-shadow: 0 0 0 1px var(--help-accent); }
.cfdtvote-help-stat--custom strong { color: var(--help-custom); }
.cfdtvote-help-stat--outdated.has-items { background: var(--help-warn-bg); border-color: #fdba74; }
.cfdtvote-help-stat--outdated.has-items strong { color: var(--help-warn); }

/* Barre d'outils */
.cfdtvote-help-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--help-soft);
    border: 1px solid var(--help-border);
    border-radius: 8px;
    position: sticky;
    top: 32px;
    z-index: 5;
}

.cfdtvote-help-search {
    flex: 1 1 280px;
    min-height: 34px;
    padding: 4px 10px;
    font-size: 14px;
}

.cfdtvote-help-segmented {
    display: inline-flex;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    overflow: hidden;
}

.cfdtvote-help-segmented button {
    border: 0;
    border-right: 1px solid #c3c4c7;
    background: #fff;
    padding: 6px 12px;
    cursor: pointer;
    font: inherit;
}

.cfdtvote-help-segmented button:last-child { border-right: 0; }
.cfdtvote-help-segmented button.is-active { background: var(--help-accent); color: #fff; }

/* Accès rapide aux groupes */
.cfdtvote-help-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0 16px;
}

.cfdtvote-help-jump a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 4px;
    background: #fff;
    border: 1px solid var(--help-border);
    border-radius: 999px;
    text-decoration: none;
    color: #1d2327;
}

.cfdtvote-help-jump a:hover { border-color: var(--help-accent); color: var(--help-accent); }

.cfdtvote-help-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--help-accent);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    flex: 0 0 auto;
}

/* Mise en page principale */
.cfdtvote-help-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1100px) {
    .cfdtvote-help-layout { grid-template-columns: 1fr; }
}

.cfdtvote-help-group {
    background: #fff;
    border: 1px solid var(--help-border);
    border-radius: 8px;
    margin: 0 0 16px;
    scroll-margin-top: 110px;
}

.cfdtvote-help-group > summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
}

.cfdtvote-help-group > summary::-webkit-details-marker { display: none; }
.cfdtvote-help-group > summary::after { content: '▾'; margin-left: 4px; color: #787c82; }
.cfdtvote-help-group:not([open]) > summary::after { content: '▸'; }
.cfdtvote-help-group[open] > summary { border-bottom: 1px solid var(--help-border); }

.cfdtvote-help-group-title { flex: 1; font-size: 15px; font-weight: 600; }
.cfdtvote-help-group-title small { display: block; font-weight: 400; color: #646970; font-size: 12px; margin-top: 2px; }
.cfdtvote-help-group-count { color: #646970; font-size: 12px; white-space: nowrap; }

.cfdtvote-help-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
    padding: 14px;
}

.cfdtvote-help-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--help-border);
    border-left: 4px solid #c3c4c7;
    border-radius: 6px;
    background: #fff;
}

.cfdtvote-help-card.is-custom { border-left-color: var(--help-custom); }
.cfdtvote-help-card.is-outdated { border-left-color: var(--help-warn); background: #fffbf5; }
.cfdtvote-help-card:hover { box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }

.cfdtvote-help-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.cfdtvote-help-card h3 { margin: 0; font-size: 14px; line-height: 1.35; }
.cfdtvote-help-card h3 a { text-decoration: none; }

.cfdtvote-help-where { margin: 0; color: #50575e; font-size: 12px; }

.cfdtvote-help-excerpt {
    margin: 0;
    color: #3c434a;
    font-size: 13px;
    line-height: 1.45;
    flex: 1;
}

.cfdtvote-help-card footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.cfdtvote-help-card-meta { color: #787c82; font-size: 12px; }
.cfdtvote-help-card-actions { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.cfdtvote-help-view-link { font-size: 12px; text-decoration: none; }

.cfdtvote-help-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    background: #f0f0f1;
    color: #50575e;
}

.cfdtvote-help-badge--custom { background: var(--help-custom-bg); color: var(--help-custom); }
.cfdtvote-help-badge--outdated { background: var(--help-warn-bg); color: var(--help-warn); }

.cfdtvote-help-empty {
    padding: 24px;
    text-align: center;
    color: #646970;
    background: #fff;
    border: 1px dashed var(--help-border);
    border-radius: 8px;
}

/* Colonne latérale */
.cfdtvote-help-aside { position: sticky; top: 100px; }
.cfdtvote-help-aside .cfdtvote-panel {
    background: #fff;
    border: 1px solid var(--help-border);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 0 0 14px;
}
.cfdtvote-help-aside h2 { font-size: 14px; margin: 0 0 8px; }
.cfdtvote-help-aside .description { font-size: 12px; }
.cfdtvote-help-import input[type="file"] { display: block; margin: 6px 0; max-width: 100%; }
.cfdtvote-help-switch { display: flex; gap: 6px; align-items: flex-start; font-weight: 600; }
.cfdtvote-help-danger { border-color: #f0b8b8 !important; }
.cfdtvote-help-danger h2 { color: #b32d2e; }

@media (max-width: 1100px) {
    .cfdtvote-help-aside { position: static; }
}

/* ---------- Page de modification ---------- */
.cfdtvote-help-editor-page { max-width: 1000px; }

.cfdtvote-help-breadcrumb { margin: 16px 0 8px; font-size: 13px; }
.cfdtvote-help-breadcrumb a { text-decoration: none; }
.cfdtvote-help-breadcrumb span[aria-hidden] { color: #a7aaad; margin: 0 4px; }

.cfdtvote-help-edit-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin: 8px 0 14px;
}

.cfdtvote-help-edit-head h2 { margin: 0 0 4px; font-size: 20px; }
.cfdtvote-help-edit-head .cfdtvote-help-where { font-size: 13px; max-width: 700px; }
.cfdtvote-help-edit-head-links { display: flex; gap: 12px; flex-wrap: wrap; }

.cfdtvote-help-item {
    background: #fff;
    border: 1px solid var(--help-border);
    border-left: 4px solid #c3c4c7;
    border-radius: 8px;
    padding: 14px 16px;
    margin: 0 0 14px;
    scroll-margin-top: 60px;
}

.cfdtvote-help-item--custom { border-left-color: var(--help-custom); }
.cfdtvote-help-item--outdated { border-left-color: var(--help-warn); }
.cfdtvote-help-item.is-dirty { border-left-color: var(--help-accent); }
.cfdtvote-help-item.is-target { box-shadow: 0 0 0 2px var(--help-accent); animation: cfdtvote-help-flash 2s ease-out 1; }

@keyframes cfdtvote-help-flash {
    0% { background: #e7f1fb; }
    100% { background: #fff; }
}

.cfdtvote-help-item.is-compact { padding: 10px 14px; margin-bottom: 10px; }

.cfdtvote-help-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.cfdtvote-help-item-head h3 { margin: 0; font-size: 14px; flex: 0 1 auto; }
.cfdtvote-help-dirty { color: var(--help-accent); font-size: 12px; font-weight: 600; }

.cfdtvote-help-meta { margin: 0 0 6px; color: #646970; font-size: 12px; }

.cfdtvote-help-alert {
    margin: 0 0 10px;
    padding: 8px 12px;
    background: var(--help-warn-bg);
    border: 1px solid #fdba74;
    border-radius: 6px;
    color: #7c2d12;
    font-size: 13px;
}

.cfdtvote-help-format-note { margin: 4px 0 0; color: #787c82; font-size: 12px; }
.cfdtvote-help-plain,
.cfdtvote-help-item[data-help-format="inline"] .wp-editor-area {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.55;
    padding: 8px 10px;
    resize: vertical;
    box-sizing: border-box;
    width: 100%;
}

.cfdtvote-help-item.is-compact .is-compact-hidden { display: none; }
.cfdtvote-help-item.is-compact .cfdtvote-help-item-head { margin-bottom: 4px; }
.cfdtvote-help-variants { margin: 4px 0 8px 1.4em; list-style: disc; font-size: 12px; color: #50575e; }

.cfdtvote-help-origin { margin-top: 10px; }
.cfdtvote-help-origin > summary { cursor: pointer; color: var(--help-accent); font-size: 13px; }
.cfdtvote-help-origin-render {
    margin: 8px 0;
    padding: 10px 12px;
    background: var(--help-soft);
    border: 1px dashed #c3c4c7;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    overflow-x: auto;
}

.cfdtvote-help-origin-render > :first-child { margin-top: 0; }
.cfdtvote-help-origin-render > :last-child { margin-bottom: 0; }
.cfdtvote-help-origin-render table { border-collapse: collapse; width: 100%; }
.cfdtvote-help-origin-render th,
.cfdtvote-help-origin-render td { border: 1px solid #dcdcde; padding: 4px 6px; text-align: left; vertical-align: top; }

.cfdtvote-help-item-options { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; }
.cfdtvote-help-item-options:empty { display: none; }
.cfdtvote-help-item-options label { font-size: 13px; }

.cfdtvote-help-savebar {
    position: sticky;
    bottom: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
    margin: 16px 0;
    background: #fff;
    border: 1px solid var(--help-border);
    border-radius: 8px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, .06);
}

.cfdtvote-help-savebar-status { color: var(--help-accent); font-weight: 600; }
.cfdtvote-help-savebar-tip { margin-left: auto; color: #787c82; font-size: 12px; }

.cfdtvote-help-prevnext {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 30px;
}

.cfdtvote-help-prevnext a { text-decoration: none; }
