/**
 * Evenements — Front CSS
 * Styles pour [liste_events] : grille, cards, pagination, loading
 */

/* Wrapper */
.events-wrapper {
    position: relative;
    min-height: 200px;
}

/* Loading state */
.events-wrapper.loading .events-grid {
    opacity: 0.5;
    pointer-events: none;
}

.events-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: events-spin 0.8s linear infinite;
    z-index: 10;
}

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

/* Event meta (inside cards) */
.event-meta {
    width: 100%;
    padding: 4%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
    flex: 1;
    align-items: flex-start;
}

.event-meta-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #fff;
}

.event-meta-item svg {
    width: 18px;
    height: 18px;
    fill: #fff;
    flex-shrink: 0;
}

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

.events-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;
}

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

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

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

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

.events-pagination .dots {
    padding: 0 5px;
    color: #666;
}

/* =====================================================
   Extracted from evenements.php [gestion_events_v2] inline styles
   ===================================================== */
/* Popup/Drawer principal */
.popup-gestion-equipe {
    position: fixed;
    top: 9vh;
    right: -800px;
    width: 100%;
    max-width: 750px;
    height: 91vh;
    background: #fff;
    z-index: 9999999;
    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-equipe.open {
    right: 0;
}
.popup-header-edit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #ddd;
    background: #4d74b5;
}
.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-content-edit {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}
.popup-footer {
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
}

/* Onglets drawer */
.drawer-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    background: #f9f9f9;
}
.drawer-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    font-family: "Nexa Light" !important;
    color: #686868 !important;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}
.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 intro */
.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;
    padding: 15px;
}
.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;
    border-radius: 6px;
    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%;
    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;
}
.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 */
#gev2_intro_textarea {
    width: 100%;
    min-height: 200px;
}

/* Forcer l'affichage des menus deroulants TinyMCE */
.mce-menu,
.mce-floatpanel,
.mce-container.mce-panel.mce-floatpanel {
    z-index: 999999999999999999 !important;
}
.mce-listbox .mce-menu {
    max-height: 300px !important;
    overflow-y: auto !important;
}
.mce-menu-item {
    display: block !important;
}
.mce-text {
    display: inline-block !important;
}
/* Fix pour les dropdowns dans les drawers */
.popup-gestion-equipe .mce-tinymce {
    z-index: 1 !important;
}
.mce-toolbar .mce-listbox button {
    min-width: 80px;
}
.tox-tinymce {
    border-radius: 6px !important;
}

/* Drawer secondaire (iframe) */
.events-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9999999;
    opacity: 0;
    transition: opacity .3s ease;
    justify-content: flex-end;
    align-items: stretch;
}
.events-drawer-overlay.active {
    display: flex;
}
.events-drawer-overlay.show {
    opacity: 1;
}
#events-drawer-secondary {
    position: relative;
    z-index: 99999999;
    height: 91vh;
    top: 9vh !important;
}
.events-drawer {
    background: #fff;
    width: 100%;
    max-width: 1100px;
    height: 100%;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .3s ease;
    box-shadow: -2px 0 20px rgba(0,0,0,.25);
    border-radius: 20px 0 0 0;
    overflow: hidden;
}
.events-drawer-overlay.show .events-drawer {
    transform: translateX(0);
}

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

.events-drawer-content {
    flex: 1;
    overflow: hidden;
}
#events-edit-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

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

@media (max-width: 900px) {
    .events-drawer {
        max-width: 100%;
        border-radius: 0;
    }
    .d-flex {
        flex-direction: column;
    }
}

/* =====================================================
   Extracted from evenements.php [event_light_editor_button] inline styles
   ===================================================== */
.projets-drawer-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999999999;
    opacity: 0;
    transition: opacity .3s ease;
    justify-content: flex-end;
}
.projets-drawer-overlay.active { display:flex; }
.projets-drawer-overlay.show { opacity:1; }

.projets-drawer {
    background:white;
    width:100%;
    max-width:1000px;
    height:100vh;
    display:flex;
    flex-direction:column;
    box-shadow:-2px 0 20px rgba(0,0,0,.1);
    border-radius:30px 0 0 0;
    transform:translateX(100%);
    transition:transform .3s ease;
    overflow:hidden;
}
.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:#4d74b5;
}
.projets-drawer-title {
    margin:0;
    font-family:'Nexa Light';
    font-size:20px !important;
    font-weight:600 !important;
    color:white !important;
}
.projets-drawer-close {
    border:none;
    background:transparent;
    font-size:24px;
    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;
}

.projets-drawer-content { flex:1; padding:0; }
.projets-iframe-container { height:100%; padding:0; }
#ps-light-iframe {
    width:100%;
    height:100%;
    border:none;
}

.event-drawer-trigger.btn-gestion-equipe {
    background:white;
    border:none;
    padding:0;
    cursor:pointer;
}

@media(max-width:768px){
    .projets-drawer{
        width:100%;
        max-width:100%;
        border-radius:0;
    }
}
