/**
 * PDF Viewer Pro - Panneau coulissant
 * Styles pour l'interface moderne avec panneaux coulissants
 */

/* Panneau coulissant principal */
.pdfv-sliding-panel {
    position: fixed;
    top: 0;
    left: -350px;
    width: 350px;
    height: 100vh;
    background: #fff;
    border-right: 1px solid #ddd;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 2147483000; /* au-dessus de la plupart des toolbars/themes */
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    will-change: transform; /* hint perf */
    contain: layout style paint; /* isolement rendu */
}

.pdfv-sliding-panel.open {
    transform: translateX(350px);
}

/* En-tête du panneau */
.pdfv-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

/* Onglets */
.pdfv-panel-tabs {
    display: flex;
    gap: 5px;
}

.pdfv-panel-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #666;
}

.pdfv-panel-tab:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.pdfv-panel-tab.active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.pdfv-panel-tab .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Bouton fermer */
.pdfv-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
}

.pdfv-panel-close:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.pdfv-panel-close .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Contenu du panneau */
.pdfv-panel-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

/* Sections du panneau */
.pdfv-panel-section {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.pdfv-panel-section.active {
    opacity: 1;
    visibility: visible;
}

/* Section vignettes */
.pdfv-thumbnails-section {
    padding: 20px;
}

.pdfv-thumbnails-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.pdfv-thumbnail {
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
}

.pdfv-thumbnail:hover {
    border-color: #0073aa;
    transform: scale(1.05);
}

.pdfv-thumbnail.active {
    border-color: #0073aa;
    background: #e7f3ff;
}

.pdfv-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Section TOC */
.pdfv-toc-section {
    padding: 20px;
}

.pdfv-toc-container {
    max-height: 100%;
    overflow-y: auto;
}

.pdfv-toc-item {
    padding: 8px 12px;
    margin: 2px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.pdfv-toc-item:hover {
    background: #f0f0f0;
    border-left-color: #0073aa;
}

.pdfv-toc-item.active {
    background: #e7f3ff;
    border-left-color: #0073aa;
    font-weight: 500;
}

.pdfv-toc-item.level-1 { padding-left: 12px; }
.pdfv-toc-item.level-2 { padding-left: 24px; }
.pdfv-toc-item.level-3 { padding-left: 36px; }
.pdfv-toc-item.level-4 { padding-left: 48px; }

/* Messages de chargement */
.pdfv-thumbnails-loading,
.pdfv-toc-loading {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

/* Boutons de la barre d'outils */
.pdfv-toolbar-btn.active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* Responsive */
@media (max-width: 768px) {
    .pdfv-sliding-panel {
        width: 100vw;
        left: -100vw;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .pdfv-sliding-panel.open {
        transform: translateX(100vw);
    }
    
    .pdfv-panel-header {
        padding: 10px 15px;
    }
    
    .pdfv-panel-tab {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .pdfv-thumbnails-container {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 8px;
    }
}

/* Animation d'ouverture/fermeture */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-100%);
    }
}

/* Overlay pour mobile */
@media (max-width: 768px) {
    .pdfv-sliding-panel.open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
        pointer-events: none;
    }
}
