/**
 * CMS Pages v3 — coquille minimale (layout seulement).
 * Le contenu éditorial porte ses propres styles inline / <style> locaux.
 */
.cp-page--v3 {
    --cp-shell-max: 1100px;
    --cp-shell-pad: 16px;
    --cp-shell-text: #0f172a;
    --cp-shell-muted: #64748b;
    --cp-shell-border: #e2e8f0;
    color: var(--cp-shell-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    box-sizing: border-box;
}

.cp-page--v3 *,
.cp-page--v3 *::before,
.cp-page--v3 *::after {
    box-sizing: inherit;
}

.cp-page--v3.cp-page--preview {
    outline: 3px dashed #f59e0b;
    outline-offset: 4px;
}

.cp-page--v3 .cp-shell {
    max-width: var(--cp-shell-max);
    margin: 0 auto;
    padding: var(--cp-shell-pad);
}

.cp-page--v3 .cp-zone {
    width: 100%;
    position: relative;
}

.cp-page--v3 .cp-zone--hero:hover .cp-v3-zone-edit,
.cp-page--v3 .cp-zone--body:hover .cp-v3-zone-edit,
.cp-page--v3 .cp-zone--footer:hover .cp-v3-zone-edit,
.cp-v3-zone-edit:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

/* Bouton d'édition par zone (coin supérieur droit) */
.cp-v3-zone-edit {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    color: #fff !important;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.cp-v3-zone-edit::before {
    content: "✎";
    font-size: 11px;
    opacity: 0.85;
}

.cp-v3-zone-edit:hover {
    background: #0e7490 !important;
    transform: translateY(-1px);
    text-decoration: none !important;
}

.cp-v3-zone-empty {
    margin: 0;
    padding: 20px;
    border: 2px dashed var(--cp-shell-border);
    border-radius: 10px;
    color: var(--cp-shell-muted);
    font-size: 14px;
    text-align: center;
    background: #f8fafc;
}

/* Barre flottante — accès rapide aux 3 zones (admin privilège 1) */
.cp-v3-admin-dock {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99990;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(280px, calc(100vw - 32px));
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #f8fafc;
    font-size: 13px;
}

.cp-v3-admin-dock__head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.cp-v3-admin-dock__title {
    font-weight: 700;
    font-size: 13px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-v3-admin-dock__status {
    font-size: 11px;
    color: #94a3b8;
}

.cp-v3-admin-dock__actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.cp-v3-admin-dock__btn--text-edit {
    grid-column: 1 / -1;
    cursor: pointer;
    font-family: inherit;
}

.cp-v3-admin-dock__btn--text-edit.cp-v3-admin-dock__btn--active {
    background: #0891b2 !important;
    border-color: #06b6d4 !important;
}

.cp-v3-admin-dock__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 6px;
    border-radius: 8px;
    text-decoration: none !important;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #f8fafc !important;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.cp-v3-admin-dock__btn:hover {
    background: #0e7490 !important;
    border-color: #0891b2 !important;
    text-decoration: none !important;
}

.cp-page--v3.cp-page--printer .cp-v3-admin-dock__btn:hover,
.cp-page--v3.cp-page--printer .cp-v3-zone-edit:hover {
    background: #1e3a5f !important;
    border-color: #334155 !important;
}

.cp-page--v3 .cp-zone--hero {
    margin-bottom: 20px;
}

.cp-page--v3 .cp-zone--body {
    min-height: 120px;
}

.cp-page--v3 .cp-zone--footer {
    margin-top: 28px;
    padding-top: 8px;
}

/* Fil d'Ariane minimal */
.cp-page--v3 .cp-shell-breadcrumb {
    max-width: var(--cp-shell-max);
    margin: 0 auto 12px;
    padding: 0 var(--cp-shell-pad);
    font-size: 13px;
}

.cp-page--v3 .cp-shell-breadcrumb__list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    color: var(--cp-shell-muted);
}

.cp-page--v3 .cp-shell-breadcrumb__list a {
    color: #0e7490;
    text-decoration: none;
}

.cp-page--v3 .cp-shell-breadcrumb__list a:hover {
    text-decoration: underline;
}

/* Ne pas imposer de soulignement hover sur les pages CMS v3
   (le contenu gère ses styles, et le site global souligne les liens) */
.cp-page--v3 a:hover,
.cp-page--v3 a:focus,
.cp-page--v3 a:focus-visible {
    text-decoration: none !important;
}

.cp-page--v3 .cp-shell-breadcrumb__current {
    color: var(--cp-shell-text);
    font-weight: 600;
}

/* Thème NFC — accent coquille uniquement */
.cp-page--v3.cp-page--nfc {
    --cp-accent: #0e7490;
}

/* Thème imprimante */
.cp-page--v3.cp-page--printer {
    --cp-accent: #1e3a5f;
}

/* Mode édition texte inline */
.cp-page--v3.cp-v3-text-edit-active .cp-v3-zone-edit {
    display: none !important;
}

.cp-v3-text-editable-hover {
    outline: 2px dashed rgba(14, 116, 144, 0.55) !important;
    outline-offset: 2px;
    cursor: text;
}

.cp-v3-text-editing {
    outline: 2px solid #0e7490 !important;
    outline-offset: 2px;
    background: rgba(224, 242, 254, 0.35);
}

.cp-v3-text-editing td,
.cp-v3-text-editing th,
td.cp-v3-text-editing,
th.cp-v3-text-editing {
    background: rgba(224, 242, 254, 0.5) !important;
}

.cp-v3-text-editable-hover td,
.cp-v3-text-editable-hover th,
td.cp-v3-text-editable-hover,
th.cp-v3-text-editable-hover {
    background: rgba(224, 242, 254, 0.25);
}

.cp-v3-compat-readonly {
    pointer-events: none;
    user-select: none;
    opacity: 0.92;
}

.cp-v3-compat-readonly-badge {
    margin: 0 0 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #0c4a6e;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
}

.cp-v3-text-toolbar {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    z-index: 99991;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
    transition: transform 0.22s ease;
    max-width: calc(100vw - 24px);
}

.cp-v3-text-toolbar--visible {
    transform: translateX(-50%) translateY(0);
}

.cp-v3-text-toolbar__label {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    margin-right: 4px;
}

.cp-v3-text-toolbar__btn {
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.cp-v3-text-toolbar__btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.16);
}

.cp-v3-text-toolbar__btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.cp-v3-text-toolbar__btn--primary {
    background: #0e7490;
    border-color: #0891b2;
}

.cp-v3-text-toolbar__btn--primary:hover:not(:disabled) {
    background: #0891b2;
}

@media (max-width: 640px) {
    .cp-page--v3 .cp-shell {
        padding: 12px;
    }

    .cp-v3-admin-dock {
        bottom: 12px;
        right: 12px;
        left: 12px;
        max-width: none;
    }

    .cp-v3-zone-edit {
        opacity: 1;
        pointer-events: auto;
        top: 6px;
        right: 6px;
        padding: 5px 10px;
        font-size: 11px;
    }
}
