/* ==========================================================================
   Admin — composants des formulaires du site web (app/templates/admin/components/fields.twig)
   ========================================================================== */

[x-cloak] { display: none !important; }

/* Onglets de langue */
.lang-switch { display: flex; align-items: center; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; flex-wrap: wrap; }
.lang-switch.is-sticky { position: sticky; top: 8px; z-index: 20; box-shadow: var(--shadow-md); }
.lang-tab { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 0; border-radius: 7px; background: transparent; font: 500 13px var(--font); color: var(--muted); cursor: pointer; }
.lang-tab:hover { color: var(--text); }
.lang-tab.is-active { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border), var(--shadow); }
.lang-code { font-weight: 650; }
.lang-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.lang-dot.is-complete { background: var(--success); }
.lang-dot.is-partial { background: #f59e0b; }
.lang-dot.is-missing { background: var(--border-strong); }
.lang-hint { margin-left: auto; padding-right: 8px; }
.lang-chip { display: inline-block; font-size: 10.5px; font-weight: 650; letter-spacing: .04em; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--muted); vertical-align: 1px; margin-left: 4px; }
.lang-status { display: inline-flex; gap: 3px; }
.lang-badge { font-size: 10.5px; font-weight: 650; padding: 1px 5px; border-radius: 5px; background: var(--surface-2); color: #a1a1aa; text-decoration: line-through; }
.lang-badge.is-complete { background: var(--success-soft); color: var(--success); text-decoration: none; }
.lang-badge.is-partial { background: var(--warning-soft); color: var(--warning); text-decoration: none; }
.char-count { float: right; font-weight: 400; font-size: 12px; color: var(--muted); }
.char-count.is-over { color: var(--warning); }
.i18n-inline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* Texte enrichi */
.richtext { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); }
.richtext:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.richtext-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 5px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.rt-btn { border: 0; background: transparent; padding: 4px 8px; border-radius: 6px; font: 500 12.5px var(--font); color: var(--text-2); cursor: pointer; }
.rt-btn:hover { background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.rt-sep { width: 1px; background: var(--border); margin: 3px 4px; }
.richtext-editor { min-height: 180px; max-height: 60vh; overflow-y: auto; padding: 12px 14px; font-size: 14.5px; line-height: 1.65; outline: none; }
.richtext-editor > * + * { margin-top: .7em; }
.richtext-editor p { margin: 0; }
.richtext-editor h2 { font-size: 18px; margin-top: 1em; }
.richtext-editor h3 { font-size: 15px; margin-top: .9em; }
.richtext-editor blockquote { margin: 0; padding-left: 12px; border-left: 3px solid #FFAB3D; font-size: 16px; }
.richtext-editor ul, .richtext-editor ol { margin: 0; padding-left: 22px; }
.richtext-editor a { color: var(--info); }
.richtext-editor:empty::before { content: "Votre texte…"; color: #a1a1aa; }

/* Image unique */
.image-card { display: flex; flex-direction: column; gap: 10px; }
.image-preview { position: relative; max-width: 420px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); cursor: crosshair; border: 1px solid var(--border); }
.image-preview img { display: block; width: 100%; height: 100%; max-height: 320px; object-fit: cover; }
.focal-dot { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(0, 0, 0, .3); pointer-events: none; }
.image-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.image-details { display: flex; flex-direction: column; gap: 6px; max-width: 520px; }
.image-drop, .gallery-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 22px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); color: var(--text-2); cursor: pointer; text-align: center; font-weight: 500; }
.image-drop:hover, .gallery-add:hover { border-color: var(--text); background: var(--surface-2); }
.image-drop.is-busy, .gallery-add.is-busy { opacity: .6; pointer-events: none; }
.image-drop .icon, .gallery-add .icon { width: 22px; height: 22px; color: var(--muted); }

/* Galerie */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.gallery-item { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); cursor: grab; }
.gallery-item.is-editing { outline: 2px solid var(--focus); outline-offset: 2px; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-tools { position: absolute; inset: auto 4px 4px 4px; display: flex; justify-content: center; gap: 3px; opacity: 0; transition: opacity .15s; }
.gallery-item:hover .gallery-tools, .gallery-item:focus-within .gallery-tools, .gallery-item.is-editing .gallery-tools { opacity: 1; }
.gallery-tools .btn { background: rgba(255, 255, 255, .95); padding: 4px; }
.gallery-tools .btn[disabled] { opacity: .4; }
.gallery-add { aspect-ratio: 1; padding: 10px; font-size: 13px; }
.gallery-editor { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.gallery-editor-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }

/* Listes répétables */
.repeater { display: flex; flex-direction: column; gap: 8px; }
.repeater-row { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.repeater-row > input, .repeater-row > select, .repeater-row > .repeater-fields { flex: 1; min-width: 0; }
.repeater-row .repeater-platform { flex: 0 0 170px; }
.repeater-fields { display: flex; flex-direction: column; gap: 6px; }
.repeater-fields .row { display: flex; gap: 6px; }
.repeater-fields .row > * { flex: 1; min-width: 0; }
.repeater-tools { display: flex; gap: 0; flex-shrink: 0; }
.repeater-tools .btn[disabled] { opacity: .35; }
.repeater-add { align-self: flex-start; }
.repeater-empty { color: var(--muted); font-size: 13px; padding: 6px 2px; }

/* Divers */
.publish-toggle { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.seo-box > summary .icon:first-child { color: var(--muted); }
.form-section-title { font-size: 15px; font-weight: 600; margin: 8px 0 -4px; padding-top: 14px; border-top: 1px solid var(--border); }
.form-section-title:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--text); }
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex-shrink: 0; }
.thumb-wide { width: 72px; height: 44px; }

@media (max-width: 720px) {
    .i18n-inline { grid-template-columns: 1fr; }
    .repeater-row { flex-wrap: wrap; }
    .repeater-row .repeater-platform { flex-basis: 100%; }
    .lang-name, .lang-hint { display: none; }
}

/* Vidéos */
.video-poster { flex: 0 0 120px; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; background: var(--surface-3); cursor: pointer; }
.video-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ==========================================================================
   Éditeur : contenu + colonne d'actions à droite (macros side_* de fields.twig)
   ========================================================================== */
.container-wide { max-width: 1400px; margin: 0 auto; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.editor-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.editor-main > * { margin: 0; }
fieldset.editor-main { border: 0; padding: 0; margin: 0; min-width: 0; }
.editor-main > .card + .card { margin-top: 0; }
.editor-main section[id], .editor-main div[id] { scroll-margin-top: 20px; }

.editor-side {
    position: sticky; top: 20px;
    display: flex; flex-direction: column; gap: 12px;
    max-height: calc(100vh - 40px); overflow-y: auto; overscroll-behavior: contain;
    padding: 1px; margin: -1px; /* ombres des panneaux non rognées */
    scrollbar-width: thin;
}
.side-panel {
    display: flex; flex-direction: column; gap: 12px;
    padding: 14px 16px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
fieldset.side-panel { margin: 0; min-width: 0; }
.side-panel p { margin: 0; }
.side-title { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.side-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.side-meta { font-size: 12.5px; color: var(--muted); }
.side-dirty { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--warning); margin-top: -4px; }
.side-dirty::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.side-panel .publish-toggle { padding: 0; border: 0; background: none; align-items: flex-start; }
.side-panel .publish-toggle input, .side-panel .check input { margin-top: 2px; }
.side-panel .check { align-items: flex-start; }
.side-panel .field { gap: 4px; }
.side-panel select, .side-panel input:not([type=checkbox]):not([type=radio]) { width: 100%; }
.side-sep { border: 0; border-top: 1px solid var(--border); margin: 2px -16px; }
.side-danger { background: none; box-shadow: none; border-style: dashed; padding: 10px 12px; }
.side-danger .btn { justify-content: flex-start; color: var(--danger); }
.side-danger .btn:hover { background: var(--danger-soft); color: var(--danger); }

/* Langue (liste verticale) */
.lang-list { flex-direction: column; align-items: stretch; gap: 2px; }
.lang-list .lang-tab { justify-content: flex-start; padding: 8px 10px; }
.lang-list .lang-name { display: inline; }
.lang-list .lang-state { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--muted); }
.lang-list .lang-tab:not(:has(.lang-state)) .lang-dot { margin-left: auto; }

/* Sommaire */
.side-toc { gap: 2px; }
.side-toc .side-title { margin-bottom: 8px; }
.side-toc a { padding: 6px 10px; border-radius: 6px; color: var(--text-2); text-decoration: none; font-weight: 500; }
.side-toc a:hover { background: var(--surface-2); color: var(--text); }
.side-toc a.is-active { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--text); }

/* Barre collante (écran étroit) */
.editor-bar { display: none; }

@media (max-width: 1199px) {
    .editor { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .editor-side { position: static; max-height: none; overflow: visible; }
    .editor-side .side-wide { display: none; }
    .editor-bar {
        display: flex; align-items: center; justify-content: space-between; gap: 8px;
        position: sticky; bottom: 12px; z-index: 20;
        padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md);
    }
    .editor-bar .lang-switch { border: 0; padding: 0; background: none; }
    .editor-bar .lang-name, .editor-bar .lang-hint { display: none; }
}

/* Suggestions (ville de l'agenda : composant cityField) */
.ac { position: relative; }
.ac-list {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
    margin: 0; padding: 4px; list-style: none; max-height: 300px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
}
.ac-list li { display: flex; align-items: baseline; gap: 8px; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.ac-list li.is-active { background: var(--surface-2); }
.ac-main { font-weight: 500; }
.ac-other { color: var(--muted); }
.ac-dep { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
