/* =================================================================
   STYLES DE BASE DU PLUGIN (GRILLE & BOUTONS)
   ================================================================= */

.sgp-library-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 25px;
}

.sgp-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sgp-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
}

.sgp-item-thumbnail {
    padding: 15px 15px 0 15px;
}

.sgp-item img {
    max-width: 100%;
    height: auto;
    margin-bottom: 15px;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.sgp-item-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: flex-end;
}

.sgp-item-content h3 {
    font-size: 1rem;
    line-height: 1.3;
    margin: 0 0 15px 0;
    flex-grow: 1;
}

.sgp-item-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sgp-button {
    display: block;
    width: 100%;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sgp-lightbox-trigger.sgp-button {
    background-color: #f0f0f0;
    color: #333;
    border-color: #ccc;
}
.sgp-lightbox-trigger.sgp-button:hover {
    background-color: #e0e0e0;
    border-color: #bbb;
}

.sgp-download-button.sgp-button {
    background-color: #96588a;
    color: white !important;
    border-color: #7f4a74;
}
.sgp-download-button.sgp-button:hover {
    background-color: #7f4a74;
}


/* =================================================================
   STYLE UNIFIÉ POUR LES FILTRES (BIBLIOTHÈQUE & BOUTIQUE)
   ================================================================= */

.sgp-filters-wrapper {
    margin-bottom: 2em;
    padding: 1.5em;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.sgp-filters-wrapper .sgp-search-form {
    margin-bottom: 1.5em;
}

.sgp-filters-wrapper .sgp-search-form input[type="search"] {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

.sgp-filters-wrapper .sgp-search-form input[type="submit"] {
    display: none; /* La recherche se fait via AJAX ou la touche Entrée */
}

.sgp-filters-wrapper .sgp-tag-filters {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.sgp-filters-wrapper .sgp-tag-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sgp-filters-wrapper .sgp-tag-list a {
    display: block;
    padding: 5px 12px;
    background-color: #e7e7e7;
    border-radius: 15px;
    text-decoration: none;
    color: #444;
    font-size: 0.9em;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sgp-filters-wrapper .sgp-tag-list a:hover {
    background-color: #d0d0d0;
}

.sgp-filters-wrapper .sgp-tag-list a.active {
    background-color: #7f4a74;
    color: white;
    font-weight: bold;
}


/* =================================================================
   STYLES POUR LA LIGHTBOX ET LE CHARGEMENT AJAX
   ================================================================= */

/* --- Lightbox --- */
.sgp-lightbox-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}
.sgp-lightbox-overlay.visible {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}
.sgp-lightbox-content {
    position: relative;
    width: 90%; height: 90%;
    max-width: 1200px;
    background: none;
    padding: 0;
    display: flex;
    flex-direction: column;
}
.sgp-lightbox-header {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background-color: #333;
    color: white;
}
#sgp-lightbox-viewer {
    width: 100%;
    height: 100%;
    overflow: auto;
    padding-top: 60px; /* Espace pour le header */
    text-align: center;
    background: #525659;
    box-sizing: border-box; /* LA CORRECTION EST ICI : le padding est inclus dans la hauteur */
}
.sgp-lightbox-header {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    z-index: 10;
    border-radius: 5px 5px 0 0;
}
.sgp-lightbox-close {
    margin-left: auto;
    background: none;
    border: none;
    color: white;
    font-size: 35px;
    line-height: 1;
    padding: 0 10px;
    font-weight: normal;
    cursor: pointer;
    box-shadow: none;
}
.sgp-lightbox-close:hover {
    color: #ff5a5a;
}
.sgp-header-separator {
    width: 1px;
    background-color: #555;
    align-self: stretch;
    margin: -10px 0;
}
.sgp-nav-button {
    background-color: #555;
    color: white;
    border: 1px solid #777;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: "Segoe UI Symbol", "Apple Symbols", "Calibri", sans-serif;
}
.sgp-nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Chargement --- */
#sgp-lightbox-viewer.loading::before {
    content: "Chargement du document...";
    color: white;
    font-size: 1.5em;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}
.sgp-library-wrapper.loading,
#sgp-shop-results.loading {
    opacity: 0.5;
    transition: opacity 0.3s ease;
    position: relative;
    min-height: 200px;
}
.sgp-library-wrapper.loading::before,
#sgp-shop-results.loading::before {
    content: "Chargement...";
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    z-index: 10;
}

/* =================================================================
   HARMONISATION DES COULEURS (BLEU #143E89)
   ================================================================= */

/* --- 1. Bouton "Télécharger" --- */

/* Style du bouton au repos */
.sgp-download-button.sgp-button {
    background-color: #143E89; /* Votre couleur bleue */
    border-color: #0f2c6d;     /* Une bordure un peu plus foncée */
}

/* Style du bouton au survol */
.sgp-download-button.sgp-button:hover {
    background-color: #0f2c6d; /* Le bleu foncé au survol */
}


/* --- 2. Filtres par étiquette (état actif) --- */

/* Style pour l'étiquette de filtre active */
.sgp-filters-wrapper .sgp-tag-list a.active {
    background-color: #143E89; /* Votre couleur bleue */
    color: white;
    border-color: #143E89;     /* Bordure de la même couleur */
}

/* Style pour le bouton "Ajuster" quand il est actif */
#sgp-fit-button.active {
    background-color: #7f4a74; /* Ou votre bleu: #143E89 */
    border-color: #fff;
}