/* ============================================================
   ACO — Admin Centre OACP — CSS principal (mobile-first)
   ============================================================ */

.aco-wrap * { box-sizing: border-box; }

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.aco-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #1a1a1a;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 12px;
    width: 100%;
}

/* ============================================================
   EN-TÊTE
   ============================================================ */
.aco-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e5e5e5;
}
.aco-header h1, .aco-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.2;
}
@media (min-width: 600px) {
    .aco-header h1, .aco-header h2 { font-size: 22px; }
}

/* ============================================================
   BOUTONS
   ============================================================ */
.aco-btn {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: opacity .15s;
    line-height: 1.4;
    white-space: nowrap;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}
.aco-btn:hover { opacity: .85; text-decoration: none; }
.aco-btn:active { opacity: .7; }
.aco-btn--primary   { background: #0073aa; color: #fff; }
.aco-btn--danger    { background: #990000; color: #fff; }
.aco-btn--dark      { background: #1a1a1a; color: #fff; }
.aco-btn--secondary { background: #e5e5e5; color: #1a1a1a; }
.aco-btn--small     { padding: 6px 12px; font-size: 12px; }

/* Loader sur bouton */
.aco-btn.is-loading {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
    position: relative;
}
.aco-btn.is-loading::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: aco-spin .6s linear infinite;
    margin-left: 6px;
    vertical-align: middle;
}
@keyframes aco-spin { to { transform: rotate(360deg); } }

/* ============================================================
   BADGES
   ============================================================ */
.aco-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}
.aco-badge--unknown { background: #888; color: #fff; }

/* ============================================================
   ALERTES
   ============================================================ */
.aco-alert {
    padding: 12px 14px;
    border-radius: 4px;
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.5;
}
.aco-alert--warning { background: #fff8e5; border: 1px solid #f0ad4e; color: #7a5200; }
.aco-alert--danger  { background: #fdf0f0; border: 1px solid #dc3545; color: #721c24; }
.aco-alert--success { background: #f0fff4; border: 1px solid #28a745; color: #155724; }
.aco-alert--info    { background: #e8f4fd; border: 1px solid #0073aa; color: #0c4a6e; }

/* ============================================================
   FORMULAIRES
   ============================================================ */
.aco-form-group { margin-bottom: 14px; }

.aco-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 13px;
}

.aco-form-group input[type="text"],
.aco-form-group input[type="number"],
.aco-form-group input[type="datetime-local"],
.aco-form-group input[type="date"],
.aco-form-group select,
.aco-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
    background: #fff;
    transition: border-color .15s;
    -webkit-appearance: none;
    appearance: none;
}
.aco-form-group input:focus,
.aco-form-group select:focus,
.aco-form-group textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,.2);
}
.aco-form-group textarea { min-height: 90px; resize: vertical; }

.aco-form-row { display: flex; flex-direction: column; gap: 0; }
@media (min-width: 480px) {
    .aco-form-row { flex-direction: row; gap: 14px; }
    .aco-form-row .aco-form-group { flex: 1; }
}

.aco-form-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
@media (min-width: 480px) {
    .aco-form-actions { flex-direction: row; }
    .aco-form-actions .aco-btn { width: auto; }
}

/* ============================================================
   FORMULAIRE CARD
   ============================================================ */
.aco-form-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 20px;
    max-width: 640px;
}
@media (max-width: 479px) { .aco-form-card { padding: 12px; } }

/* ============================================================
   INDICATEUR ÉTAPES
   ============================================================ */
.aco-steps { display: flex; align-items: center; margin-bottom: 4px; }

.aco-step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #999;
}
.aco-step__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e5e5e5;
    color: #666;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}
.aco-step__sep { flex: 1; height: 1px; background: #e5e5e5; margin: 0 10px; max-width: 40px; }
.aco-step--active .aco-step__num  { background: #1a1a1a; color: #fff; }
.aco-step--active .aco-step__label { color: #1a1a1a; font-weight: 600; }
.aco-step--done .aco-step__num    { background: #268700; color: #fff; }
.aco-step--done .aco-step__label  { color: #268700; }

/* ============================================================
   CHECKBOXES (critères)
   ============================================================ */
.aco-checkboxes { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0; }

.aco-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fafafa;
    transition: border-color .15s, background .15s;
}
.aco-checkbox-label:hover { border-color: #0073aa; background: #f0f7fb; }
.aco-checkbox-label input[type="checkbox"] {
    width: 16px; height: 16px; margin: 0; flex-shrink: 0;
    accent-color: #0073aa;
}

/* ============================================================
   RÉCAP ÉTAPE 2
   ============================================================ */
.aco-recap {
    background: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 14px;
    color: #444;
}

/* ============================================================
   LISTE SALLES (aco-list générique)
   ============================================================ */
.aco-list { list-style: none; margin: 0; padding: 0; }

.aco-list-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow .15s;
}
@media (min-width: 600px) {
    .aco-list-item {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
    }
}
.aco-list-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.aco-list-item__body { flex: 1; min-width: 0; }
.aco-list-item__meta { font-size: 12px; color: #666; margin-bottom: 3px; line-height: 1.4; }
.aco-list-item__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}
@media (max-width: 599px) {
    .aco-list-item__actions {
        border-top: 1px solid #f0f0f0;
        padding-top: 8px;
    }
}

/* ============================================================
   LISTE COURS — layout comme le site existant
   titre + boutons sur une ligne, infos dessous
   ============================================================ */
.aco-cours-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: box-shadow .15s;
    display: block;         /* pas flex — structure interne propre */
    padding: 0;
}
.aco-cours-item:hover { box-shadow: 0 2px 10px rgba(0,0,0,.09); }

/* Ligne titre + boutons */
.aco-cours-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
}

/* Titre */
.aco-cours-titre-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.aco-cours-flag { font-size: 15px; flex-shrink: 0; }
.aco-cours-titre {
    font-size: 13px;
    font-weight: 600;
    color: #0073aa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Boutons sur la même ligne */
.aco-cours-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
    align-items: center;
}
.aco-cours-actions .aco-btn { white-space: nowrap; }

/* Zone infos */
.aco-cours-body { padding: 10px 14px 12px; }

/* Thème */
.aco-cours-theme {
    font-size: 12px;
    color: #555;
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Grille métas */
.aco-cours-meta-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #555;
}
.aco-cours-meta-item { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.aco-meta-icon { font-size: 12px; flex-shrink: 0; }

/* Badges */
.aco-cours-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }

/* Lien participants */
.aco-link-participants { color: #990000; font-size: 12px; text-decoration: none; }
.aco-link-participants:hover { text-decoration: underline; }

/* Alerte stock 0 */
.aco-cours-stock-alert {
    font-size: 12px;
    color: #990000;
    font-weight: 600;
    margin-top: 5px;
}

/* Mobile : boutons passent en dessous */
@media (max-width: 599px) {
    .aco-cours-header { flex-wrap: wrap; }
    .aco-cours-titre-wrap { flex: 1 1 100%; }
    .aco-cours-actions {
        width: 100%;
        border-top: 1px solid #f0f0f0;
        padding-top: 8px;
    }
    .aco-cours-actions .aco-btn { flex: 1; text-align: center; }
}

/* ============================================================
   LISTE masquée quand formulaire ouvert
   ============================================================ */
#aco-cours-list.is-hidden,
#aco-salle-list.is-hidden {
    display: none;
}

/* ============================================================
   BARRE DE RECHERCHE
   ============================================================ */
.aco-search { display: flex; gap: 8px; margin-bottom: 14px; }
.aco-search input {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
}
.aco-search input:focus { outline: none; border-color: #0073aa; }

/* ============================================================
   LAYOUT 2 COLONNES (salles)
   ============================================================ */
.aco-cols { display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 768px) {
    .aco-cols { flex-direction: row; align-items: flex-start; }
    .aco-cols__main { flex: 3; min-width: 0; }
    .aco-cols__aside { flex: 1; min-width: 200px; max-width: 280px; }
}
.aco-cols__aside {
    background: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 14px;
}
.aco-cols__aside h3 { margin-top: 0; margin-bottom: 10px; font-size: 15px; }
.aco-cols__aside p  { font-size: 13px; line-height: 1.5; margin-bottom: 8px; }
@media (max-width: 767px) { .aco-cols__aside { display: none; } }

/* ============================================================
   LOADER AJAX
   ============================================================ */
.aco-loader { display: none; text-align: center; padding: 20px; color: #666; font-size: 13px; }
.aco-loader.is-active { display: block; }

#aco-response { margin-bottom: 14px; }
.aco-wrap hr { border: none; border-top: 1px solid #e5e5e5; margin: 20px 0; }

/* ============================================================
   IMPRESSION
   ============================================================ */
@media print {
    .aco-no-print, .aco-btn, .aco-search, .aco-cols__aside { display: none !important; }
    .aco-wrap { max-width: 100%; padding: 0; }
    .aco-cours-item, .aco-list-item { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}

/* ============================================================
   SURCHARGE ELEMENTOR — forcer les styles critiques de la liste cours
   Les sélecteurs doubles (.aco-wrap .aco-cours-*) passent
   au-dessus des styles génériques d'Elementor.
   ============================================================ */
.aco-wrap .aco-cours-item {
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    margin-bottom: 12px !important;
    overflow: hidden !important;
    display: block !important;
    padding: 0 !important;
}

.aco-wrap .aco-cours-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    padding: 10px 14px !important;
    border-bottom: 1px solid #f0f0f0 !important;
    gap: 12px !important;
    background: #fafafa !important;
}

.aco-wrap .aco-cours-titre-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.aco-wrap .aco-cours-flag {
    font-size: 16px !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
}

.aco-wrap .aco-cours-titre {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #0073aa !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
}

.aco-wrap .aco-cours-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 5px !important;
    flex-shrink: 0 !important;
    align-items: center !important;
}

.aco-wrap .aco-cours-body {
    padding: 10px 14px 12px !important;
}

.aco-wrap .aco-cours-theme {
    font-size: 13px !important;
    color: #555 !important;
    margin-bottom: 8px !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
}

.aco-wrap .aco-cours-meta-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px 20px !important;
    margin-bottom: 8px !important;
    font-size: 12px !important;
    color: #555 !important;
    list-style: none !important;
    padding: 0 !important;
    margin-left: 0 !important;
}

.aco-wrap .aco-cours-meta-item {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
    float: none !important;
}

.aco-wrap .aco-cours-badges {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
    margin-top: 6px !important;
    align-items: center !important;
}

/* Mobile : boutons sous le titre */
@media (max-width: 599px) {
    .aco-wrap .aco-cours-header {
        flex-wrap: wrap !important;
    }
    .aco-wrap .aco-cours-titre-wrap {
        flex: 1 1 100% !important;
    }
    .aco-wrap .aco-cours-actions {
        width: 100% !important;
        border-top: 1px solid #f0f0f0 !important;
        padding-top: 8px !important;
    }
    .aco-wrap .aco-cours-actions .aco-btn {
        flex: 1 !important;
        text-align: center !important;
    }
}

/* ============================================================
   PARTICIPANTS — Overlay + Panel
   ============================================================ */

/* Fond sombre plein écran */
#aco-participants-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 99990;
    overflow-y: auto;
    padding: 40px 20px 60px;
}

/* Panel blanc centré */
#aco-participants-panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,.25);
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 28px 28px;
    position: relative;
}

/* Indicateur de chargement */
.aco-part-loading {
    text-align: center;
    padding: 40px 20px;
    color: #555;
    font-size: 14px;
}
.aco-part-loading::before {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    border: 3px solid #ddd;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: aco-spin .7s linear infinite;
    margin: 0 auto 14px;
}
@keyframes aco-spin { to { transform: rotate(360deg); } }

/* En-tête panel */
.aco-part-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e5e5;
}
.aco-part-titre {
    flex: 1;
    min-width: 200px;
}
.aco-part-titre h2 {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 6px;
    line-height: 1.3;
}
.aco-part-meta-date,
.aco-part-meta-lieu {
    display: inline-block;
    font-size: 12px;
    color: #555;
    margin-right: 14px;
}

/* Compteurs */
.aco-part-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.aco-part-stat {
    background: #f4f7fa;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 12px;
    color: #333;
    white-space: nowrap;
}
.aco-part-stat strong {
    font-size: 15px;
    display: block;
    line-height: 1.2;
}
.aco-part-stat--ok   { background: #e8f5e9; color: #268700; }
.aco-part-stat--warn { background: #fff3e0; color: #e65100; }
.aco-part-stat--muted{ background: #f5f5f5; color: #777; }

/* Actions */
.aco-part-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
    flex-wrap: wrap;
}

/* Tableau */
.aco-part-table-wrap {
    overflow-x: auto;
    margin-top: 4px;
}
.aco-part-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.aco-part-table thead tr {
    background: #0073aa;
    color: #fff;
}
.aco-part-table thead th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}
.aco-part-table tbody tr:nth-child(even) { background: #f7f9fc; }
.aco-part-table tbody tr:hover { background: #e8f0f8; }
.aco-part-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e5e5;
    vertical-align: middle;
}
.aco-part-table .aco-part-nom { font-weight: 600; color: #1a1a1a; }
.aco-part-table a { color: #0073aa; text-decoration: none; }
.aco-part-table a:hover { text-decoration: underline; }
.aco-col-signature { width: 90px; min-width: 80px; }

/* Mobile */
@media (max-width: 699px) {
    #aco-participants-overlay { padding: 20px 10px 40px; }
    #aco-participants-panel { padding: 16px 14px 20px; }
    .aco-part-header { flex-direction: column; gap: 12px; }
    .aco-part-actions { width: 100%; justify-content: flex-end; }
    .aco-part-table { font-size: 11px; }
    .aco-part-table thead th,
    .aco-part-table tbody td { padding: 6px 7px; }
    .aco-col-signature { display: none; }
}

/* ============================================================
   IMPRESSION
   ============================================================ */
@media print {
    /* Masquer tout sauf le panel */
    body > *:not(#aco-participants-overlay) { display: none !important; }
    #aco-participants-overlay {
        display: block !important;
        position: static !important;
        background: none !important;
        padding: 0 !important;
    }
    #aco-participants-panel {
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 10px !important;
    }
    .aco-no-print,
    .aco-part-actions { display: none !important; }
    .aco-part-table thead tr { background: #0073aa !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .aco-part-table tbody tr:nth-child(even) { background: #f4f7fa !important; }
    .aco-col-signature { display: table-cell !important; }
}
