/* RM – Ruban Musical : interface d'administration */

.rmrm-admin {
    --rmrm-accent: #6C5CE7;
    --rmrm-accent-d: #5646c9;
    --rmrm-ink: #2b2b3a;
    --rmrm-muted: #6b6b7b;
    --rmrm-line: #e4e4ee;
    --rmrm-soft: #f6f5fc;
    --rmrm-danger: #d64545;

    color: var(--rmrm-ink);
    max-width: 780px;
    margin: 0 auto;
    font-family: inherit;
}

.rmrm-admin *,
.rmrm-admin *::before,
.rmrm-admin *::after { box-sizing: border-box; }

.rmrm-admin-head { margin-bottom: 1.2rem; }
.rmrm-admin-h {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--rmrm-accent);
    margin: 0 0 .3rem;
}
.rmrm-admin-sub {
    color: var(--rmrm-muted);
    margin: 0;
    font-size: .95rem;
}

.rmrm-admin-notice {
    max-width: 720px;
    margin: 1rem auto;
    padding: 1rem 1.2rem;
    background: #fff6f6;
    border: 1px solid #f2caca;
    border-radius: 12px;
    color: #a23a3a;
}

.rmrm-admin-label {
    display: block;
    font-weight: 700;
    font-size: .85rem;
    margin-bottom: .35rem;
    color: var(--rmrm-ink);
}

.rmrm-admin-input,
.rmrm-admin-field {
    width: 100%;
    padding: .6rem .7rem;
    border: 1px solid var(--rmrm-line);
    border-radius: 10px;
    font-size: .95rem;
    font-family: inherit;
    color: var(--rmrm-ink);
    background: #fff;
}
.rmrm-admin-input:focus,
.rmrm-admin-field:focus {
    outline: none;
    border-color: var(--rmrm-accent);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, .15);
}

.rmrm-admin-titre-wrap { margin-bottom: 1.3rem; }

/* --- Zones (blocs) --- */

.rmrm-blocs { display: flex; flex-direction: column; gap: 1rem; }

.rmrm-bloc-edit {
    border: 1px solid var(--rmrm-line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(40, 30, 90, .05);
    overflow: hidden;
}

.rmrm-bloc-edit-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .8rem;
    background: var(--rmrm-soft);
    border-bottom: 1px solid var(--rmrm-line);
}
.rmrm-bloc-edit-label {
    font-weight: 700;
    font-size: .8rem;
    color: var(--rmrm-muted);
    letter-spacing: .3px;
    text-transform: uppercase;
    flex: 1 1 auto;
}

.rmrm-bloc-edit-body { padding: .9rem; display: flex; flex-direction: column; gap: .8rem; }

/* Boutons ronds d'ordre / suppression */
.rmrm-iconbtn {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--rmrm-line);
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    color: var(--rmrm-muted);
    padding: 0;
    transition: background .12s, border-color .12s, color .12s;
}
.rmrm-iconbtn:hover { border-color: var(--rmrm-accent); color: var(--rmrm-accent); }
.rmrm-iconbtn svg { width: 14px; height: 14px; display: block; }
.rmrm-iconbtn[disabled] { opacity: .35; cursor: default; }
.rmrm-iconbtn.is-danger:hover { border-color: var(--rmrm-danger); color: var(--rmrm-danger); }
.rmrm-iconbtn.is-armed {
    background: var(--rmrm-danger);
    border-color: var(--rmrm-danger);
    color: #fff;
    width: auto;
    padding: 0 .55rem;
    font-size: .78rem;
    font-weight: 700;
    gap: .3rem;
}

/* --- Éditeur de texte --- */

.rmrm-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin-bottom: .35rem;
}
.rmrm-tbbtn {
    border: 1px solid var(--rmrm-line);
    background: #fff;
    border-radius: 7px;
    padding: .28rem .5rem;
    font-size: .82rem;
    cursor: pointer;
    color: var(--rmrm-ink);
    min-width: 30px;
    font-family: inherit;
}
.rmrm-tbbtn:hover { background: var(--rmrm-soft); border-color: var(--rmrm-accent); }
.rmrm-tbbtn b { font-weight: 800; }
.rmrm-tbbtn i { font-style: italic; }
.rmrm-tbbtn u { text-decoration: underline; }

.rmrm-editor {
    min-height: 110px;
    border: 1px solid var(--rmrm-line);
    border-radius: 10px;
    padding: .65rem .75rem;
    font-size: .95rem;
    line-height: 1.5;
    background: #fff;
}
.rmrm-editor:focus { outline: none; border-color: var(--rmrm-accent); box-shadow: 0 0 0 3px rgba(108, 92, 231, .15); }
.rmrm-editor:empty::before {
    content: attr(data-placeholder);
    color: #a9a9b8;
}
.rmrm-editor p { margin: 0 0 .5rem; }
.rmrm-editor ul, .rmrm-editor ol { margin: .3rem 0 .5rem; padding-left: 1.3rem; }

/* --- Fichiers --- */

.rmrm-files-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}
.rmrm-files-title { font-weight: 700; font-size: .85rem; color: var(--rmrm-ink); }

.rmrm-files-list { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }

.rmrm-file-row {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    border: 1px solid var(--rmrm-line);
    border-radius: 10px;
    padding: .55rem .6rem;
    background: var(--rmrm-soft);
}
.rmrm-file-badge {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .58rem;
    font-weight: 800;
    color: #fff;
    background: #8a8a9c;
    margin-top: 2px;
}
.rmrm-file-badge.is-pdf  { background: #e0564f; }
.rmrm-file-badge.is-doc  { background: #2f6fed; }
.rmrm-file-badge.is-xls  { background: #1f9d55; }
.rmrm-file-badge.is-ppt  { background: #e08a2f; }
.rmrm-file-badge.is-img  { background: #8b5cf6; }
.rmrm-file-badge.is-zip  { background: #6b7280; }

.rmrm-file-fields { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .35rem; }
.rmrm-file-fields .rmrm-admin-field { padding: .4rem .55rem; font-size: .88rem; }
.rmrm-file-name { font-size: .74rem; color: var(--rmrm-muted); overflow-wrap: anywhere; }
.rmrm-file-tools { display: flex; flex-direction: column; gap: .3rem; }

/* --- Boutons génériques --- */

.rmrm-btn {
    font-family: inherit;
    font-size: .92rem;
    font-weight: 700;
    border-radius: 10px;
    padding: .6rem 1rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .12s, box-shadow .12s, border-color .12s;
}
.rmrm-btn-primary { background: var(--rmrm-accent); color: #fff; }
.rmrm-btn-primary:hover { background: var(--rmrm-accent-d); }
.rmrm-btn-ghost { background: #fff; color: var(--rmrm-accent); border-color: var(--rmrm-accent); }
.rmrm-btn-ghost:hover { background: var(--rmrm-soft); }
.rmrm-btn-add {
    background: #fff;
    color: var(--rmrm-accent);
    border: 1px dashed var(--rmrm-accent);
    width: 100%;
    padding: .8rem;
}
.rmrm-btn-add:hover { background: var(--rmrm-soft); }
.rmrm-btn-small {
    font-size: .82rem;
    padding: .4rem .7rem;
    background: #fff;
    color: var(--rmrm-accent);
    border: 1px solid var(--rmrm-accent);
}
.rmrm-btn-small:hover { background: var(--rmrm-soft); }

.rmrm-admin-actions-add { margin: 1rem 0; }

.rmrm-admin-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .8rem 0;
    background: linear-gradient(to top, #fff 70%, rgba(255,255,255,0));
    margin-top: .5rem;
}
.rmrm-admin-status { font-size: .88rem; color: var(--rmrm-muted); }
.rmrm-admin-status.is-ok { color: #1f9d55; font-weight: 700; }
.rmrm-admin-status.is-err { color: var(--rmrm-danger); font-weight: 700; }

.rmrm-empty-hint {
    text-align: center;
    color: var(--rmrm-muted);
    font-size: .9rem;
    padding: 1rem;
    border: 1px dashed var(--rmrm-line);
    border-radius: 12px;
    background: var(--rmrm-soft);
}

/* --- Modale d'aperçu --- */

.rmrm-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.rmrm-modal[hidden] { display: none; }
.rmrm-modal-backdrop { position: absolute; inset: 0; background: rgba(20, 16, 40, .5); }
.rmrm-modal-box {
    position: relative;
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 760px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(20, 16, 40, .35);
}
.rmrm-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .8rem 1.1rem;
    border-bottom: 1px solid var(--rmrm-line);
}
.rmrm-modal-title { font-weight: 800; color: var(--rmrm-ink); }
.rmrm-modal-x {
    border: none;
    background: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--rmrm-muted);
}
.rmrm-modal-x:hover { color: var(--rmrm-ink); }
.rmrm-modal-body { padding: 1.2rem; overflow: auto; background: #faf9ff; }

@media (max-width: 560px) {
    .rmrm-admin-bar { flex-wrap: wrap; }
    .rmrm-file-row { flex-wrap: wrap; }
}

/* --- Visibilité + compteur par fichier --- */
.rmrm-file-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem .9rem;
    margin-top: .1rem;
}
.rmrm-file-vis {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .78rem;
    color: var(--rmrm-muted);
    font-weight: 600;
}
.rmrm-file-select {
    font-family: inherit;
    font-size: .82rem;
    padding: .3rem .5rem;
    border: 1px solid var(--rmrm-line);
    border-radius: 8px;
    background: #fff;
    color: var(--rmrm-ink);
}
.rmrm-file-select:focus { outline: none; border-color: var(--rmrm-accent); box-shadow: 0 0 0 3px rgba(108,92,231,.15); }
.rmrm-file-count {
    font-size: .76rem;
    color: var(--rmrm-muted);
    background: var(--rmrm-soft);
    border: 1px solid var(--rmrm-line);
    border-radius: 999px;
    padding: .18rem .55rem;
    font-weight: 600;
}

/* --- Bascule vue admin / visiteur dans l'aperçu --- */
.rmrm-preview-toggle {
    display: inline-flex;
    border: 1px solid var(--rmrm-line);
    border-radius: 999px;
    overflow: hidden;
    margin-left: auto;
    margin-right: .6rem;
}
.rmrm-toggle-btn {
    font-family: inherit;
    font-size: .78rem;
    font-weight: 700;
    border: none;
    background: #fff;
    color: var(--rmrm-muted);
    padding: .34rem .7rem;
    cursor: pointer;
}
.rmrm-toggle-btn.is-active { background: var(--rmrm-accent); color: #fff; }

/* --- Barre d'outils admin --- */
.rmrm-admin-toolbar { margin: 0 0 1.2rem; }

/* --- Modale catégories --- */
.rmrm-modal-box-sm { max-width: 520px; }
.rmrm-cat-list { display: flex; flex-direction: column; gap: .5rem; margin: .8rem 0; }
.rmrm-cat-row {
    display: flex;
    align-items: center;
    gap: .4rem;
}
.rmrm-cat-row .rmrm-admin-field { flex: 1 1 auto; }
.rmrm-cat-add {
    display: flex;
    gap: .5rem;
    align-items: center;
    margin-top: .5rem;
    padding-top: .8rem;
    border-top: 1px solid var(--rmrm-line);
}
.rmrm-cat-add .rmrm-admin-input { flex: 1 1 auto; }
