/* =============================================================
   Gestion des documents pédagogiques — Feuille de style publique
   Version : 1.0.4
   Auteur : Adnane

   Ce fichier contient uniquement des styles neutres et BEM.
   Les couleurs de marque (palette du thème) sont contrôlées par
   les variables CSS --theme-primary, --theme-secondary, etc.
   que chaque thème définit dans son propre style.css.

   Aucune couleur de marque n'est imposée par le plugin.
   ============================================================= */

/* ---------- Layouts de secours (si thème non activé) ---------- */

.gdp-shortcode-wrapper {
    margin: 1.5rem 0;
}

.gdp-shortcode-wrapper .gdp-document-list,
.gdp-shortcode-wrapper .documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.gdp-shortcode-wrapper.gdp-layout-list .documents-grid {
    grid-template-columns: 1fr;
}

/* ---------- Carte de document (BEM) ---------- */

.gdp-document-card {
    background: #ffffff;
    border: 1px solid var(--theme-border, #e2e8f0);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.gdp-document-card:hover,
.gdp-document-card:focus-within {
    box-shadow: 0 4px 12px rgba(15, 30, 51, 0.08);
    transform: translateY(-2px);
    border-color: var(--theme-secondary, #2ba7a3);
}

.gdp-document-card__title {
    font-size: 1.15rem;
    margin: 0 0 0.6em;
    line-height: 1.3;
    /* Couleur pilotée par le thème actif, fallback neutre. */
    color: var(--theme-primary, #1F4E79);
}

.gdp-document-card__title a {
    color: inherit;
    text-decoration: none;
}

.gdp-document-card__title a:hover,
.gdp-document-card__title a:focus {
    color: var(--theme-primary-dark, #0f1e33);
    text-decoration: underline;
}

.gdp-document-card__meta {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.gdp-document-card__niveau {
    display: inline-block;
    padding: 0.2em 0.6em;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    background-color: var(--theme-primary, #1F4E79);
    color: #ffffff;
}

.gdp-document-card__categorie {
    display: inline-block;
    padding: 0.2em 0.6em;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    background-color: var(--theme-secondary-light, rgba(43, 167, 163, 0.12));
    color: var(--theme-secondary, #2ba7a3);
}

.gdp-document-card__excerpt {
    color: var(--theme-text-muted, #64748b);
    font-size: 0.9rem;
    margin: 0 0 1rem;
    flex: 1;
}

.gdp-document-card__info {
    list-style: none;
    margin: 0 0 1.2rem;
    padding: 0;
    font-size: 0.85rem;
    color: var(--theme-text-muted, #64748b);
}

.gdp-document-card__info li {
    margin-bottom: 0.3em;
}

.gdp-document-card__info strong {
    color: var(--theme-text, #1a202c);
}

.gdp-document-card__actions {
    display: flex;
    gap: 0.5rem;
}

/* ---------- Bouton de téléchargement (BEM) ---------- */

.gdp-download-button {
    display: inline-block;
    padding: 0.5em 1em;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    background-color: var(--theme-primary, #1F4E79);
    color: #ffffff;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.gdp-download-button:hover,
.gdp-download-button:focus {
    background-color: var(--theme-primary-dark, #0f1e33);
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
}

.gdp-button--ghost {
    background: transparent;
    color: var(--theme-primary, #1F4E79);
    border-color: var(--theme-border, #e2e8f0);
}

.gdp-button--ghost:hover,
.gdp-button--ghost:focus {
    background: var(--theme-background, #f4f6f8);
    border-color: var(--theme-primary, #1F4E79);
}

/* ---------- Page single document (BEM) ---------- */

.gdp-single-document__title,
.gdp-single-document .document-title {
    color: var(--theme-primary, #1F4E79);
}

/* ---------- Titre générique de document (utilisable partout) ---------- */

.gdp-document-title {
    color: var(--theme-primary, #1F4E79);
}

.gdp-document-list__title {
    color: var(--theme-primary, #1F4E79);
}

/* ---------- Pagination ---------- */

.gdp-shortcode-wrapper .pagination {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.gdp-shortcode-wrapper .pagination .page-numbers {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0.3rem;
}

.gdp-shortcode-wrapper .pagination .page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    border: 1px solid var(--theme-border, #e2e8f0);
    border-radius: 6px;
    color: var(--theme-primary, #1F4E79);
    text-decoration: none;
    font-weight: 500;
    background-color: #ffffff;
}

.gdp-shortcode-wrapper .pagination .page-number.current,
.gdp-shortcode-wrapper .pagination .page-number:hover {
    background-color: var(--theme-primary, #1F4E79);
    color: #ffffff;
    border-color: var(--theme-primary, #1F4E79);
    text-decoration: none;
}

/* ---------- Message « aucun document » ---------- */

.gdp-shortcode-wrapper .no-documents,
.no-documents {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--theme-text-muted, #64748b);
    background-color: var(--theme-background, #f4f6f8);
    border-radius: 12px;
    border: 2px dashed var(--theme-border, #e2e8f0);
}

/* ---------- Filtres (rendu plugin secours) ---------- */

.gdp-filters,
.gdp-shortcode-wrapper .document-filters {
    background: #ffffff;
    border: 1px solid var(--theme-border, #e2e8f0);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.gdp-shortcode-wrapper .filter-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    align-items: end;
}

.gdp-shortcode-wrapper .filter-field {
    display: flex;
    flex-direction: column;
}

.gdp-shortcode-wrapper .filter-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--theme-primary, #1F4E79);
    margin-bottom: 0.4rem;
}

.gdp-shortcode-wrapper .filter-field input,
.gdp-shortcode-wrapper .filter-field select {
    padding: 0.6em 0.8em;
    border: 1px solid var(--theme-border, #e2e8f0);
    border-radius: 6px;
    font-size: 0.95rem;
    background: #ffffff;
    color: var(--theme-text, #1a202c);
}

.gdp-shortcode-wrapper .filter-field input:focus,
.gdp-shortcode-wrapper .filter-field select:focus {
    border-color: var(--theme-primary, #1F4E79);
    outline: 3px solid var(--theme-primary-light, rgba(31, 78, 121, 0.2));
}

.gdp-shortcode-wrapper .filter-actions {
    display: flex;
    gap: 0.5rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .gdp-shortcode-wrapper .filter-row {
        grid-template-columns: 1fr;
    }
    .gdp-shortcode-wrapper .documents-grid {
        grid-template-columns: 1fr;
    }
}
