/**
 * Styles pour le système de gestion des bonnes feuilles
 * BookConnect - Manuscrits
 */

/* Section d'upload */
.upload-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 2px dashed #dee2e6;
    transition: all 0.3s ease;
}

.upload-section:hover {
    border-color: #0d6efd;
    background: linear-gradient(135deg, #e7f1ff 0%, #d0e7ff 100%);
}

.upload-section .form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Section des fichiers */
.files-section {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tableau des fichiers */
.files-section .table {
    margin-bottom: 0;
}

.files-section .table tbody tr {
    transition: all 0.2s ease;
}

.files-section .table tbody tr:hover {
    background-color: #f8f9fa;
    transform: translateX(5px);
}

.files-section .table tbody tr.table-success {
    background-color: #d1e7dd !important;
}

.files-section .table tbody tr.table-success:hover {
    background-color: #c3e0cf !important;
}

/* Boutons d'action */
.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.btn-group-sm .btn:hover {
    transform: scale(1.1);
}

.btn-group-sm .btn-outline-primary:hover {
    background-color: #0d6efd;
    color: white;
}

.btn-group-sm .btn-outline-success:hover {
    background-color: #198754;
    color: white;
}

.btn-group-sm .btn-outline-warning:hover {
    background-color: #ffc107;
    color: #000;
}

.btn-group-sm .btn-outline-danger:hover {
    background-color: #dc3545;
    color: white;
}

/* Accordéon */
.accordion-button {
    font-weight: 500;
    transition: all 0.3s ease;
}

.accordion-button:not(.collapsed) {
    background-color: #e7f1ff;
    color: #0d6efd;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.125);
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.accordion-button::after {
    transition: transform 0.3s ease;
}

.accordion-body {
    padding: 1.5rem;
    background-color: #f8f9fa;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    transition: all 0.2s ease;
}

.badge:hover {
    transform: scale(1.05);
}

/* Alertes */
.alert {
    border-radius: 0.5rem;
    border-left: 4px solid;
}

.alert-success {
    border-left-color: #198754;
    background-color: #d1e7dd;
}

.alert-info {
    border-left-color: #0dcaf0;
    background-color: #cff4fc;
}

.alert-warning {
    border-left-color: #ffc107;
    background-color: #fff3cd;
}

.alert-danger {
    border-left-color: #dc3545;
    background-color: #f8d7da;
}

/* Modal de prévisualisation */
#previewModal .modal-dialog {
    max-width: 90%;
}

#previewModal .modal-content {
    border-radius: 0.5rem;
    overflow: hidden;
}

#previewModal .modal-header {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    border-bottom: none;
}

#previewModal .modal-body {
    padding: 0;
}

#pdfPreviewContainer {
    background-color: #525659;
    position: relative;
}

#pdfPreviewFrame {
    width: 100%;
    height: 100%;
    border: none;
}

#previewModal .modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Cartes */
.card {
    border-radius: 0.5rem;
    overflow: hidden;
}

.card-header {
    font-weight: 600;
    border-bottom: 2px solid rgba(0, 0, 0, 0.125);
}

.card.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
    transition: box-shadow 0.3s ease;
}

.card.shadow-sm:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Icônes */
.fas, .far {
    transition: all 0.2s ease;
}

.btn:hover .fas,
.btn:hover .far {
    transform: scale(1.1);
}

/* Conseils */
.card.bg-light {
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.card.bg-light:hover {
    border-color: #0d6efd;
    box-shadow: 0 0.125rem 0.25rem rgba(13, 110, 253, 0.25);
}

.card.bg-light ul {
    padding-left: 1.2rem;
}

.card.bg-light ul li {
    margin-bottom: 0.25rem;
    color: #495057;
}

/* Responsive */
@media (max-width: 768px) {
    .upload-section {
        padding: 1rem;
    }
    
    .files-section .table {
        font-size: 0.875rem;
    }
    
    .btn-group-sm .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
    
    #previewModal .modal-dialog {
        max-width: 95%;
        margin: 0.5rem;
    }
    
    #pdfPreviewContainer {
        height: 70vh !important;
    }
}

@media (max-width: 576px) {
    .card-header h5 {
        font-size: 1rem;
    }
    
    .badge {
        font-size: 0.75rem;
    }
    
    .alert {
        font-size: 0.875rem;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
    }
    
    .btn-group .btn {
        margin-bottom: 0.25rem;
        border-radius: 0.25rem !important;
    }
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* États de chargement */
.uploading {
    pointer-events: none;
    opacity: 0.6;
    position: relative;
}

.uploading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2rem;
    height: 2rem;
    margin: -1rem 0 0 -1rem;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tooltips personnalisés */
[title] {
    position: relative;
    cursor: help;
}

/* Drag and drop (pour future implémentation) */
.upload-section.drag-over {
    border-color: #0d6efd;
    background-color: #e7f1ff;
    border-style: solid;
}

.upload-section.drag-over::before {
    content: '📄 Déposez votre fichier PDF ici';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    font-weight: 600;
    color: #0d6efd;
    pointer-events: none;
}

/* Indicateurs de statut */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-indicator.active {
    background-color: #198754;
    box-shadow: 0 0 0 2px rgba(25, 135, 84, 0.3);
}

.status-indicator.archived {
    background-color: #6c757d;
}

/* Transitions globales */
* {
    transition-property: background-color, border-color, color, box-shadow, transform;
    transition-duration: 0.2s;
    transition-timing-function: ease;
}

/* Print styles */
@media print {
    .upload-section,
    .btn,
    .accordion-button,
    #previewModal {
        display: none !important;
    }
    
    .files-section .table {
        page-break-inside: avoid;
    }
}
