/* ===============================
    RESET / BASE
=================================*/
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: #f5f9fc;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1f2933;
}

/* Variables */
:root {
    --green: #14b86a;
    --green-dark: #0e7f49;
    --green-soft: #e6f8ef;
    --text: #1f2933;
    --text-soft: #6b7280;
    --radius: 22px;
}

/* ===============================
    TOPBAR
=================================*/
.topbar {
    max-width: 1200px;
    margin: 20px auto 10px;
    padding: 12px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 40px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.07);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.logo {
    height: 65px;
    width: auto;
}

.topbar-title h1 {
    margin: 0;
    font-size: 1.25rem;
}

.topbar-title p {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.88rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===============================
    BUTTONS
=================================*/
.btn {
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.small {
    padding: 6px 12px;
}

.admin-btn {
    background: #d1fae5;
    color: #065f46;
}

.youtube-btn {
    background: #ff0000;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(255, 0, 0, 0.35);
}

.youtube-btn:hover {
    filter: brightness(1.1);
}

.yt-icon {
    display: block;
}


/* ===============================
    LAYOUT
=================================*/
.layout {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===============================
    SECTION
=================================*/
.section-card {
    margin-top: 25px;
}

.section-title {
    font-size: 1.45rem;
    margin-bottom: 6px;
}

.section-subtitle {
    font-size: 0.95rem;
    color: var(--text-soft);
    margin-bottom: 18px;
}

/* ===============================
    SEARCH BOX
=================================*/
.search-box {
    position: relative;
    margin-bottom: 14px;
}

.search-box input {
    width: 100%;
    padding: 10px 34px 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    font-size: 0.88rem;
}

.btn-clear {
    position: absolute;
    right: 10px;
    top: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
}

/* ===============================
    FILTER CHIPS
=================================*/
.filters {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
}

.filter-chip {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
}

.chip-active {
    background: var(--green);
    color: white;
    border-color: var(--green);
}

/* ===============================
    GRID CAPSULES
=================================*/
.capsules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 20px;
}

.capsule-card {
    background: white;
    padding: 18px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
}

.capsule-img {
    width: 60%;
    margin: 10px auto;
    display: block;
    aspect-ratio: auto;
    object-fit: contain;
}


/* Description */
.capsule-desc {
    color: var(--text-soft);
    white-space: pre-line;
    margin-top: 12px;
    font-size: 0.9rem;
    max-height: 4.8em;
    overflow: hidden;
}

.capsule-desc.expanded {
    max-height: none;
}

.capsule-desc-toggle {
    margin-top: 4px;
    background: transparent;
    border: none;
    color: var(--green-dark);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.82rem;
}

/* META */
.capsule-meta {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
}

.badge {
    background: var(--green-soft);
    color: var(--green-dark);
    padding: 3px 10px;
    border-radius: 999px;
}

/* ACTIONS */
.capsule-actions {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
}

.btn-play {
    background: #111;
    color: white;
    padding: 7px 16px;
    border-radius: 999px;
    border: none;
}

.icon-btn {
    border: none;
    background: #f3f4f6;
    padding: 8px;
    border-radius: 999px;
    cursor: pointer;
}

/* ===============================
    PAGINATION
=================================*/
.pagination {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

#paginationInfo {
    color: var(--text-soft);
}

.pagination {
    display: flex;
    align-items: center; /* Centre verticalement */
    gap: 18px;
    margin-top: 20px;
    margin-bottom: 35px; /* ajoute l'espace en bas */
}

#paginationInfo {
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 500;
}

/* Boutons pagination harmonisés */
.pagination .btn {
    background: #16a34a;   /* Vert Meti-Bills */
    color: white;
    font-weight: 600;
    padding: 12px 22px;
    border-radius: 30px;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.2s;
}

.pagination .btn:hover {
    background: #128a3f;
}

/* Bouton désactivé (si besoin) */
.pagination .btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
}



/* ===============================
    MODALES
=================================*/
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 18px;
    position: relative;
    width: 100%;
    max-width: 500px;
}

/* ===============================
   MODALE EDIT (TAILLE & FLEX)
=================================*/
.modal-content.large {
    max-width: 860px;            /* taille idéale */
    width: 95%;                  /* adaptée à petits écrans */
    padding: 22px 26px;          /* espace plus propre */
}

.edit-grid {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;             /* empêche le débordement */
}

.edit-left {
    flex: 2 1 380px;             /* colonne principale */
    min-width: 320px;
}

.edit-right {
    flex: 1 1 260px;             /* colonne image */
    min-width: 240px;
}

.thumb-zone {
    border: 2px dashed #cbd5e1;
    padding: 18px;
    border-radius: 14px;
    text-align: center;
    height: 100%;
    background: #f9fafb;
}


/* Vidéo modale */
.video-content {
    max-width: 760px;
}

.modal-close {
    position: absolute;
    right: 14px;
    top: 14px;
    background: #f3f4f6;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 20px;
}

/* ===============================
   MODALE VIDEO — GRAND FORMAT
=================================*/
.modal-content.video-content {
    max-width: 1100px;       /* 👉 largeur maximale augmentée */
    width: 95%;              /* 👉 occupe presque toute la largeur disponible */
    padding: 28px;           /* 👉 un padding premium */
}

/* Titre vidéo plus grand */
.video-title {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 18px;
}

/* Vidéo responsive */
.video-container {
    width: 100%;
    position: relative;
    padding-bottom: 56.25%; /* ratio 16:9 */
    background: black;
    border-radius: 16px;
    overflow: hidden;
}

/* L’iframe occupe toute la zone */
.video-container iframe,
.video-container video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Description vidéo */
.video-description {
    margin-top: 22px;
    white-space: pre-line;
    line-height: 1.6;
    font-size: 1rem;
    color: var(--text-soft);
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

/* MODALE — ESPACEMENT HAUT/BAS */
.modal-content.video-content {
    max-width: 1100px;
    width: 95%;
    padding: 28px;

    /* 🔧 Les correctifs importants : */
    margin-top: 40px;       /* espace haut */
    margin-bottom: 40px;    /* espace bas */

    max-height: calc(100vh - 80px); /* 100% hauteur moins les 2 marges */
    overflow-y: auto;       /* permet de scroller si le texte est trop long */
    border-radius: 18px;
}


/* ===============================
    ADMIN EDIT
=================================*/
.edit-grid {
    display: flex;
    gap: 22px;
}

.edit-left {
    flex: 2;
}

.edit-right {
    flex: 1;
}

/* Fields */
.field {
    display: flex;
    flex-direction: column;
    margin-bottom: 14px;
}

.field span {
    font-size: 0.84rem;
    margin-bottom: 4px;
    color: var(--text-soft);
}

.field input,
.field textarea,
.field select {
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 0.88rem;
}

/* Miniature */
.thumb-zone {
    border: 2px dashed #cbd5e1;
    padding: 18px;
    border-radius: 14px;
    text-align: center;
}

.thumb-preview {
    width: 100%;
    border-radius: 10px;
}

.hidden {
    display: none;
}

/* ===============================
    DELETE MODAL
=================================*/
.btn.danger {
    background: #e11d48;
    color: white;
}

/* ===============================
    BUTTON FLOATING
=================================*/
.floating-add {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: var(--green);
    border: none;
    color: white;
    font-size: 28px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    cursor: pointer;
}

/* ===============================
   RESPONSIVE TOPBAR MOBILE
=================================*/

@media (max-width: 600px) {

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        padding: 18px 22px;
        gap: 12px;
    }

    .topbar-right {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        gap: 10px;
        flex-wrap: wrap;
    }

    .admin-btn,
    .youtube-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
        border-radius: 14px;
    }

    .youtube-btn {
        padding: 6px 14px;
    }

    .topbar-left {
        width: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .logo {
        height: 42px;
    }
}

/* ===============================
   FILTRES — RESPONSIVE MOBILE
=================================*/

@media (max-width: 600px) {

    .filters {
        display: flex;
        flex-wrap: wrap;             /* Permet de passer à la ligne */
        gap: 10px;                   /* Espacement propre */
        justify-content: flex-start; /* Alignement propre */
    }

    .filter-chip {
        padding: 8px 14px;           /* Taille plus confortable */
        font-size: 0.82rem;          /* Texte légèrement réduit */
        border-radius: 999px;
        flex: none;                  /* Empêche l'étirement */
        white-space: nowrap;         /* Empêche que les mots se coupent */
    }
}
/* ===========================================
   VIDEO RESPONSIVE – MOBILE + DESKTOP
=========================================== */

.video-container {
    width: 100%;
    position: relative;
    padding-bottom: 56.25%;     /* Ratio 16/9 */
    background: black;
    border-radius: 14px;
    overflow: hidden;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

/* Conversion responsive spécifique mobile */
@media (max-width: 600px) {
    .modal-content.video-content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px !important;
        border-radius: 0 !important;
    }

    .video-title {
        font-size: 1.2rem !important;
        margin-bottom: 12px !important;
        text-align: center;
    }

    .video-description {
        font-size: 0.9rem !important;
        padding: 0 4px !important;
    }
}

/* ===========================================
   PAGE SUIVANTE
=========================================== */

/* OPTION C — Bouton Page Suivante premium */
#btnNextPage {
    background: linear-gradient(135deg, #14b86a, #0f9a59);
    color: white;
    padding: 12px 26px;
    border-radius: 30px;
    border: none;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(20, 184, 106, 0.35);
    transition: all 0.22s ease-in-out;
}

#btnNextPage:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(20, 184, 106, 0.45);
    background: linear-gradient(135deg, #11a45f, #0d864f);
}

/* Harmonisation du bouton "Page précédente" */
#btnPrevPage {
    background: #f3f3f3;
    color: #444;
    padding: 12px 20px;
    border-radius: 30px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.22s ease-in-out;
}

#btnPrevPage:hover {
    background: #e2e2e2;
    transform: translateY(-2px);
}

