/* Imagilire PDF Import - Styles pour l'interface d'importation PDF/Image */

/* ========================================
   CONTENEUR PRINCIPAL PDF IMPORT
   ======================================== */

.pdf-import-container {
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #36B1B3 0%, #2a9799 100%);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(54, 177, 179, 0.2);
}

.pdf-import-container h2 {
    color: #ffffff;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    text-align: center;
}

/* ========================================
   ZONE D'UPLOAD AMÉLIORÉE
   ======================================== */

.pdf-upload-zone {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    border: 3px dashed #36B1B3;
    border-radius: 10px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.pdf-upload-zone:hover {
    border-color: #D4542D;
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(54, 177, 179, 0.15);
}

.pdf-upload-zone.drag-over {
    border-color: #2ecc71;
    background: rgba(46, 204, 113, 0.05);
    transform: scale(1.02);
}

.pdf-upload-zone.processing {
    pointer-events: none;
    opacity: 0.7;
}

.pdf-upload-icon {
    font-size: 3rem;
    color: #36B1B3;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.pdf-upload-zone:hover .pdf-upload-icon {
    transform: scale(1.1);
}

.pdf-upload-text {
    font-size: 1.1rem;
    color: #2c3e50;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.pdf-upload-hint {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 0.5rem;
}

.pdf-upload-formats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.format-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #ecf0f1;
    color: #34495e;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.format-badge i {
    font-size: 0.85rem;
}

/* ========================================
   BOUTONS D'ACTION (CAMÉRA + UPLOAD)
   ======================================== */

.pdf-upload-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

.camera-btn {
    background: linear-gradient(135deg, #F7B731 0%, #e5a821 100%);
    color: #333;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(247, 183, 49, 0.3);
}

.camera-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(247, 183, 49, 0.4);
}

.camera-btn i {
    font-size: 1.1rem;
}

/* ========================================
   PRÉVISUALISATION IMAGE/PDF
   ======================================== */

.pdf-preview-container {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    max-height: 400px;
    overflow: hidden;
}

.pdf-preview-container.active {
    display: block;
    animation: slideIn 0.3s ease;
}

.pdf-preview-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pdf-preview-content {
    position: relative;
    background: #f8f9fa;
    border-radius: 6px;
    overflow: auto;
    max-height: 320px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pdf-preview-image {
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
    border-radius: 6px;
}

.pdf-preview-canvas {
    max-width: 100%;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pdf-preview-loading {
    padding: 2rem;
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
}

.pdf-preview-pages {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.pdf-page-nav {
    background: #36B1B3;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.pdf-page-nav:hover:not(:disabled) {
    background: #2a9799;
    transform: scale(1.05);
}

.pdf-page-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pdf-page-info {
    font-size: 0.85rem;
    color: #2c3e50;
    font-weight: 500;
}

/* ========================================
   INFORMATIONS FICHIER CHARGÉ
   ======================================== */

.pdf-file-info {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    border-left: 4px solid #36B1B3;
}

.pdf-file-info.active {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pdf-file-details {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pdf-file-icon {
    font-size: 2rem;
    color: #36B1B3;
}

.pdf-file-meta {
    flex: 1;
}

.pdf-file-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.pdf-file-size {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.pdf-file-remove {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-file-remove:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* ========================================
   BARRE DE PROGRESSION EXTRACTION
   ======================================== */

.pdf-extraction-progress {
    display: none;
    margin-top: 1rem;
}

.pdf-extraction-progress.active {
    display: block;
}

.pdf-progress-bar {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.pdf-progress-fill {
    background: linear-gradient(90deg, #2ecc71 0%, #27ae60 100%);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}

.pdf-progress-text {
    color: #ffffff;
    font-size: 0.9rem;
    text-align: center;
    font-weight: 500;
}

.pdf-progress-percentage {
    font-weight: 700;
    color: #2ecc71;
}

/* ========================================
   STATISTIQUES D'EXTRACTION
   ======================================== */

.pdf-extraction-stats {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.pdf-extraction-stats.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.stats-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
}

.stat-item {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 6px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #36B1B3;
    margin-bottom: 0.25rem;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.extraction-method-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #ecf0f1;
    color: #2c3e50;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.75rem;
}

.extraction-method-badge.method-direct {
    background: #d5f4e6;
    color: #27ae60;
}

.extraction-method-badge.method-ocr {
    background: #fff3cd;
    color: #f39c12;
}

/* ========================================
   BOUTONS D'ACTION
   ======================================== */

.pdf-action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.pdf-extract-btn {
    background: linear-gradient(135deg, #36B1B3 0%, #2a9799 100%);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(54, 177, 179, 0.3);
}

.pdf-extract-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(54, 177, 179, 0.4);
}

.pdf-extract-btn:active:not(:disabled) {
    transform: translateY(0);
}

.pdf-extract-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pdf-extract-btn i {
    font-size: 1.1rem;
}

/* ========================================
   MESSAGES ET NOTIFICATIONS
   ======================================== */

.pdf-message {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    display: none;
    border-left: 4px solid #3498db;
}

.pdf-message.active {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
}

.pdf-message.success {
    border-left-color: #2ecc71;
    background: rgba(46, 204, 113, 0.1);
}

.pdf-message.error {
    border-left-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.pdf-message.warning {
    border-left-color: #f39c12;
    background: rgba(243, 156, 18, 0.1);
}

.pdf-message-icon {
    font-size: 1.5rem;
}

.pdf-message.success .pdf-message-icon {
    color: #2ecc71;
}

.pdf-message.error .pdf-message-icon {
    color: #e74c3c;
}

.pdf-message.warning .pdf-message-icon {
    color: #f39c12;
}

.pdf-message-text {
    flex: 1;
    color: #2c3e50;
    font-size: 0.9rem;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .pdf-import-container {
        padding: 1rem;
    }

    .pdf-import-container h2 {
        font-size: 1.25rem;
    }

    .pdf-upload-zone {
        padding: 2rem 1rem;
        min-height: 160px;
    }

    .pdf-upload-icon {
        font-size: 2.5rem;
    }

    .pdf-upload-text {
        font-size: 1rem;
    }

    .pdf-upload-hint {
        font-size: 0.85rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .pdf-action-buttons {
        flex-direction: column;
    }

    .pdf-extract-btn {
        width: 100%;
        justify-content: center;
    }

    .pdf-file-details {
        flex-direction: column;
        text-align: center;
    }

    .pdf-file-icon {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .pdf-upload-formats {
        gap: 0.25rem;
    }

    .format-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   ANIMATIONS ET TRANSITIONS
   ======================================== */

.pdf-processing-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   ACCESSIBILITÉ
   ======================================== */

.pdf-upload-zone:focus-within {
    outline: 2px solid #36B1B3;
    outline-offset: 2px;
}

.pdf-extract-btn:focus {
    outline: 2px solid #36B1B3;
    outline-offset: 2px;
}

/* Mode sombre (si le système le demande) */
@media (prefers-color-scheme: dark) {
    .pdf-upload-zone {
        background: rgba(44, 62, 80, 0.95);
        border-color: #667eea;
    }

    .pdf-upload-zone:hover {
        background: rgba(44, 62, 80, 1);
    }

    .pdf-upload-text {
        color: #ecf0f1;
    }

    .pdf-upload-hint {
        color: #95a5a6;
    }

    .pdf-file-info,
    .pdf-extraction-stats,
    .pdf-message {
        background: rgba(44, 62, 80, 0.95);
    }

    .pdf-file-name,
    .stats-title,
    .pdf-message-text {
        color: #ecf0f1;
    }

    .stat-item {
        background: rgba(52, 73, 94, 0.5);
    }

    .format-badge {
        background: rgba(52, 73, 94, 0.8);
        color: #ecf0f1;
    }
}

/* Animations de réduction de mouvement */
@media (prefers-reduced-motion: reduce) {
    .pdf-upload-zone,
    .pdf-extract-btn,
    .pdf-file-info,
    .pdf-extraction-stats,
    .pdf-message {
        animation: none;
        transition: none;
    }

    .pdf-upload-zone:hover,
    .pdf-extract-btn:hover {
        transform: none;
    }
}
