/* Styles pour les pages de documents par pays */
/* Assure la cohérence du design entre local et production */

.documentation-section {
    padding: 60px 0;
    background-color: #f8f9fa;
}

.doc-controls {
    background: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.table-responsive {
    background: white !important;
    border-radius: 10px;
    overflow-x: auto !important;
    overflow-y: visible !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px !important;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
    display: block !important;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #8d1f16;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #a52a2a;
}

#documentsTable {
    width: 100% !important;
    table-layout: fixed !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    min-width: 800px !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Empêcher les débordements des colonnes */
#documentsTable th {
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    word-break: break-word;
}

#documentsTable td {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.table th {
    background: linear-gradient(135deg, #8d1f16 0%, #a52a2a 100%) !important;
    color: white !important;
    font-weight: 700 !important;
    padding: 18px 12px !important;
    border: none !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    font-size: 0.9rem !important;
    position: relative !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    box-sizing: border-box !important;
    display: table-cell !important;
}

.table th i {
    color: white !important;
    font-size: 1rem;
    margin-right: 5px;
}

.table th:first-child {
    border-top-left-radius: 8px;
}

.table th:last-child {
    border-top-right-radius: 8px;
}

.table td {
    padding: 18px 12px;
    vertical-align: middle;
    border-color: #e9ecef;
    border-bottom: 1px solid #e9ecef;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box !important;
    display: table-cell !important;
}

/* Forcer le bon affichage du tableau pour éviter les décalages */
#documentsTable thead,
#documentsTable tbody,
#documentsTable tr {
    display: table !important;
    width: 100% !important;
    table-layout: fixed !important;
}

#documentsTable thead {
    width: calc(100% - 0px) !important;
    display: table-header-group !important;
}

#documentsTable tbody {
    display: table-row-group !important;
}

#documentsTable tr {
    display: table-row !important;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-hover tbody tr:hover {
    background-color: rgba(141, 31, 22, 0.08) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(141, 31, 22, 0.15);
}

.table tbody tr {
    background-color: white;
}

.table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.document-title h6 {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 6px;
    font-weight: 700;
    color: #212529;
    text-transform: uppercase;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

.document-title h6 i {
    color: #8d1f16 !important;
}

.document-title small {
    font-size: 0.9rem;
    line-height: 1.3;
    color: #6c757d;
    font-style: italic;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    display: block;
    max-width: 100%;
}

.document-title {
    position: relative;
}

.document-title::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: linear-gradient(135deg, #8d1f16, #a52a2a);
    border-radius: 2px;
}

.action-buttons {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 100%;
    padding: 0;
    flex-wrap: nowrap;
}

/* Définir les largeurs spécifiques pour chaque colonne - avec box-sizing */
/* Forcer les largeurs sur les en-têtes ET cellules pour éviter les décalages */
#documentsTable thead th:nth-child(1),
#documentsTable tbody td:nth-child(1),
#documentsTable th:nth-child(1),
#documentsTable td:nth-child(1) {
    width: 8% !important;
    min-width: 70px !important;
    max-width: 90px !important;
    padding: 15px 8px !important;
    box-sizing: border-box !important;
    display: table-cell !important;
    table-layout: fixed !important;
}

#documentsTable thead th:nth-child(2),
#documentsTable tbody td:nth-child(2),
#documentsTable th:nth-child(2),
#documentsTable td:nth-child(2) {
    width: 45% !important;
    min-width: 250px !important;
    padding: 15px 12px !important;
    box-sizing: border-box !important;
    display: table-cell !important;
    table-layout: fixed !important;
}

#documentsTable td:nth-child(2) {
    overflow: visible !important;
}

#documentsTable td:nth-child(2) .document-title {
    max-width: 100%;
    overflow: visible !important;
}

#documentsTable thead th:nth-child(3),
#documentsTable tbody td:nth-child(3),
#documentsTable th:nth-child(3),
#documentsTable td:nth-child(3) {
    width: 15% !important;
    min-width: 100px !important;
    max-width: 130px !important;
    padding: 15px 8px !important;
    overflow: hidden;
    box-sizing: border-box !important;
    display: table-cell !important;
    table-layout: fixed !important;
}

#documentsTable td:nth-child(3) {
    overflow: visible !important;
}

#documentsTable thead th:nth-child(4),
#documentsTable tbody td:nth-child(4),
#documentsTable th:nth-child(4),
#documentsTable td:nth-child(4) {
    width: 15% !important;
    min-width: 90px !important;
    max-width: 120px !important;
    padding: 15px 8px !important;
    overflow: hidden;
    box-sizing: border-box !important;
    display: table-cell !important;
    table-layout: fixed !important;
}

#documentsTable td:nth-child(4) {
    overflow: visible !important;
}

/* S'assurer que la colonne Actions contient bien les boutons */
#documentsTable thead th:nth-child(5),
#documentsTable tbody td:nth-child(5),
#documentsTable th:nth-child(5),
#documentsTable td:nth-child(5) {
    width: 17% !important;
    min-width: 110px !important;
    max-width: 130px !important;
    text-align: center !important;
    padding: 15px 5px !important;
    overflow: visible !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    display: table-cell !important;
    table-layout: fixed !important;
}

.btn-view, .btn-download {
    width: 36px;
    height: 36px;
    min-width: 36px;
    max-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-decoration: none !important;
    border: none !important;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
}

.btn-view:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-download:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 4px 12px rgba(141, 31, 22, 0.3);
}

.btn-view::before, .btn-download::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-view:hover::before, .btn-download:hover::before {
    left: 100%;
}

.badge-category {
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    color: white !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    display: inline-block;
    min-width: 70px;
    max-width: 100%;
    text-align: center;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
}

.badge-category::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.badge-category:hover::before {
    left: 100%;
}

.badge-loi { 
    background: linear-gradient(135deg, #dc3545, #c82333) !important;
    color: white !important;
}
.badge-decret { 
    background: linear-gradient(135deg, #28a745, #218838) !important;
    color: white !important;
}
.badge-arrete { 
    background: linear-gradient(135deg, #007bff, #0056b3) !important;
    color: white !important;
}
.badge-ordonnance { 
    background: linear-gradient(135deg, #ff9800, #f57c00) !important;
    color: white !important;
}

.btn-view {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #495057;
    border: 2px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-view:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    color: #212529;
    border-color: #adb5bd;
}

.btn-download {
    background: linear-gradient(135deg, #8d1f16, #a52a2a);
    color: white;
    border: 1px solid #8d1f16;
    box-shadow: 0 1px 4px rgba(141, 31, 22, 0.2);
}

.btn-download:hover {
    background: linear-gradient(135deg, #a52a2a, #dc143c);
    border-color: #a52a2a;
    box-shadow: 0 2px 6px rgba(141, 31, 22, 0.3);
}

.pagination {
    margin: 40px 0;
}

.page-item.active .page-link {
    background: linear-gradient(135deg, #8d1f16, #a52a2a);
    border-color: #8d1f16;
    box-shadow: 0 1px 4px rgba(141, 31, 22, 0.2);
}

.page-link {
    color: #8d1f16;
    border: 1px solid #dee2e6;
    margin: 0 2px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.page-link:hover {
    color: #a52a2a;
    background-color: rgba(141, 31, 22, 0.08);
    border-color: #8d1f16;
    transform: translateY(-1px);
}

.page-item.disabled .page-link {
    color: #6c757d;
    background-color: #f8f9fa;
    border-color: #dee2e6;
    pointer-events: none;
}

.results-info {
    font-size: 0.9rem;
    color: #495057;
    margin-bottom: 20px;
    text-align: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(141, 31, 22, 0.08), rgba(165, 42, 42, 0.04));
    border-radius: 8px;
    border-left: 3px solid #8d1f16;
    font-weight: 500;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.tabs {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tabs button {
    border-radius: 5px;
    font-weight: 600;
    padding: 8px 16px;
    transition: all 0.2s ease;
    border: 1px solid #ddd;
    background: white;
    color: #333;
}

.tabs button:hover {
    background-color: rgba(141, 31, 22, 0.1);
    border-color: #8d1f16;
}

.tab-active {
    background-color: #8d1f16 !important;
    color: white !important;
    border-color: #8d1f16 !important;
}

.search-container input {
    border-radius: 5px;
    padding: 10px 15px;
    border: 1px solid #ddd;
    transition: all 0.2s ease;
    width: 100%;
}

.search-container input:focus {
    border-color: #8d1f16;
    box-shadow: 0 0 0 0.2rem rgba(141, 31, 22, 0.1);
    outline: none;
}

.no-docs {
    text-align: center;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 1.1rem;
    color: #666;
}

.document-row {
    transition: all 0.3s ease;
}

.document-row:hover {
    background-color: rgba(141, 31, 22, 0.03) !important;
}

.document-date {
    font-size: 0.9rem;
    color: #495057;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-date i {
    color: #dc3545 !important;
    margin-right: 6px;
    font-size: 1rem;
}

.badge.bg-light {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef) !important;
    border: 1px solid #dee2e6 !important;
    color: #495057 !important;
    font-weight: 600;
}

.empty-state-content {
    padding: 40px 20px;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 15px;
    border: 2px dashed #dee2e6;
}

.suggestions {
    margin-top: 15px;
    padding: 8px 16px;
    background: rgba(141, 31, 22, 0.08);
    border-radius: 6px;
    border-left: 3px solid #8d1f16;
}

@media (max-width: 768px) {
    .table th, .table td {
        padding: 10px 6px;
        font-size: 0.85rem;
    }

    #documentsTable {
        min-width: 600px;
    }

    /* Colonnes sur mobile - ajuster les largeurs */
    #documentsTable th:nth-child(1),
    #documentsTable td:nth-child(1) {
        width: 7% !important;
        min-width: 60px !important;
        max-width: 80px !important;
        padding: 10px 4px !important;
    }

    #documentsTable th:nth-child(2),
    #documentsTable td:nth-child(2) {
        width: 40% !important;
        min-width: 200px !important;
        padding: 10px 8px !important;
    }

    #documentsTable th:nth-child(3),
    #documentsTable td:nth-child(3) {
        width: 18% !important;
        min-width: 80px !important;
        max-width: 110px !important;
        padding: 10px 4px !important;
    }

    #documentsTable th:nth-child(4),
    #documentsTable td:nth-child(4) {
        width: 20% !important;
        min-width: 80px !important;
        max-width: 110px !important;
        padding: 10px 4px !important;
    }

    /* Colonne Actions sur mobile */
    #documentsTable th:nth-child(5),
    #documentsTable td:nth-child(5) {
        width: 15% !important;
        min-width: 90px !important;
        max-width: 100px !important;
        padding: 10px 3px !important;
    }

    .action-buttons {
        flex-direction: row;
        gap: 4px;
        justify-content: center;
    }

    .btn-view, .btn-download {
        width: 32px;
        height: 32px;
        min-width: 32px;
        max-width: 32px;
        font-size: 0.85rem;
    }

    .tabs {
        justify-content: center;
    }

    .document-title h6 {
        font-size: 0.85rem;
    }

    .document-title small {
        font-size: 0.8rem;
    }
}

