/* Styles pour le plugin PDF */
.pdf-buttons-container {
    margin: 15px 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.pdf-buttons-container h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
}

.generate-pdf, .download-pdf {
    display: inline-block;
    padding: 10px 20px;
    margin: 5px;
    background: #0073aa;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.generate-pdf:hover, .download-pdf:hover {
    background: #005a87;
    color: white;
    text-decoration: none;
}

.download-pdf {
    background: #28a745;
}

.download-pdf:hover {
    background: #218838;
}

.generate-pdf:disabled, .download-pdf:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Responsive */
@media (max-width: 768px) {
    .generate-pdf, .download-pdf {
        display: block;
        width: 100%;
        margin: 5px 0;
        text-align: center;
    }
}

/* ========================================
   STYLES POUR LE POPUP PDF
   ======================================== */

/* Modal popup - état initial (caché) */
.pdf-popup-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* Modal popup - état actif */
.pdf-popup-modal.pdf-popup-active {
    opacity: 1;
    visibility: visible;
}

/* Overlay */
.pdf-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

/* Contenu du modal */
.pdf-popup-content {
    position: relative;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* En-tête du modal */
.pdf-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.pdf-popup-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.pdf-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.pdf-popup-close:hover {
    background: #e9ecef;
    color: #333;
}

/* Corps du modal */
.pdf-popup-body {
    flex: 1;
    padding: 20px;
    position: relative;
    min-height: 400px;
    overflow: auto;
}

/* État de chargement */
.pdf-popup-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.pdf-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.pdf-popup-loading p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Container de l'image */
.pdf-popup-image-container {
    width: 100%;
    height: 100%;
    min-height: 400px;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-popup-image {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    width: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Container de l'iframe (fallback) */
.pdf-popup-iframe-container {
    width: 100%;
    height: 100%;
    min-height: 400px;
    padding: 10px;
    box-sizing: border-box;
}

.pdf-popup-iframe {
    width: 100%;
    height: 100%;
    border: none;
    min-height: 400px;
}

/* État d'erreur */
.pdf-popup-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.pdf-popup-error p {
    margin: 0 0 15px 0;
    color: #dc3545;
    font-size: 14px;
}

.pdf-popup-retry {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.pdf-popup-retry:hover {
    background: #c82333;
}

/* Bloc informatif */
.pdf-popup-info {
    padding: 15px 20px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-top: 1px solid #e1bee7;
    border-bottom: 1px solid #e1bee7;
}

.pdf-popup-info-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 100%;
}

.pdf-popup-info-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.pdf-popup-info p {
    margin: 0;
    color: #5e35b1;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

/* Pied du modal */
.pdf-popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.pdf-popup-download,
.pdf-popup-close-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pdf-popup-download {
    background: #28a745;
    color: white;
}

.pdf-popup-download:hover {
    background: #218838;
}

.pdf-popup-close-btn {
    background: #28a745;
    color: white;
}

.pdf-popup-close-btn:hover {
    background: #218838;
}

/* Responsive pour le popup : updated */
@media (max-width: 768px) {
    .pdf-popup-content {
        width: 95vw;
        max-height: 95dvh;
    }
    
    .pdf-popup-header {
        padding: 15px;
    }
    
    .pdf-popup-title {
        font-size: 16px;
    }
    
    .pdf-popup-body {
        min-height: 300px;
        padding: 10px;
    }
    
    .pdf-popup-image-container {
        min-height: 300px;
        padding: 5px;
    }
    
    .pdf-popup-image {
        max-width: 100%;
        max-height: 70vh;
        width: auto;
        height: auto;
    }
    
    .pdf-popup-iframe {
        min-height: 300px;
    }
    
    .pdf-popup-info {
        padding: 12px 15px;
    }
    
    .pdf-popup-info-content {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .pdf-popup-info-icon {
        font-size: 18px;
    }
    
    .pdf-popup-info p {
        font-size: 13px;
    }
    
    .pdf-popup-footer {
        padding: 15px;
        flex-direction: column;
    }
    
    .pdf-popup-close-btn {
        width: 100%;
        margin: 2px 0;
    }
}

/* Animation d'entrée */
.pdf-popup-modal.pdf-popup-active .pdf-popup-content {
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}