/* ============================================================
   Admin - barre d'edition flottante et boutons sur pages doc
   ============================================================ */

.admin-edit-bar {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 9000;
    display: flex;
    gap: 0.5rem;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    font-size: 0.85rem;
}

.admin-edit-bar button {
    border: none;
    border-radius: 6px;
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    color: #fff;
}

.admin-edit-bar button:hover {
    transform: translateY(-1px);
}

.admin-edit-btn-edit {
    background: #8b5cf6;
}

.admin-edit-btn-edit:hover {
    background: #7c3aed;
}

.admin-edit-btn-save {
    background: #10b981;
}

.admin-edit-btn-save:hover {
    background: #059669;
}

.admin-edit-btn-cancel {
    background: #6b7280;
}

.admin-edit-btn-cancel:hover {
    background: #4b5563;
}

.admin-edit-btn-meta {
    background: #3b82f6;
}

.admin-edit-btn-meta:hover {
    background: #2563eb;
}

.admin-edit-btn-delete {
    background: #ef4444;
}

.admin-edit-btn-delete:hover {
    background: #dc2626;
}

.admin-edit-bar .admin-edit-title-input {
    flex: 1;
    min-width: 220px;
    padding: 0.45rem 0.65rem;
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 6px;
    background: #0f0f1e;
    color: var(--text-primary, #e5e7eb);
    font-size: 0.85rem;
    font-weight: 600;
}

.admin-edit-status {
    font-size: 0.78rem;
    color: #a78bfa;
    align-self: center;
    padding: 0 0.5rem;
}

.admin-edit-status.success { color: #10b981; }
.admin-edit-status.error   { color: #ef4444; }

/* Wrapper TinyMCE - on lui donne un fond clair pour preserver les couleurs */
.admin-tinymce-container {
    margin-bottom: 1rem;
}

/* Quand l'edition est active, on cache le h3 d'origine puisque le titre passe par l'input */
.admin-editing .card-header { display: none; }

/* ============================================================
   THEME CLAIR - overrides pour modales et barre d'edition admin
   ============================================================ */

/* --- Modales admin (login, panneau, changement mdp, creation doc) --- */
[data-theme="light"] #adminLoginModal,
[data-theme="light"] #adminPanelModal,
[data-theme="light"] #adminChangePwdModal,
[data-theme="light"] #adminMetaModal,
[data-theme="light"] #adminCreateDocModal {
    background: rgba(15, 23, 42, 0.45) !important;
}

[data-theme="light"] #adminLoginModal > div,
[data-theme="light"] #adminPanelModal > div,
[data-theme="light"] #adminChangePwdModal > div,
[data-theme="light"] #adminMetaModal,
[data-theme="light"] #adminCreateDocModal > div {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.1) !important;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.18) !important;
}

[data-theme="light"] #adminLoginModal h3,
[data-theme="light"] #adminPanelModal h3,
[data-theme="light"] #adminChangePwdModal h3,
[data-theme="light"] #adminMetaModal,
[data-theme="light"] #adminCreateDocModal h3 {
    color: #0f172a !important;
}

[data-theme="light"] #adminLoginModal > div > div:first-child,
[data-theme="light"] #adminPanelModal > div > div:first-child,
[data-theme="light"] #adminChangePwdModal > div > div:first-child,
[data-theme="light"] #adminMetaModal,
[data-theme="light"] #adminCreateDocModal > div > div:first-child {
    border-bottom-color: rgba(15, 23, 42, 0.1) !important;
}

[data-theme="light"] #adminLoginModal label,
[data-theme="light"] #adminChangePwdModal label,
[data-theme="light"] #adminMetaModal,
[data-theme="light"] #adminCreateDocModal label,
[data-theme="light"] #adminPanelModal p {
    color: rgba(15, 23, 42, 0.7) !important;
}

[data-theme="light"] #adminMetaModal,
[data-theme="light"] #adminCreateDocModal span {
    color: rgba(15, 23, 42, 0.55) !important;
}

[data-theme="light"] #adminLoginModal input,
[data-theme="light"] #adminChangePwdModal input,
[data-theme="light"] #adminMetaModal,
[data-theme="light"] #adminCreateDocModal input {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.15) !important;
    color: #0f172a !important;
}

[data-theme="light"] #adminLoginModal input:focus,
[data-theme="light"] #adminChangePwdModal input:focus,
[data-theme="light"] #adminMetaModal,
[data-theme="light"] #adminCreateDocModal input:focus {
    border-color: rgba(99, 102, 241, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
    outline: none;
}

[data-theme="light"] #adminPanelModal button[onclick*="adminChangePwdModal"] {
    background: rgba(15, 23, 42, 0.04) !important;
    border-color: rgba(15, 23, 42, 0.12) !important;
    color: #0f172a !important;
}

[data-theme="light"] #adminPanelModal button[onclick*="adminChangePwdModal"]:hover {
    background: rgba(15, 23, 42, 0.08) !important;
}

/* Bouton fermer (croix) en haut a droite */
[data-theme="light"] #adminLoginModal button[onclick*="display='none'"],
[data-theme="light"] #adminPanelModal button[onclick*="display='none'"],
[data-theme="light"] #adminChangePwdModal button[onclick*="display='none'"],
[data-theme="light"] #adminMetaModal,
[data-theme="light"] #adminCreateDocModal button[onclick*="display='none'"] {
    color: rgba(15, 23, 42, 0.55) !important;
}

[data-theme="light"] #adminLoginModal button[onclick*="display='none'"]:hover,
[data-theme="light"] #adminPanelModal button[onclick*="display='none'"]:hover,
[data-theme="light"] #adminChangePwdModal button[onclick*="display='none'"]:hover,
[data-theme="light"] #adminMetaModal,
[data-theme="light"] #adminCreateDocModal button[onclick*="display='none'"]:hover {
    color: #0f172a !important;
}

/* --- Bouton cadenas dans le footer --- */
[data-theme="light"] .admin-icon-btn {
    border-color: rgba(15, 23, 42, 0.15);
    color: rgba(15, 23, 42, 0.65);
}

[data-theme="light"] .admin-icon-btn:hover {
    background: rgba(139, 92, 246, 0.12);
    color: #6d28d9;
    border-color: rgba(139, 92, 246, 0.45);
}

[data-theme="light"] .admin-icon-btn.admin-icon-on {
    color: #047857;
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.08);
}

/* --- Barre d'edition flottante (page doc en mode admin) --- */
[data-theme="light"] .admin-edit-bar {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(139, 92, 246, 0.35);
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.15);
}

[data-theme="light"] .admin-edit-bar .admin-edit-title-input {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.15);
    color: #0f172a;
}

[data-theme="light"] .admin-edit-bar .admin-edit-title-input:focus {
    border-color: rgba(99, 102, 241, 0.55);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    outline: none;
}

[data-theme="light"] .admin-edit-status {
    color: #6d28d9;
}

/* Bandeau "mot de passe temporaire" (jaune) en mode clair */
[data-theme="light"] #adminChangePwdModal p[style*="#fbbf24"] {
    background: rgba(245, 158, 11, 0.12) !important;
    border-color: rgba(245, 158, 11, 0.35) !important;
    color: #92400e !important;
}

/* Boite d'erreur login en mode clair */
[data-theme="light"] #adminLoginError {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #b91c1c !important;
}
