/* ==========================================================================
   Home Drawer – Drawer admin gestion homepage
   ========================================================================== */

div.mce-fullscreen {
    position: fixed;
    bottom: 0;
    top: initial;
    left: 0;
    height: 92vh;
}
/* Drawer principal */
.popup-gestion-home {
    position: fixed;
    top: 9vh;
    right: -900px;
    width: 100%;
    max-width: 900px;
    height: 91vh;
    background: #fff;
    z-index: 9999998;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    border-radius: 20px 0 0 0;
    box-shadow: -2px 0 20px rgba(0,0,0,0.25);
}
.popup-gestion-home.open {
    right: 0;
}
#home-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9999997;
    display: none;
}
#home-overlay.open {
    display: block;
}

/* Header */
.popup-gestion-home .popup-header-edit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #ddd;
    background: #4d74b5;
    border-radius: 20px 0 0 0;
}
.popup-gestion-home .popup-header-edit h4 {
    margin: 0;
    padding: 0 !important;
    font-size: 20px !important;
    color: white !important;
    font-weight: 600 !important;
    font-family: 'Nexa Light' !important;
}
.popup-gestion-home .popup-close {
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    color: white !important;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.popup-gestion-home .popup-close:hover {
    background: white;
    color: #4d74b5 !important;
}

/* Onglets */
.popup-gestion-home .drawer-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    background: #f9f9f9;
}
.popup-gestion-home .drawer-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: "Nexa Light" !important;
    color: #686868 !important;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}
.popup-gestion-home .drawer-tab:hover {
    background: #e9eef0;
}
.popup-gestion-home .drawer-tab.active {
    color: #4d74b5 !important;
    border-bottom-color: #4d74b5;
}
.popup-gestion-home .drawer-tab-content {
    display: none;
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}
.popup-gestion-home .drawer-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Formulaire */
.popup-gestion-home .drawer-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    padding-right: 10px;
}
.popup-gestion-home .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-radius: 10px;
    background-color: #4d74b557;
    padding: 15px;
}
.popup-gestion-home .form-group label {
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
    font-family: 'Nexa Light';
}
.popup-gestion-home .form-group textarea,
.popup-gestion-home .form-group input[type="text"],
.popup-gestion-home .form-group input[type="url"] {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
}
.popup-gestion-home .form-group textarea {
    min-height: 100px;
}
.popup-gestion-home .form-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}
.popup-gestion-home .button-primary {
    background: #00a09a;
    color: white;
    padding: 10px 20px;
    min-width: 30%;
    border: none;
    border-radius: 6px;
    font-family: 'Nexa Light';
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.popup-gestion-home .button-primary:hover {
    background: #008f8a;
}
.popup-gestion-home .button-secondary {
    background: #4d74b5;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-family: 'Nexa Light';
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.popup-gestion-home .button-secondary:hover {
    background: #3d5a8a;
}

/* Liste des partenaires */
.liste-partenaires {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    max-height: 50vh;
    flex: 1;
}
.ligne-partenaire {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
    transition: all 0.2s ease;
    gap: 10px;
}
.ligne-partenaire:hover {
    background: #f0f0f0;
}
.partenaire-thumb {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
    background: #f5f5f5;
}
.partenaire-thumb-placeholder {
    width: 40px;
    height: 40px;
    background: #e0e0e0;
    border-radius: 4px;
}
.titre-partenaire {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
}
.btn-view-partenaire,
.btn-edit-partenaire,
.btn-delete-partenaire {
    padding: 8px;
    border: none !important;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-view-partenaire img,
.btn-edit-partenaire img,
.btn-delete-partenaire img {
    width: 20px;
    height: auto;
}
.compteur-partenaires {
    padding: 15px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Formulaire partenaire */
.form-partenaire {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
    margin-top: 15px;
}
.form-partenaire.hidden-form {
    display: none !important;
}

/* Image preview partenaire */
.popup-gestion-home .image-preview {
    position: relative;
    max-width: 200px;
    margin-top: 10px;
}
.popup-gestion-home .image-preview img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid #ddd;
}
.popup-gestion-home .image-preview .remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #dc3545;
    color: white;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.popup-gestion-home .image-preview .remove-image:hover {
    background: #c82333;
}

/* Footer avec bouton ajouter */
.popup-gestion-home .popup-footer {
    padding: 15px 20px;
    border-top: 1px solid #ddd;
}
.popup-gestion-home .btn-add {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #4d74b5;
    font-family: 'Nexa Light';
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.popup-gestion-home .btn-add:hover {
    background: #3d5a8a;
}
.popup-gestion-home .btn-add img {
    width: 18px;
    height: auto;
}

/* TinyMCE */
.popup-gestion-home textarea {
    width: 100%;
    min-height: 100px;
}
.tox-tinymce,
.mce-tinymce {
    border-radius: 6px !important;
}

/* IMPORTANT: Z-index pour les menus TinyMCE */
.mce-menu,
.mce-floatpanel,
.mce-panel.mce-floatpanel,
.mce-container.mce-panel.mce-floatpanel,
.mce-container.mce-panel.mce-floatpanel.mce-menu,
body > .mce-menu,
body > .mce-floatpanel {
    z-index: 99999999999 !important;
}
.mce-menu .mce-menu-item,
.mce-menu-item {
    display: block !important;
}
.mce-listbox .mce-menu {
    max-height: 300px !important;
    overflow-y: auto !important;
    background: #fff !important;
}

/* TinyMCE Fullscreen */
.mce-fullscreen {
    z-index: 999999999999 !important;
}
.mce-fullscreen .mce-edit-area {
    height: calc(100vh - 100px) !important;
}
.mce-container-body.mce-abs-layout {
    overflow: visible !important;
}

/* Statusbar TinyMCE pour le resize */
.mce-statusbar {
    background: #f5f5f5 !important;
    border-top: 1px solid #ddd !important;
}
.mce-path {
    display: none !important;
}
.mce-resizehandle {
    cursor: nwse-resize !important;
}

/* Media Library au-dessus */
.media-modal {
    z-index: 9999999999999 !important;
}
.media-modal-backdrop {
    z-index: 99999!important;
}

@media (max-width: 768px) {
    .popup-gestion-home {
        max-width: 100%;
    }
}
