/* =========================
   CSS DE BASE (le style est contrôlé par les réglages)
========================= */

/* Grille des cartes */
.tbc-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

/* Carte */
.tbc-card {
    text-align: center;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.tbc-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    z-index: 10;
}

/* Image des cartes */
.tbc-card img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 8px auto;
    cursor: pointer;
    transition: transform 0.3s ease;
    border-radius: 4px;
    position: relative;
}

.tbc-card:hover img {
    transform: scale(1.08);
}

.tbc-card img:active {
    transform: scale(0.98);
}

/* Icône de zoom au survol */
.tbc-card {
    position: relative;
}

.tbc-card::before {
    content: '🔍';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 5;
}

.tbc-card:hover::before {
    opacity: 1;
}

/* Données cachées (ne prennent AUCUN espace) */
.tbc-filter-data {
    display: none !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
    font-size: 0 !important;
    visibility: hidden !important;
}

.tbc-hidden-acf {
    display: none !important;
}

/* Champs ACF visibles */
.tbc-visible-fields {
    margin-top: 10px;
    margin-bottom: 8px;
    padding: 8px;
    border: 1px solid;
    border-radius: 3px;
    text-align: left;
    line-height: 1.4;
}

.tbc-visible-fields .tbc-field {
    margin-bottom: 3px;
}

.tbc-visible-fields .tbc-field:last-child {
    margin-bottom: 0;
}

/* Champ quantité */
.tbc-card input[type="number"] {
    width: 70px;
    margin-top: 8px;
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 3px;
    text-align: center;
}

/* Zone des filtres et tri */
.tbc-acf-filters {
    margin-bottom: 20px;
    border: 1px dashed;
    border-radius: 5px;
}

.tbc-filters-section,
.tbc-sort-section {
    padding-bottom: 10px;
}

.tbc-sort-section {
    border-top: 1px solid rgba(0,0,0,0.1);
    padding-top: 15px;
    margin-top: 10px;
}

.tbc-acf-filters h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
}

.tbc-filters-row,
.tbc-sort-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.tbc-filter,
.tbc-sort-option {
    flex: 0 0 auto;
}

.tbc-filter label,
.tbc-sort-option label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 13px;
}

.tbc-acf-filters select,
.tbc-acf-sort {
    min-width: 160px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: white;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.tbc-acf-filters select:focus,
.tbc-acf-sort:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.tbc-acf-filters select:hover,
.tbc-acf-sort:hover {
    border-color: #999;
}

/* Conteneur du bouton PDF */
.tbc-pdf-button-container {
    clear: both;
}

/* Bouton PDF (les styles détaillés viennent des réglages) */
#tbc-generate-pdf {
    display: inline-block;
    text-decoration: none;
}

/* Animation de chargement (optionnel) */
@keyframes tbc-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.tbc-loading #tbc-generate-pdf {
    animation: tbc-pulse 1.5s infinite;
    pointer-events: none;
}

/* =========================
   LIGHTBOX (agrandissement d'image)
========================= */
.tbc-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    cursor: zoom-out;
    animation: tbc-fadeIn 0.3s ease;
}

.tbc-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tbc-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    animation: tbc-zoomIn 0.3s ease;
}

.tbc-lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.tbc-lightbox-close {
    position: absolute;
    top: -45px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tbc-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

@keyframes tbc-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes tbc-zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}