/* Resource Viewer Styles */
/* Styles pour les lecteurs multimédia et prévisualisation de documents */

:root {
    --viewer-primary: #1e3a8a;
    --viewer-secondary: #64748b;
    --viewer-accent: #f59e0b;
    --viewer-success: #10b981;
    --viewer-warning: #f59e0b;
    --viewer-danger: #ef4444;
    --viewer-info: #3b82f6;
    --viewer-light: #f8fafc;
    --viewer-dark: #1e293b;
    --viewer-border: #e2e8f0;
    --viewer-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --viewer-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Container principal du viewer */
.resource-viewer-container {
    position: relative;
    width: 100%;
    height: 100vh;
    background: var(--viewer-light);
    overflow: hidden;
}

/* Styles distinctifs pour les documents */
.resource-viewer-container.document-type {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-left: 4px solid #3b82f6;
}

.resource-viewer-container.document-type .viewer-toolbar {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border-bottom: 3px solid #1e40af;
}

.resource-viewer-container.document-type .viewer-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.resource-viewer-container.document-type .viewer-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Styles distinctifs pour les vidéos */
.resource-viewer-container.video-type {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-left: 4px solid #f59e0b;
}

.resource-viewer-container.video-type .viewer-toolbar {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-bottom: 3px solid #b45309;
}

.resource-viewer-container.video-type .viewer-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.resource-viewer-container.video-type .viewer-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Indicateurs visuels pour les types de ressources */
.resource-type-indicator {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1001;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: var(--viewer-shadow);
}

.resource-type-indicator.document {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.resource-type-indicator.video {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.resource-type-indicator.audio {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.resource-type-indicator.image {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

/* Barre d'outils */
.viewer-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--viewer-border);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--viewer-shadow);
}

.viewer-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.viewer-toolbar-center {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.viewer-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Boutons de la barre d'outils */
.viewer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: 1px solid var(--viewer-border);
    border-radius: 0.375rem;
    background: white;
    color: var(--viewer-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    min-width: 2.5rem;
    height: 2.5rem;
}

.viewer-btn:hover {
    background: var(--viewer-primary);
    color: white;
    border-color: var(--viewer-primary);
    transform: translateY(-1px);
    box-shadow: var(--viewer-shadow);
}

.viewer-btn.active {
    background: var(--viewer-primary);
    color: white;
    border-color: var(--viewer-primary);
}

.viewer-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Zone de contenu principal */
.viewer-content {
    position: absolute;
    top: 4rem;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    background: white;
}

/* Panneau latéral */
.viewer-sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid var(--viewer-border);
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.viewer-sidebar.collapsed {
    transform: translateX(-100%);
}

/* Zone de lecture/visionnage */
.viewer-main {
    flex: 1;
    position: relative;
    background: #f8f9fa;
    overflow: hidden;
}

/* Conteneur du lecteur */
.viewer-player-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

/* Styles pour PDF Viewer */
.pdf-viewer {
    width: 100%;
    height: 100%;
    background: #525659;
    position: relative;
}

.pdf-canvas-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: var(--viewer-shadow-lg);
    border-radius: 0.5rem;
    overflow: hidden;
}

.pdf-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    cursor: grab;
}

.pdf-canvas:active {
    cursor: grabbing;
}

/* Contrôles PDF */
.pdf-controls {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.8);
    padding: 0.75rem 1rem;
    border-radius: 2rem;
    backdrop-filter: blur(10px);
}

.pdf-page-info {
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0 1rem;
}

.pdf-zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pdf-search-box {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--viewer-shadow);
    display: none;
}

.pdf-search-box.active {
    display: block;
}

/* Styles pour lecteurs audio/vidéo */
.media-player-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
}

.media-player {
    width: 100%;
    max-width: 1200px;
    height: auto;
    max-height: 100%;
    border-radius: 0.5rem;
    box-shadow: var(--viewer-shadow-lg);
}

/* Lecteur vidéo intégré amélioré */
.video-player-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 0.5rem;
    overflow: hidden;
}

.video-player-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Contrôles vidéo personnalisés */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-player-container:hover .video-controls {
    opacity: 1;
}

.video-controls button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.video-controls button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.video-progress {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.video-progress-bar {
    height: 100%;
    background: #f59e0b;
    border-radius: 2px;
    transition: width 0.1s ease;
}

.video-time {
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 4rem;
    text-align: center;
}

/* Lecteur audio amélioré */
.audio-player-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 2rem;
}

.audio-visualizer {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.audio-visualizer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.7; }
}

.audio-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
}

.audio-progress {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

.audio-progress-bar {
    height: 100%;
    background: #f59e0b;
    border-radius: 3px;
    transition: width 0.1s ease;
}

.audio-info {
    text-align: center;
    color: white;
}

.audio-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.audio-artist {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 1rem;
}

.audio-time-display {
    font-size: 0.875rem;
    opacity: 0.7;
    margin-top: 0.5rem;
}

/* Styles pour images */
.image-viewer {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    cursor: zoom-in;
}

.image-viewer img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: var(--viewer-shadow-lg);
    border-radius: 0.5rem;
    transition: transform 0.3s ease;
}

.image-viewer img:hover {
    transform: scale(1.02);
}

/* Styles pour documents Word/Excel */
.document-viewer {
    width: 100%;
    height: 100%;
    background: white;
    overflow: auto;
    padding: 2rem;
}

.document-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
    font-family: 'Inter', sans-serif;
}

.document-content h1,
.document-content h2,
.document-content h3,
.document-content h4,
.document-content h5,
.document-content h6 {
    color: var(--viewer-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.document-content p {
    margin-bottom: 1rem;
}

.document-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.document-content table th,
.document-content table td {
    border: 1px solid var(--viewer-border);
    padding: 0.5rem;
    text-align: left;
}

.document-content table th {
    background: var(--viewer-light);
    font-weight: 600;
}

/* Styles pour YouTube */
.youtube-player {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.youtube-iframe {
    width: 100%;
    max-width: 1200px;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    position: relative;
}

.youtube-iframe iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0.5rem;
}

/* Styles pour Facebook */
.facebook-player {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

/* Modal de prévisualisation rapide */
.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.preview-modal-content {
    background: white;
    border-radius: 1rem;
    width: 100%;
    max-width: 1200px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--viewer-shadow-lg);
    overflow: hidden;
}

.preview-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--viewer-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preview-modal-body {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.preview-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--viewer-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Panneau latéral - Informations */
.sidebar-section {
    padding: 1.5rem;
    border-bottom: 1px solid var(--viewer-border);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--viewer-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--viewer-secondary);
}

.info-value {
    font-size: 0.875rem;
    color: var(--viewer-dark);
}

/* Tags */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: var(--viewer-light);
    color: var(--viewer-primary);
    border: 1px solid var(--viewer-border);
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--viewer-light);
    border-radius: 0.5rem;
    border: 1px solid var(--viewer-border);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--viewer-primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--viewer-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Ressources similaires */
.similar-resources {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.similar-resource {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--viewer-light);
    border: 1px solid var(--viewer-border);
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--viewer-dark);
    transition: all 0.2s ease;
}

.similar-resource:hover {
    background: var(--viewer-primary);
    color: white;
    transform: translateX(4px);
}

.similar-resource-thumb {
    width: 3rem;
    height: 3rem;
    border-radius: 0.375rem;
    object-fit: cover;
    background: var(--viewer-border);
}

.similar-resource-info {
    flex: 1;
}

.similar-resource-title {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.similar-resource-type {
    font-size: 0.75rem;
    color: var(--viewer-secondary);
}

/* Boutons de partage */
.share-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--viewer-border);
    border-radius: 0.375rem;
    background: white;
    color: var(--viewer-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.share-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--viewer-shadow);
}

.share-btn.facebook:hover {
    background: #1877f2;
    color: white;
    border-color: #1877f2;
}

.share-btn.twitter:hover {
    background: #1da1f2;
    color: white;
    border-color: #1da1f2;
}

.share-btn.linkedin:hover {
    background: #0077b5;
    color: white;
    border-color: #0077b5;
}

.share-btn.whatsapp:hover {
    background: #25d366;
    color: white;
    border-color: #25d366;
}

.share-btn.email:hover {
    background: var(--viewer-primary);
    color: white;
    border-color: var(--viewer-primary);
}

/* Annotations PDF */
.pdf-annotations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.pdf-annotation {
    position: absolute;
    background: rgba(255, 255, 0, 0.3);
    border: 2px solid #ffd700;
    border-radius: 0.25rem;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pdf-annotation:hover {
    background: rgba(255, 255, 0, 0.5);
    border-color: #ffed4e;
}

.pdf-annotation.note {
    background: rgba(59, 130, 246, 0.3);
    border-color: #3b82f6;
}

/* Loading states */
.viewer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--viewer-secondary);
}

.viewer-spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid var(--viewer-border);
    border-top: 3px solid var(--viewer-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error states */
.viewer-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--viewer-danger);
    padding: 2rem;
}

.viewer-error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.viewer-error-message {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.viewer-error-details {
    font-size: 0.875rem;
    color: var(--viewer-secondary);
}

/* Responsive design */
@media (max-width: 768px) {
    .viewer-sidebar {
        position: fixed;
        top: 4rem;
        left: 0;
        bottom: 0;
        width: 100%;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .viewer-sidebar.open {
        transform: translateX(0);
    }
    
    .viewer-main {
        width: 100%;
    }
    
    .preview-modal {
        padding: 1rem;
    }
    
    .preview-modal-content {
        height: 90vh;
    }
    
    .viewer-toolbar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .viewer-toolbar-center {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .viewer-toolbar {
        padding: 0.5rem;
    }
    
    .viewer-btn {
        min-width: 2rem;
        height: 2rem;
        padding: 0.25rem;
    }
    
    .pdf-controls {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .share-buttons {
        justify-content: center;
    }
}

/* Thème sombre */
@media (prefers-color-scheme: dark) {
    :root {
        --viewer-light: #1e293b;
        --viewer-dark: #f8fafc;
        --viewer-border: #334155;
    }
    
    .resource-viewer-container {
        background: var(--viewer-light);
    }
    
    .viewer-toolbar {
        background: rgba(30, 41, 59, 0.95);
        border-bottom-color: var(--viewer-border);
    }
    
    .viewer-sidebar {
        background: var(--viewer-light);
        border-right-color: var(--viewer-border);
    }
    
    .viewer-main {
        background: #0f172a;
    }
    
    .document-viewer {
        background: var(--viewer-light);
        color: var(--viewer-dark);
    }
    
    .preview-modal-content {
        background: var(--viewer-light);
        color: var(--viewer-dark);
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Accessibilité */
.viewer-btn:focus,
.share-btn:focus {
    outline: 2px solid var(--viewer-primary);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Print styles */
@media print {
    .viewer-toolbar,
    .viewer-sidebar,
    .preview-modal {
        display: none !important;
    }
    
    .viewer-main {
        position: static !important;
        height: auto !important;
    }
    
    .resource-viewer-container {
        height: auto !important;
    }
}


