/**
 * Styles pour [grille_projets] — pagination AJAX
 */

.projets-wrapper {
    position: relative;
    min-height: 200px;
}

.projets-wrapper.loading .projets-grid {
    opacity: 0.5;
    pointer-events: none;
}

.projets-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f0f0f0;
    border-top-color: #4d74b5;
    border-radius: 50%;
    animation: projets-spin 0.8s linear infinite;
    z-index: 10;
}

@keyframes projets-spin {
    to { transform: rotate(360deg); }
}

/* Pagination */
.projets-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 100px;
    flex-wrap: wrap;
}

.projets-pagination button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 5px;
    border: none;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    background: #f0f0f0;
    color: #333;
}

.projets-pagination button:hover:not(.active):not(:disabled) {
    background: #4d74b5;
    color: #fff;
}

.projets-pagination button.active {
    background: #4d74b5;
    color: #fff;
    cursor: default;
}

.projets-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.projets-pagination .page-numbers {
    display: flex;
    gap: 8px;
    align-items: center;
}

/**
 * Styles pour le drawer projets (gestion des missions)
 */

/* Overlay */
.projets-drawer-overlay {
    display: none;
    position: fixed;
    bottom:0;
    height:91vh;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999999999;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.projets-drawer-overlay.active {
    display: flex;
    justify-content: flex-end;
}
.projets-drawer-overlay.show {
    opacity: 1;
}
.projets-drawer-overlay.projets-secondary {
    z-index: 9999999999;
}

/* Media Library au-dessus du drawer */
.media-modal {
    z-index: 9999999999999999 !important;
}
.media-modal-backdrop {
    z-index: 999999 !important;
}

/* Drawer */
.projets-drawer {
    background: white;
    width: 100%;
    max-width: 1000px;
    height: 100vh;
    display: flex;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 30px 0 0 0;
    flex-direction: column;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}
.projets-drawer-overlay.show .projets-drawer {
    transform: translateX(0);
}
.projets-drawer-large {
    width: 80%;
    max-width: 1200px;
}

.projets-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #ddd;
    background-color: #4d74b5;
}
.projets-drawer-title {
    margin: 0;
    font-family:'Nexa Light';
    padding:0!important;
    font-size: 20px!important;
    font-weight: 600!important;
    color: white!important;
    background-color:transparent!important
}
.projets-drawer-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;
}
.projets-drawer-close:hover {
    background: white;
    color:#4d74b5!important
}

/* Actions */
.projets-drawer-actions {
    padding: 16px 24px;
    border-bottom: 1px solid #ddd;
    background: white;
}
.projets-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background:#4d74b5;
    font-family:'Nexa Light';
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.projets-add-btn:hover {
    background: #5a6268;
}

/* Content */
.projets-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

/* Liste des projets */
.projets-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y:auto;
    max-height:70vh;
}
.projet-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding:0 10px;
    border-bottom: 1px solid #ddd;
    transition: all 0.2s ease;
}
.projet-item:hover {
    background: #f0f0f0;
    border-color: #2271b1;
}
.projet-info {
    flex: 1;
    min-width: 0;
}
.projet-title {
    font-weight: 600;
    font-size: 15px;
    color: #1d2327;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.projet-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: #646970;
}
.projet-status {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}
.projet-status.status-publish {
    background: #d4edda;
    color: #155724;
}
.projet-status.status-draft {
    background: #fff3cd;
    color: #856404;
}
.projet-status.status-pending {
    background: #d1ecf1;
    color: #0c5460;
}
.projet-actions {
    display: flex;
    gap: 8px;
    margin-left: 12px;
}
.projet-view-btn,
.projet-edit-btn,
.projet-delete-btn {
    padding: 8px;
    border:none!important;
    background:transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.projet-view-btn img,
.projet-edit-btn img,
.projet-delete-btn img {
    width:20px;
    height:auto;
}

/* Iframe */
.projets-iframe-container {
    padding: 0;
    height: 100%;
    max-height:82vh;
}
#projets-edit-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Onglets drawer */
.drawer-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    background: #f9f9f9;
    flex-wrap: wrap;
}
.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;
    min-width: fit-content;
    white-space: nowrap;
}
.drawer-tab:hover {
    background: #e9eef0;
}
.drawer-tab.active {
    color: #4d74b5!important;
    border-bottom-color: #4d74b5;
}
.drawer-tab-content {
    display: none;
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}
.drawer-tab-content.active {
    display: block;
}

/* Formulaire drawer */
.drawer-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.d-flex {
    display: flex;
    gap: 16px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-radius: 10px;
    background-color: #4d74b557;
}
.form-group.half-flex {
    flex: 1;
}
.form-group label {
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
    font-family:'Nexa Light';
}
.form-group textarea,
.form-group input[type="text"] {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}
.button-primary {
    background: #00a09a;
    color: white;
    padding: 10px 20px;
    min-width:30%;
    border: none;
    font-family:'Nexa Light';
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.button-primary:hover {
    background: #5a6268;
}
.button-secondary {
    min-width:30%;
    color: white;
    padding: 10px 20px;
    border: none;
    font-family:'Nexa Light';
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.button-secondary:hover {
    background: #5a6268;
}

/* Upload image */
.image-upload-wrapper {
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
}
.image-preview {
    position: relative;
    max-width: 300px;
}
.image-preview img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid #ddd;
}
.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;
}
.image-preview .remove-image:hover {
    background: #c82333;
}

/* Style TinyMCE */
#projets_intro_text {
    width: 100%;
    min-height: 200px;
}
.tox-tinymce {
    border-radius: 6px !important;
}

/* Responsive */
@media (max-width: 768px) {
    .projets-drawer {
        width: 100%;
    }
    .projets-drawer-large {
        width: 100%;
    }
    .projet-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .projet-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }
    .drawer-tabs {
        overflow-x: auto;
    }
    .drawer-tab {
        flex: none;
        padding: 10px 12px;
        font-size: 13px;
    }
}

/**
 * Styles pour le drawer PS Light (gestion des actions)
 */

/* ===== Overlay ===== */
.ps-light-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999999999;
    opacity: 0;
    transition: opacity 0.3s ease;
    justify-content: flex-end;
}
.ps-light-overlay.active {
    display: flex;
}
.ps-light-overlay.show {
    opacity: 1;
}
.ps-light-overlay.ps-light-secondary {
    z-index: 999999999999;
}

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

/* ===== Drawer ===== */
.ps-light-drawer {
    background: white;
    width: 100%;
    max-width: 1000px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.1);
    border-radius: 30px 0 0 0;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
}
.ps-light-overlay.show .ps-light-drawer {
    transform: translateX(0);
}
.ps-light-drawer-large {
    width: 80%;
    max-width: 1200px;
}

/* ===== Header ===== */
.ps-light-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #ddd;
    background-color: #4d74b5;
}
.ps-light-title {
    margin: 0;
    font-family: 'Nexa Light', sans-serif;
    font-size: 20px !important;
    font-weight: 600 !important;
    color: white !important;
    background: transparent !important;
    padding: 0 !important;
}
.ps-light-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;
}
.ps-light-close:hover {
    background: white;
    color: #4d74b5 !important;
}

/* ===== Onglets ===== */
.ps-light-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    background: #f9f9f9;
    flex-wrap: wrap;
}
.ps-light-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Nexa Light', sans-serif;
    color: #686868 !important;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    min-width: fit-content;
    white-space: nowrap;
}
.ps-light-tab:hover {
    background: #e9eef0;
}
.ps-light-tab.active {
    color: #4d74b5 !important;
    border-bottom-color: #4d74b5;
}

/* ===== Contenu des onglets ===== */
.ps-light-tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
}
.ps-light-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* ===== Iframe ===== */
.ps-light-iframe-container {
    flex: 1;
    padding: 0;
    height: 100%;
}
.ps-light-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ===== Barre d'actions ===== */
.ps-light-actions-bar {
    padding: 16px 24px;
    border-bottom: 1px solid #ddd;
    background: white;
}
.ps-light-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #4d74b5;
    font-family: 'Nexa Light', sans-serif;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.ps-light-add-btn:hover {
    background: #5a6268;
}

/* ===== Liste des posts ===== */
.ps-light-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}
.ps-light-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ps-light-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    border-bottom: 1px solid #ddd;
    transition: all 0.2s ease;
}
.ps-light-item:hover {
    background: #f0f0f0;
    border-color: #2271b1;
}
.ps-light-item-info {
    flex: 1;
    min-width: 0;
    padding: 10px 0;
}
.ps-light-item-title {
    font-weight: 600;
    font-size: 15px;
    color: #1d2327;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ps-light-item-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: #646970;
}
.ps-light-status {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}
.ps-light-status.status-publish {
    background: #d4edda;
    color: #155724;
}
.ps-light-status.status-draft {
    background: #fff3cd;
    color: #856404;
}
.ps-light-status.status-pending {
    background: #d1ecf1;
    color: #0c5460;
}
.ps-light-item-actions {
    display: flex;
    gap: 8px;
    margin-left: 12px;
}
.ps-light-view-btn,
.ps-light-edit-btn,
.ps-light-delete-btn {
    padding: 8px;
    border: none !important;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.ps-light-view-btn img,
.ps-light-edit-btn img,
.ps-light-delete-btn img {
    width: 20px;
    height: auto;
}

/* ===== Bouton trigger ===== */
.ps-light-trigger.btn-gestion-equipe {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .ps-light-drawer {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }
    .ps-light-tabs {
        overflow-x: auto;
    }
    .ps-light-tab {
        flex: none;
        padding: 10px 12px;
        font-size: 13px;
    }
    .ps-light-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .ps-light-item-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }
}
