@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

#documents ,
#recherche {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #F8FAFC;
    color: #111827;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#documents .page-band ,
#recherche .page-band {
    background: #FFFFFF;
    border-bottom: 1px solid #E5E7EB;
    padding: 40px 0 32px;
}

#documents .page-band h1 ,
#recherche .page-band h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #111827;
    margin: 0;
    letter-spacing: -0.03em;
}

#documents .page-body ,
#recherche .page-body {
    /* Haut et bas seulement : « padding: 40px 0 80px » annulait les marges
       latérales du .container, collant tout le contenu aux bords sur mobile. */
    padding-top: 40px;
    padding-bottom: 80px;
}

#documents .search-input-group ,
#recherche .search-input-group {
    max-width: 100%;
    margin: 0 auto 32px;
    position: relative;
    display: flex;
    align-items: stretch;
    background: #FFFFFF;
    border-radius: 18px;
    border: 2px solid #E5E7EB;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    overflow: hidden;
}

#documents .search-input-group:focus-within ,
#recherche .search-input-group:focus-within {
    border-color: #DC2626;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08);
}

#documents .search_input ,
#recherche .search_input {
    border-radius: 18px 0 0 18px !important;
    border: none !important;
    background: transparent !important;
    padding: 18px 24px !important;
    font-size: 1rem !important;
    flex: 1;
    box-shadow: none !important;
    outline: none !important;
    min-width: 0;
    color: #111827;
}

#documents .search_input:focus ,
#recherche .search_input:focus {
    box-shadow: none !important;
    outline: none !important;
}

#documents .search_icon ,
#recherche .search_icon {
    border-radius: 0 18px 18px 0;
    background: #DC2626;
    border: none;
    padding: 18px 28px;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    color: #FFFFFF;
    cursor: pointer;
    margin-left: 0;
    box-shadow: none;
    outline: none;
}

#documents .search_icon:hover ,
#recherche .search_icon:hover {
    background: #B91C1C;
}

#documents .search_icon:focus ,
#recherche .search_icon:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15);
}

#documents .dropdown-container ,
#recherche .dropdown-container {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

#documents .dropdown ,
#recherche .dropdown {
    flex: 1;
    min-width: 200px;
    position: relative;
    z-index: 1000;
}

#documents .dropdown-toggle ,
#recherche .dropdown-toggle {
    width: 100%;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    color: #374151;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#documents .dropdown-toggle:hover ,
#recherche .dropdown-toggle:hover {
    border-color: #DC2626;
    color: #DC2626;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.06);
}

#documents .dropdown-toggle::after ,
#recherche .dropdown-toggle::after {
    border-top-color: #6B7280;
    border-bottom-color: #6B7280;
    margin-left: 8px;
}

#documents .dropdown-menu ,
#recherche .dropdown-menu {
    width: 100%;
    border-radius: 14px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
    padding: 8px;
    min-width: 100%;
    background: #FFFFFF;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 9999;
    margin-top: 8px;
}

#documents .dropdown-item ,
#recherche .dropdown-item {
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.88rem;
    color: #374151;
    transition: all 0.15s ease;
    margin-bottom: 2px;
}

#documents .dropdown-item:hover ,
#recherche .dropdown-item:hover {
    background: #F9FAFB;
    color: #DC2626;
}

#documents .dropdown-item.disabled ,
#recherche .dropdown-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

#documents #reset-filters ,
#recherche #reset-filters {
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    color: #374151;
    padding: 12px 20px;
    font-weight: 500;
    transition: all 0.2s ease;
    align-self: center;
}

#documents #reset-filters:hover ,
#recherche #reset-filters:hover {
    border-color: #DC2626;
    color: #DC2626;
    background: #FFFFFF;
}

#documents .table-container ,
#recherche .table-container {
    background: #FFFFFF;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    border: 1px solid #E5E7EB;
}

#documents .document-card ,
#recherche .document-card {
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease;
    height: 100%;
    margin-bottom: 24px;
}

#documents .document-card .card ,
#recherche .document-card .card {
    border-radius: 20px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
    height: 100%;
    background: #FFFFFF;
}

#documents .document-card:hover .card ,
#recherche .document-card:hover .card {
    transform: translateY(-8px);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.06);
    border-color: #DC2626;
}

#documents .document-card .card-visuel ,
#recherche .document-card .card-visuel {
    height: 180px;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

#documents .document-card .card-visuel img ,
#recherche .document-card .card-visuel img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#documents .document-card:hover .card-visuel img ,
#recherche .document-card:hover .card-visuel img {
    transform: scale(1.06);
}

#documents .document-card .card-visuel .file-icon ,
#recherche .document-card .card-visuel .file-icon {
    font-size: 3rem;
    color: #DC2626;
    opacity: 0.9;
}

#documents .card-type-badge ,
#recherche .card-type-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.4;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

#documents .card-downloads ,
#recherche .card-downloads {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: #9CA3AF;
    font-weight: 500;
}

#documents .card-downloads i ,
#recherche .card-downloads i {
    font-size: 0.72rem;
}

#documents .card-title ,
#recherche .card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.003em;
}

#documents .card-title a ,
#recherche .card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

#documents .card-title a:hover ,
#recherche .card-title a:hover {
    color: #DC2626;
}

#documents .card-date ,
#recherche .card-date {
    font-size: 0.8rem;
    color: #9CA3AF;
    font-weight: 500;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #E5E7EB;
}

#documents #documents_count ,
#recherche #documents_count {
    color: #6B7280;
    font-size: 0.9rem;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #E5E7EB;
}

#documents #total_documents ,
#recherche #total_documents {
    color: #374151;
    font-weight: 600;
    font-size: 0.9rem;
}

#documents .pagination ,
#recherche .pagination {
    gap: 8px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

#documents .pagination .page-link ,
#recherche .pagination .page-link {
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    color: #374151;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin: 0 3px;
    background: #FFFFFF;
    min-width: 40px;
    text-align: center;
    padding: 8px 12px;
}

#documents .pagination .page-item.active .page-link ,
#recherche .pagination .page-item.active .page-link {
    background: #DC2626;
    border-color: #DC2626;
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}

#documents .pagination .page-link:hover ,
#recherche .pagination .page-link:hover {
    background: #DC2626;
    border-color: #DC2626;
    color: #FFFFFF;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}

#documents #no-results-message ,
#recherche #no-results-message {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    border: 1px solid #E5E7EB;
}

#documents .text-center ,
#recherche .text-center {
    color: #6B7280;
    font-size: 0.9rem;
}

#documents .download-btn ,
#recherche .download-btn {
    border-radius: 50%;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 1rem;
    font-weight: 600;
    background: #DC2626;
    border: none;
    color: #FFFFFF;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    text-decoration: none;
    flex-shrink: 0;
}

#documents .download-btn:hover ,
#recherche .download-btn:hover {
    background: #B91C1C;
    color: #FFFFFF;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

#documents .download-btn-header ,
#recherche .download-btn-header {
    border-radius: 50%;
    width: 48px;
    height: 48px;
    padding: 0;
    font-size: 1.1rem;
    background: #DC2626;
    border: none;
    color: #FFFFFF;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    flex-shrink: 0;
}

#documents .download-btn-header:hover ,
#recherche .download-btn-header:hover {
    background: #B91C1C;
    color: #FFFFFF;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

@media (max-width: 768px) {
    #documents .page-band ,
    #recherche .page-band {
        padding: 24px 0 20px;
    }

    #documents .page-band h1 ,
    #recherche .page-band h1 {
        font-size: 1.5rem;
    }

    #documents .table-container ,
    #recherche .table-container {
        padding: 20px;
        border-radius: 16px;
    }

    #documents .dropdown-container ,
    #recherche .dropdown-container {
        flex-direction: column;
    }

    #documents .dropdown ,
    #recherche .dropdown {
        min-width: 100%;
    }

    #documents .dropdown-toggle ,
    #recherche .dropdown-toggle {
        width: 100%;
    }

    #documents .search-input-group ,
    #recherche .search-input-group {
        flex-direction: column;
    }

    #documents .search_input ,
    #recherche .search_input {
        border-radius: 18px 18px 0 0;
    }

    #documents .search_icon ,
    #recherche .search_icon {
        border-radius: 0 0 18px 18px;
    }

    #documents .preview-document ,
    #recherche .preview-document {
        border-radius: 0 0 16px 16px;
        min-height: 200px;
    }
    
    #documents .preview-document img ,
    #recherche .preview-document img {
        max-height: 200px;
    }
}

#documents .preview-document ,
#recherche .preview-document {
    border-radius: 0 0 20px 20px;
    position: relative;
    overflow: hidden;
}

#documents .preview-document img ,
#recherche .preview-document img {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

#documents .document-card .card-visuel ,
#recherche .document-card .card-visuel {
    height: 200px;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid #E5E7EB;
}

#documents .document-card .card-visuel img ,
#recherche .document-card .card-visuel img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#documents .document-card:hover .card-visuel img ,
#recherche .document-card:hover .card-visuel img {
    transform: scale(1.06);
}

#documents .document-card .card-visuel .file-icon ,
#recherche .document-card .card-visuel .file-icon {
    font-size: 3rem;
    opacity: 0.9;
}

/* Aperçu réel de la 1re page PDF (généré en JS par document-thumbnails.js),
   traité comme l'image de vignette : même recadrage, même zoom au survol. */
#documents .document-card .card-visuel .card-visuel__pdf-thumb,
#recherche .document-card .card-visuel .card-visuel__pdf-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    background: #FFFFFF;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#documents .document-card:hover .card-visuel .card-visuel__pdf-thumb,
#recherche .document-card:hover .card-visuel .card-visuel__pdf-thumb {
    transform: scale(1.06);
}

#documents .card-category ,
#recherche .card-category {
    font-size: 0.85rem;
    color: #6B7280;
    margin-bottom: 8px;
}

#documents .card-category span ,
#recherche .card-category span {
    font-weight: 600;
}

#documents .preview-document ,
#recherche .preview-document {
    border-radius: 0 0 20px 20px;
    position: relative;
    overflow: hidden;
}

#documents .preview-document img ,
#recherche .preview-document img {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Téléphone : chaque document devient une ligne compacte (vignette à gauche,
   texte à droite) au lieu d'une grande carte de ~450px de haut ; recherche
   sur une ligne ; plus de cadre autour de la liste. */
@media (max-width: 767.98px) {
    :is(#documents, #recherche) .page-body {
        padding-top: 24px;
        padding-bottom: 48px;
    }

    :is(#documents, #recherche) .search-input-group {
        flex-direction: row;
        border-radius: 12px;
        border-width: 1px;
        margin-bottom: 16px;
        box-shadow: none;
    }

    :is(#documents, #recherche) .search_input {
        padding: 14px 16px !important;
        font-size: 16px !important;
        border-radius: 12px 0 0 12px !important;
    }

    :is(#documents, #recherche) .search_icon {
        padding: 0 20px;
        border-radius: 0;
    }

    :is(#documents, #recherche) .dropdown-container {
        gap: 8px;
        margin-top: 0 !important;
        margin-bottom: 20px;
    }

    :is(#documents, #recherche) .dropdown-toggle .badge {
        margin-left: auto !important;
        margin-right: 10px;
    }

    :is(#documents, #recherche) .table-container {
        padding: 0;
        background: transparent;
        border: none;
        box-shadow: none;
        border-radius: 0;
    }

    :is(#documents, #recherche) .document-card {
        margin-bottom: 12px !important;
    }

    :is(#documents, #recherche) .document-card .card {
        display: grid !important;
        grid-template-columns: 84px minmax(0, 1fr);
        border: 1px solid #E5E7EB !important;
        border-radius: 12px;
        overflow: hidden;
    }

    :is(#documents, #recherche) .document-card:hover .card {
        transform: none;
        box-shadow: none;
    }

    :is(#documents, #recherche) .document-card .card > a {
        height: 100%;
    }

    :is(#documents, #recherche) .document-card .card-visuel {
        height: 100%;
        min-height: 112px;
        border-bottom: none;
        border-right: 1px solid #E5E7EB;
    }

    :is(#documents, #recherche) .document-card .card-visuel .fa-3x {
        font-size: 1.6rem;
    }

    :is(#documents, #recherche) .card-type-badge {
        top: 6px;
        left: 6px;
        padding: 1px 6px;
        font-size: .6rem;
    }

    :is(#documents, #recherche) .document-card .card-body {
        padding: 12px 14px !important;
    }

    :is(#documents, #recherche) .card-title {
        font-size: .95rem;
        -webkit-line-clamp: 3;
        margin-bottom: 4px;
    }

    :is(#documents, #recherche) .card-category {
        font-size: .78rem;
        margin-bottom: 0 !important;
    }

    :is(#documents, #recherche) .document-card .card-body > p.text-muted {
        display: none;
    }

    :is(#documents, #recherche) .document-card .card-body > .mt-auto {
        padding-top: 8px !important;
        border-top: none !important;
    }

    :is(#documents, #recherche) .card-date {
        padding-top: 0;
        border-top: none;
        font-size: .76rem;
    }

    :is(#documents, #recherche) .card-downloads {
        font-size: .74rem;
    }

    :is(#documents, #recherche) .download-btn {
        width: 40px;
        height: 40px;
        font-size: .9rem;
    }
}
