/* PDF Viewer Pro v2 - Styles pour l'extension ESM */

/* Panneau coulissant */
.pdfv-sliding-panel {
    position: fixed;
    top: 0;
    left: -400px;
    width: 400px;
    height: 100vh;
    background: #fff;
    border-right: 1px solid #ddd;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: left 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pdfv-sliding-panel.open {
    left: 0;
}

/* En-tête du panneau */
.pdfv-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.pdfv-panel-tabs {
    display: flex;
    gap: 8px;
}

.pdfv-panel-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.pdfv-panel-tab:hover {
    background: #f0f0f0;
    border-color: #999;
}

.pdfv-panel-tab.active {
    background: #007cba;
    color: #fff;
    border-color: #007cba;
}

.pdfv-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pdfv-panel-close:hover {
    background: #f0f0f0;
    border-color: #999;
}

/* Contenu du panneau */
.pdfv-panel-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.pdfv-panel-section {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px;
    overflow-y: auto;
    display: none;
}

.pdfv-panel-section.active {
    display: block;
}

/* Vignettes */
.pdfv-thumbnails-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    padding: 8px 0;
}

.pdfv-thumbnail {
    position: relative;
    aspect-ratio: 3/4;
    border: 2px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdfv-thumbnail:hover {
    border-color: #007cba;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.2);
}

.pdfv-thumbnail.active {
    border-color: #007cba;
    background: #e7f3ff;
}

.pdfv-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pdfv-thumbnail span {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

/* Table des matières */
.pdfv-toc-container {
    padding: 8px 0;
}

.pdfv-toc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    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;
}

.pdfv-toc-item.active {
    background: #e7f3ff;
    border-left-color: #007cba;
}

.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; }

.pdfv-toc-title {
    flex: 1;
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

.pdfv-toc-page {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    margin-left: 8px;
}

/* Barre de recherche */
.pdfv-search-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    flex-wrap: wrap;
}

.pdfv-search-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.pdfv-search-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

.pdfv-search-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pdfv-search-prev,
.pdfv-search-next,
.pdfv-search-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    font-weight: bold;
}

.pdfv-search-prev:hover,
.pdfv-search-next:hover,
.pdfv-search-close:hover {
    background: #f0f0f0;
    border-color: #999;
}

.pdfv-search-count {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    min-width: 40px;
    text-align: center;
}

/* États de chargement et d'erreur */
.pdfv-thumbnails-loading,
.pdfv-toc-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: #666;
    font-style: italic;
}

.pdfv-thumbnails-error,
.pdfv-toc-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: #d63638;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .pdfv-sliding-panel {
        width: 100vw;
        left: -100vw;
    }
    
    .pdfv-panel-header {
        padding: 12px;
    }
    
    .pdfv-panel-tab {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .pdfv-thumbnails-container {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .pdfv-search-container {
        padding: 6px 12px;
    }
    
    .pdfv-search-input {
        min-width: 150px;
        font-size: 12px;
    }
}

/* 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;
    }
}

/* Animations */
.pdfv-sliding-panel {
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pdfv-thumbnail,
.pdfv-toc-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Accessibilité */
.pdfv-panel-tab:focus,
.pdfv-panel-close:focus,
.pdfv-thumbnail:focus,
.pdfv-toc-item:focus,
.pdfv-search-input:focus,
.pdfv-search-prev:focus,
.pdfv-search-next:focus,
.pdfv-search-close:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Support des thèmes sombres */
@media (prefers-color-scheme: dark) {
    .pdfv-sliding-panel {
        background: #2d2d2d;
        border-color: #444;
    }
    
    .pdfv-panel-header {
        background: #3d3d3d;
        border-color: #444;
    }
    
    .pdfv-panel-tab {
        background: #4d4d4d;
        border-color: #555;
        color: #fff;
    }
    
    .pdfv-panel-tab:hover {
        background: #5d5d5d;
        border-color: #666;
    }
    
    .pdfv-panel-tab.active {
        background: #007cba;
        color: #fff;
    }
    
    .pdfv-panel-close {
        background: #4d4d4d;
        border-color: #555;
        color: #fff;
    }
    
    .pdfv-panel-close:hover {
        background: #5d5d5d;
        border-color: #666;
    }
    
    .pdfv-thumbnail {
        background: #3d3d3d;
        border-color: #555;
    }
    
    .pdfv-thumbnail:hover {
        border-color: #007cba;
    }
    
    .pdfv-thumbnail.active {
        background: #1a3d5c;
    }
    
    .pdfv-toc-item {
        color: #fff;
    }
    
    .pdfv-toc-item:hover {
        background: #3d3d3d;
    }
    
    .pdfv-toc-item.active {
        background: #1a3d5c;
    }
    
    .pdfv-toc-title {
        color: #fff;
    }
    
    .pdfv-toc-page {
        color: #ccc;
    }
    
    .pdfv-search-container {
        background: #3d3d3d;
        border-color: #444;
    }
    
    .pdfv-search-input {
        background: #4d4d4d;
        border-color: #555;
        color: #fff;
    }
    
    .pdfv-search-input::placeholder {
        color: #999;
    }
    
    .pdfv-search-prev,
    .pdfv-search-next,
    .pdfv-search-close {
        background: #4d4d4d;
        border-color: #555;
        color: #fff;
    }
    
    .pdfv-search-prev:hover,
    .pdfv-search-next:hover,
    .pdfv-search-close:hover {
        background: #5d5d5d;
        border-color: #666;
    }
    
    .pdfv-search-count {
        color: #ccc;
    }
    
    .pdfv-thumbnails-loading,
    .pdfv-toc-loading {
        color: #ccc;
    }
    
    .pdfv-thumbnails-error,
    .pdfv-toc-error {
        color: #ff6b6b;
    }
}
