/**
 * Styles pour le bloc Visionneuse PDF
 */

.pdf-viewer-block {
    margin: 2rem 0;
}

/* Container principal */
.pdf-container {
    position: relative;
    background: #f8f9fa;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Wrapper du viewer */
.pdf-viewer-wrapper {
    position: relative;
    width: 100%;
    min-height: 400px;
}

.pdf-viewer-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Message de fallback */
.fallback-message {
    background: #f8f9fa;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
}

/* Loading indicator */
.pdf-loading {
    background: rgba(248, 249, 250, 0.95);
    backdrop-filter: blur(2px);
}

/* Header du PDF */
.pdf-header {
    margin-bottom: 1rem;
}

.pdf-title {
    color: #1f2937;
    font-weight: 600;
    font-size: 1.25rem;
    line-height: 1.4;
}

.pdf-description {
    color: #6b7280;
    line-height: 1.6;
}

/* Footer avec informations et bouton */
.pdf-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.pdf-info {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: #6b7280;
}

.pdf-filename {
    display: flex;
    align-items: center;
}

/* Bouton de téléchargement */
.pdf-actions a {
    background: #6646ff;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(102, 70, 255, 0.2);
}

.pdf-actions a:hover {
    background: #5439d8;
    box-shadow: 0 4px 8px rgba(102, 70, 255, 0.3);
    transform: translateY(-1px);
}

.pdf-actions a:active {
    transform: translateY(0);
}

/* Actions mobiles */
.pdf-mobile-actions {
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.pdf-mobile-actions button {
    background: #f3f4f6;
    color: #374151;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pdf-mobile-actions button:hover {
    background: #e5e7eb;
}

.pdf-mobile-actions button:active {
    background: #d1d5db;
}

/* Responsive */
@media (max-width: 640px) {
    .pdf-viewer-block {
        margin: 1rem 0;
    }

    .pdf-viewer-wrapper {
        min-height: 300px;
        height: 50vh;
    }

    .pdf-footer {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .pdf-actions {
        width: 100%;
    }

    .pdf-actions a {
        justify-content: center;
        width: 100%;
    }

    .pdf-title {
        font-size: 1.125rem;
    }
}

/* États de chargement et d'erreur */
.pdf-viewer-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(248, 249, 250, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-viewer-wrapper.error {
    background: #fef2f2;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Animation de chargement */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Couleurs GRIM */
:root {
    --grim-violet: #6646ff;
    --grim-violet-hover: #5439d8;
}

.bg-grim-violet {
    background-color: var(--grim-violet);
}

.text-grim-violet {
    color: var(--grim-violet);
}

/* Alignements */
.alignwide .pdf-viewer-block,
.alignfull .pdf-viewer-block {
    max-width: none;
}

.aligncenter .pdf-viewer-block {
    margin-left: auto;
    margin-right: auto;
}

/* Mode plein écran */
.pdf-fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: white;
}

.pdf-fullscreen-mode .pdf-viewer-wrapper {
    height: calc(100vh - 60px) !important;
}

.pdf-fullscreen-mode .pdf-footer,
.pdf-fullscreen-mode .pdf-header {
    padding: 1rem;
    background: white;
    border-bottom: 1px solid #e5e7eb;
}

/* Focus et accessibilité */
.pdf-actions a:focus,
.pdf-mobile-actions button:focus {
    outline: 2px solid var(--grim-violet);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .pdf-mobile-actions,
    .pdf-actions {
        display: none !important;
    }

    .pdf-viewer-wrapper {
        height: auto !important;
        min-height: 400px !important;
    }
}