/* Styles pour le drawer de vignettes */
.thumbnails-drawer-container {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    visibility: hidden;
    pointer-events: none;
}

.thumbnails-drawer-container.open {
    visibility: visible;
    pointer-events: auto;
}

.drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.thumbnails-drawer-container.open .drawer-overlay {
    opacity: 1;
}

.thumbnails-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: 80%;
    max-width: 1000px;
    height: 100%;
    background-color: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.thumbnails-drawer-container.open .thumbnails-drawer {
    transform: translateX(0);
}

.thumbnails-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    background-color: #6B59A1;
    color: white;
}

.thumbnails-drawer-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.drawer-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.drawer-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.thumbnails-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    padding-bottom: 16px;
}

.thumbnail-item {
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}

.thumbnail-item:hover {
    transform: translateY(-4px);
    border-color: #6B59A1;
}

.thumbnail-item.active {
    border-color: #6B59A1;
    box-shadow: 0 0 0 2px rgba(107, 89, 161, 0.5);
}

.thumbnail-image {
    width: 100%;
    height: 180px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f8f9fa;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

.thumbnail-image canvas {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.thumbnail-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(248, 249, 250, 0.7);
    z-index: 2;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(107, 89, 161, 0.2);
    border-radius: 50%;
    border-top-color: #6B59A1;
    animation: spin 1s linear infinite;
}

.thumbnail-temp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 0.9rem;
    z-index: 1;
}

.thumbnail-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    font-size: 0.8rem;
    text-align: center;
}

.category-section {
    margin-bottom: 24px;
}

.category-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e2e8f0;
    color: #6B59A1;
}

/* Animation de chargement */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(107, 89, 161, 0.2);
    border-radius: 50%;
    border-top-color: #6B59A1;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .thumbnails-drawer {
        width: 100%;
    }
    
    .thumbnails-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
