/**
 * Cadenas verrouillage/déverrouillage – pages hyperprofils
 * Logique couleur : ROUGE = verrouillé, VERT = déverrouillé (white + dark mode)
 * Performance: pas d’animation ni @keyframes, une transition courte (0.2s) au hover uniquement,
 * pas de will-change/filter/transform coûteux. Sélecteurs ID prefix, repaint limité au bouton.
 */

/* Wrapper cadenas : largeur = bouton uniquement */
.hyperprofil-lock-wrap {
    width: min-content;
    flex-shrink: 0;
}

.hyperprofil-lock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    margin: 0;
    border-width: 2px;
    border-style: solid;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.hyperprofil-lock-btn .hyperprofil-lock-icon,
.hyperprofil-lock-btn .hyperprofil-unlock-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.hyperprofil-lock-btn .hyperprofil-lock-icon svg,
.hyperprofil-lock-btn .hyperprofil-unlock-icon svg {
    flex-shrink: 0;
    vertical-align: middle;
}

/* Visibilité lock vs unlock */
.hyperprofil-lock-btn--locked .hyperprofil-lock-icon { display: inline-flex; }
.hyperprofil-lock-btn--locked .hyperprofil-unlock-icon { display: none; }
.hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon { display: inline-flex; }
.hyperprofil-lock-btn--unlocked .hyperprofil-lock-icon { display: none; }
.hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg,
.hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg { width: 24px; height: 24px; }

/* ═══════════════════════════════════════════════════════════════════════════
   WHITE MODE — Rouge = verrouillé, Vert = déverrouillé
   ═══════════════════════════════════════════════════════════════════════════ */

body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked {
    background-color: #f8d7da !important;
    border-color: #dc3545 !important;
    color: #721c24 !important;
}
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg,
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg path,
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg rect,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg path,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg rect {
    stroke: #dc3545 !important;
    fill: none !important;
}
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked:hover,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked:hover {
    background-color: #f5c2c7 !important;
    border-color: #b02a37 !important;
}

body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked {
    background-color: #d1e7dd !important;
    border-color: #198754 !important;
    color: #0f5132 !important;
}
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg,
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg path,
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg rect,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg path,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg rect {
    stroke: #198754 !important;
    fill: none !important;
}
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked:hover,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked:hover {
    background-color: #a3cfbb !important;
    border-color: #146c43 !important;
}

/* Bouton Mise à jour — disabled = même BG que cadenas/recherche, texte = couleur placeholder */
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-update-btn:disabled,
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .btn-primary.hyperprofil-update-btn:disabled,
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .eg-swal-report:disabled,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-update-btn:disabled,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .btn-primary.hyperprofil-update-btn:disabled,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .eg-swal-report:disabled {
    color: #e03131 !important;
    background-color: #f8d7da !important;
    border-color: #f1aeb5 !important;
    opacity: 1 !important;
}
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-update-btn:not(:disabled):not(.disabled),
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .btn-primary.hyperprofil-update-btn:not(:disabled):not(.disabled),
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .eg-swal-report:not(:disabled):not(.disabled),
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-update-btn:not(:disabled):not(.disabled),
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .btn-primary.hyperprofil-update-btn:not(:disabled):not(.disabled),
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .eg-swal-report:not(:disabled):not(.disabled) {
    color: #d1e7dd !important;
    background-color: #198754 !important;
    border-color: #198754 !important;
}
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-update-btn:not(:disabled):not(.disabled):hover,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-update-btn:not(:disabled):not(.disabled):hover {
    background-color: #146c43 !important;
    border-color: #146c43 !important;
    color: #d1e7dd !important;
}

/* Champ recherche — disabled = teinte rouge, enabled = teinte verte */
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:disabled,
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] input[type="search"]:disabled,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:disabled,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] input[type="search"]:disabled {
    color: #721c24 !important;
    background-color: #f8d7da !important;
    border-color: #f1aeb5 !important;
    opacity: 1 !important;
}
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:disabled::placeholder,
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] input[type="search"]:disabled::placeholder,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:disabled::placeholder,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] input[type="search"]:disabled::placeholder {
    color: #c92a2a !important;
    opacity: 0.85 !important;
}
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:not(:disabled),
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] input[type="search"]:not(:disabled),
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:not(:disabled),
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] input[type="search"]:not(:disabled) {
    color: #0f5132 !important;
    background-color: #d1e7dd !important;
    border-color: #a3cfbb !important;
}
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:not(:disabled):focus,
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] input[type="search"]:not(:disabled):focus,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:not(:disabled):focus,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] input[type="search"]:not(:disabled):focus {
    border-color: #198754 !important;
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25) !important;
}
body:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:not(:disabled)::placeholder,
html:not(.dark-mode) [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:not(:disabled)::placeholder {
    color: #198754 !important;
    opacity: 0.9 !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DARK MODE — Rouge = verrouillé, Vert = déverrouillé
   ═══════════════════════════════════════════════════════════════════════════ */

.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked {
    background-color: rgba(220, 53, 69, 0.25) !important;
    border-color: #dc3545 !important;
    color: #f8d7da !important;
}
.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg,
.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg path,
.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg rect,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg path,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg rect,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg path,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked .hyperprofil-lock-icon svg rect {
    stroke: #f8d7da !important;
    fill: none !important;
}
.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked:hover,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked:hover,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--locked:hover {
    background-color: rgba(220, 53, 69, 0.4) !important;
    border-color: #f8d7da !important;
}

.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked {
    background-color: rgba(25, 135, 84, 0.25) !important;
    border-color: #198754 !important;
    color: #d1e7dd !important;
}
.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg,
.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg path,
.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg rect,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg path,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg rect,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg path,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked .hyperprofil-unlock-icon svg rect {
    stroke: #75b798 !important;
    fill: none !important;
}
.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked:hover,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked:hover,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-lock-btn--unlocked:hover {
    background-color: rgba(25, 135, 84, 0.4) !important;
    border-color: #75b798 !important;
}

.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-update-btn:disabled,
.dark-mode [id^="hyperprofil_toolbar_"] .btn-primary.hyperprofil-update-btn:disabled,
.dark-mode [id^="hyperprofil_toolbar_"] .eg-swal-report:disabled,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-update-btn:disabled,
html.dark-mode [id^="hyperprofil_toolbar_"] .eg-swal-report:disabled,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-update-btn:disabled,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .eg-swal-report:disabled {
    color: #ffb3b3 !important;
    background-color: #842029 !important;
    border-color: #dc3545 !important;
    opacity: 1 !important;
}
.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-update-btn:not(:disabled):not(.disabled),
.dark-mode [id^="hyperprofil_toolbar_"] .eg-swal-report:not(:disabled):not(.disabled),
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-update-btn:not(:disabled):not(.disabled),
html.dark-mode [id^="hyperprofil_toolbar_"] .eg-swal-report:not(:disabled):not(.disabled),
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-update-btn:not(:disabled):not(.disabled),
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .eg-swal-report:not(:disabled):not(.disabled) {
    color: #fff !important;
    background-color: #198754 !important;
    border-color: #198754 !important;
}
.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-update-btn:not(:disabled):not(.disabled):hover,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-update-btn:not(:disabled):not(.disabled):hover,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-update-btn:not(:disabled):not(.disabled):hover {
    background-color: #146c43 !important;
    border-color: #146c43 !important;
}

.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:disabled,
.dark-mode [id^="hyperprofil_toolbar_"] input[type="search"]:disabled,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:disabled,
html.dark-mode [id^="hyperprofil_toolbar_"] input[type="search"]:disabled,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:disabled,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] input[type="search"]:disabled {
    color: #f8d7da !important;
    background-color: rgba(220, 53, 69, 0.15) !important;
    border-color: rgba(220, 53, 69, 0.5) !important;
    opacity: 1 !important;
}
.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:disabled::placeholder,
.dark-mode [id^="hyperprofil_toolbar_"] input[type="search"]:disabled::placeholder,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:disabled::placeholder,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:disabled::placeholder {
    color: #f1aeb5 !important;
    opacity: 0.9 !important;
}
.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:not(:disabled),
.dark-mode [id^="hyperprofil_toolbar_"] input[type="search"]:not(:disabled),
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:not(:disabled),
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:not(:disabled) {
    color: #e9ecef !important;
    background-color: rgba(0, 0, 0, 0.2) !important;
    border-color: rgba(25, 135, 84, 0.5) !important;
}
.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:not(:disabled):focus,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:not(:disabled):focus,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:not(:disabled):focus {
    border-color: #198754 !important;
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.35) !important;
}
.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:not(:disabled)::placeholder,
html.dark-mode [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:not(:disabled)::placeholder,
[data-bs-theme="dark"] [id^="hyperprofil_toolbar_"] .hyperprofil-search-input:not(:disabled)::placeholder {
    color: #adb5bd !important;
}
