/* ----------- DISPOSITION GLOBALE ----------- */
.builder {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    padding: 1rem;
    box-sizing: border-box;
}

.sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ----------- BLOCS DE LA SIDEBAR ----------- */
.slot {
    border: 1px solid #ccc;
    background: #fafafa;
    padding: 0.75rem;
    box-sizing: border-box;
}

.slot h2 {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
    text-align: center;
}

.slot-top-header {
    display: flex;
    justify-content: space-between; /* Rouages à gauche, bouton à droite */
    align-items: center;            /* Centrer verticalement */
    margin-bottom: 0.5rem;
}

.reset-left-form {
    margin: 0;
}

.rank-block {
    border-top: 1px solid #ccc;
    padding-top: 0.5rem;
    margin-top: 0.75rem;
}

.rank-block:first-of-type {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

.rank-block h3 {
    margin: 0;
    font-size: 1rem;
    text-align: center;
}

.rank-card {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.empty-slot {
    color: #777;
    font-size: 0.9rem;
    text-align: center;
}

/* ----------- EXPORT SIDEBAR ----------- */
.slot-export h2 {
    margin-top: 0;
    font-size: 1.1rem;
    text-align: center;
}

.slot-export label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.slot-export input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: 0.3rem 0.4rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    border-radius: 6px;
}

/* Boutons export (texte / JPG) */
.export-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
    margin-top: 0.3rem;
}

.export-buttons button {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 6px;
    border: 1px solid #bbb;
    background-color: #444;
    color: white;
    cursor: pointer;
    transition: background 0.2s ease;
}

.export-buttons button:hover {
    background-color: #666;
}

.export-buttons button:active {
    background-color: #333;
    border-color: #333;
}

/* Bloc export texte (textarea) */
.export-text-block {
    margin-top: 0.8rem;
}

.export-text-block h3 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
}

.export-text-block textarea {
    width: 100%;
    box-sizing: border-box;
    font-family: monospace;
    font-size: 0.9rem;
    padding: 0.4rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    resize: vertical;
}

.validate-text-block textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.3rem 0.4rem;  /* même que l'input */
    font-family: inherit;     /* pour matcher l'input */
    font-size: 0.9rem;        /* idem */
    border-radius: 6px;
    border: 1px solid #ccc;
    resize: vertical;
    margin-top: 0.5rem;       /* ajuster l'espace si besoin */
}

/* ----------- CARTES (images) ----------- */
.card-thumb, .card-thumb-large {
    border-radius: 6px;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    z-index: 1;
}

.card-thumb {
    width: 95%;
    max-width: 260px;
    height: auto;
}

.card-thumb:hover {
    transform: scale(1.3);
    z-index: 15;
    box-shadow: 0 0 8px rgba(0,0,0,0.5);
}

.card-thumb-large {
    width: 100%;
    max-width: 260px;
    height: auto;
    margin: 0 auto 0.75rem;
}

.card-thumb-large:hover {
    transform: scale(1.7);
    z-index: 20;
    box-shadow: 0 0 10px rgba(0,0,0,0.6);
}

/* ----------- ZONE CENTRALE ----------- */
.center-zone {
    flex: 1;
    border: 1px solid #ccc;
    background: #fff;
    padding: 1rem;
    box-sizing: border-box;
}

.center-zone h2 {
    margin-top: 0;
    font-size: 1.3rem;
}

/* ----------- FILTRES ----------- */
.filters {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.filters-header {
    display: flex;
    justify-content: space-between; /* bouton à droite */
    align-items: flex-start;        /* bouton aligné en haut */
    flex-wrap: wrap;                /* passage à la ligne si écran trop petit */
    gap: 1rem;                      /* espace horizontal / vertical entre colonnes */
    margin-bottom: 1rem;            /* espace sous le bloc */
}

.filters-left {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* espace vertical entre chaque ligne de filtres */
    flex: 1 1 300px; /* permet au bloc de s'adapter sur petits écrans */
}

.filters-right {
    margin-top: 0.25rem; /* ajustement vertical si nécessaire */
    flex-shrink: 0;       /* ne réduit pas le bouton */
}

.filter-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.9rem;
    font-weight: bold;
    min-width: 90px;
    padding-top: 0.2rem;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.filter-button, .filter-reset-button, .clear-cabale-button, .add-buttons button, .reset-form button {
    padding: 0.25rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 999px;
    border: 1px solid #bbb;
    background-color: #444;  /* couleur site */
    color: white;
    cursor: pointer;
    transition: background 0.2s ease;
    text-decoration: none;
}

.filter-button:hover, .filter-reset-button:hover, .clear-cabale-button:hover, .add-buttons button:hover, .reset-form button:hover {
    background-color: #666;  /* éclairci au survol */
}

.filter-button.active {
    background-color: #333;
    color: white;
    border-color: #333;
}

.top-action-buttons {
    display: flex;
    justify-content: flex-end; /* <-- pousse le bouton à droite */
    margin-bottom: 0.5rem;     /* espace entre le bouton et les filtres */
}

.reset-form-inline {
    margin: 0;
    padding: 0;
}

.reset-form-sidebar {
    margin-bottom: 1rem;
    text-align: center;
}

/* ----------- GRILLE DES CARTES ----------- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.card-item {
    border: 1px solid #ccc;
    background: #fafafa;
    padding: 0.6rem;
    border-radius: 6px;
    box-sizing: border-box;
    overflow: visible;
    position: relative;
}

.card-item h3 {
    margin: 0.3rem 0;
    font-size: 1rem;
    text-align: center;
}

.card-item p {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    text-align: center;
}

.add-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem;
}

/* ----------- RESPONSIVE ----------- */
@media (max-width: 900px) {
    .builder {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    /* ----------- SLOT-TOP HEADER ----------- */
    /* On aligne titre et bouton "Vider" horizontalement si possible */
    .slot-top-header {
        display: flex;
        flex-direction: row;
        justify-content: space-between; /* titre à gauche, bouton à droite */
        align-items: center;
        margin-bottom: 0.5rem;
        flex-wrap: wrap; /* si l'écran est trop petit, bouton passe en dessous */
        gap: 0.3rem;
    }

    .slot-top-header h2 {
        flex: 1 1 auto; /* titre prend l'espace disponible */
        margin: 0;
    }

    .reset-left-form {
        flex: 0 0 auto; /* bouton garde sa taille */
    }

    .reset-left-button {
        font-size: 0.85rem;
        padding: 0.25rem 0.5rem;
    }

    /* Export buttons responsive */
    .export-buttons {
        flex-direction: column;
        gap: 0.4rem;
    }

    .export-buttons button {
        width: 100%;
    }
}
