/* ===========================================
   STYLES POUR LA GESTION DES ENREGISTREMENTS
   =========================================== */

/* DataTables Base Styles */
table.dataTable {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 0 !important;
}

table.dataTable thead th,
table.dataTable thead td {
    padding: 10px 18px;
    border-bottom: 1px solid #111;
    text-align: center;
    font-size: 1.05em;
    font-weight: 600;
}

table.dataTable tbody th,
table.dataTable tbody td {
    padding: 8px 10px;
    text-align: center;
    vertical-align: middle;
}

table.dataTable.stripe tbody tr.odd,
table.dataTable.display tbody tr.odd {
    background-color: #f9f9f9;
}

table.dataTable.hover tbody tr:hover,
table.dataTable.display tbody tr:hover {
    background-color: #f6f6f6;
}

/* DataTables Controls */
.dataTables_wrapper {
    position: relative;
    clear: both;
}

.dataTables_wrapper .dataTables_length {
    float: left;
    padding: 10px 0;
}

.dataTables_wrapper .dataTables_filter {
    float: right;
    text-align: right;
    padding: 10px 0;
}

.dataTables_wrapper .dataTables_filter input {
    margin-left: 0.5em;
    display: inline-block;
    width: auto;
}

.dataTables_wrapper .dataTables_info {
    clear: both;
    float: left;
    padding-top: 0.755em;
}

.dataTables_wrapper .dataTables_paginate {
    float: right;
    text-align: right;
    padding-top: 0.25em;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    box-sizing: border-box;
    display: inline-block;
    min-width: 1.5em;
    padding: 0.5em 1em;
    margin-left: 2px;
    text-align: center;
    text-decoration: none !important;
    cursor: pointer;
    color: #333 !important;
    border: 1px solid transparent;
    border-radius: 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    color: #333 !important;
    border: 1px solid #979797;
    background-color: white;
    background: linear-gradient(to bottom, #fff 0%, #dcdcdc 100%);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {
    cursor: default;
    color: #666 !important;
    border: 1px solid transparent;
    background: transparent;
    box-shadow: none;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: white !important;
    border: 1px solid #111;
    background-color: #585858;
    background: linear-gradient(to bottom, #585858 0%, #111 100%);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:active {
    outline: none;
    background-color: #2b2b2b;
    background: linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%);
    box-shadow: inset 0 0 3px #111;
}

.dataTables_wrapper .dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 40px;
    margin-left: -50%;
    margin-top: -25px;
    padding-top: 20px;
    text-align: center;
    font-size: 1.2em;
    background-color: white;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
}

/* Sorting Icons */
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc,
table.dataTable thead .sorting_asc_disabled,
table.dataTable thead .sorting_desc_disabled {
    cursor: pointer;
    position: relative;
}

table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    position: absolute;
    bottom: 12px;
    right: 8px;
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

table.dataTable thead .sorting:after {
    content: "\f0dc";
    color: #999;
}

table.dataTable thead .sorting_asc:after {
    content: "\f0de";
    color: #333;
}

table.dataTable thead .sorting_desc:after {
    content: "\f0dd";
    color: #333;
}

/* Fixed Header */
table.dataTable.fixedHeader-floating {
    position: fixed !important;
    background-color: white;
}

table.dataTable.fixedHeader-locked {
    position: absolute !important;
    background-color: white;
}

/* ===============================
   STYLES SPÉCIFIQUES AUX RECORDS
   (Préfixe rec- pour éviter les conflits avec Bootstrap)
   =============================== */

/* Header de la liste des enregistrements */
.records-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px auto;
    max-width: 1400px;
    padding: 0 15px;
}

.records-header h1 {
    margin: 0;
    font-size: 1.5em;
}

.header-buttons {
    display: flex;
    gap: 10px;
}

.record-count {
    background-color: #6c757d;
    color: white;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    margin-left: 10px;
}

.rec-alert-container {
    margin: 0 auto 15px;
    max-width: 1400px;
}

.table-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Boutons d'action dans le tableau */
.action-buttons {
    display: inline-flex;
    gap: 5px;
}

.action-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    border: 1px solid;
    text-decoration: none;
    font-size: 12px;
}

.action-btn.btn-view { background-color: #cce5ff; border-color: #007bff; color: #004085; }
.action-btn.btn-view:hover { background-color: #007bff; color: white; }
.action-btn.btn-edit { background-color: #fff3cd; border-color: #ffc107; color: #856404; }
.action-btn.btn-edit:hover { background-color: #ffc107; color: #212529; }
.action-btn.btn-email { background-color: #d4edda; border-color: #28a745; color: #155724; }
.action-btn.btn-email:hover { background-color: #28a745; color: white; }
.action-btn.btn-delete { background-color: #f8d7da; border-color: #dc3545; color: #721c24; }
.action-btn.btn-delete:hover { background-color: #dc3545; color: white; }

/* Cards pour les enregistrements */
.record-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 20px;
    margin-bottom: 20px;
    transition: box-shadow 0.3s ease;
}

.record-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.record-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 15px;
}

.record-card-title {
    font-size: 1.2em;
    font-weight: bold;
    color: #4a6fa5;
    margin: 0;
}

/* Tables améliorées */
.rec-table-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow: hidden;
}

.rec-table-header {
    background: linear-gradient(135deg, #4a6fa5 0%, #3d5a87 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rec-table-header h2 {
    margin: 0;
    font-size: 1.2em;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        float: none;
        text-align: left;
    }
    
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: center;
    }
    
    .record-card-header {
        flex-direction: column;
        gap: 10px;
    }
}

/* Print Styles */
@media print {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_paginate,
    .dataTables_wrapper .dataTables_info,
    .no-print,
    .toggle-pwd {
        display: none !important;
    }
    
    .print-only {
        display: block;
    }
    
    table.dataTable {
        border: 1px solid #ddd !important;
    }
    
    table.dataTable th,
    table.dataTable td {
        border: 1px solid #ddd !important;
        padding: 8px !important;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background: #333;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 1000;
}

[data-tooltip]:hover:before {
    opacity: 1;
    visibility: visible;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4a6fa5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===========================================
   STYLES POUR LA VUE D'ENREGISTREMENT
   =========================================== */

.view-meta {
    display: flex;
    gap: 20px;
    padding: 10px 15px;
    background-color: #e9ecef;
    border-radius: 5px;
    font-size: 12px;
    margin-bottom: 20px;
}

.view-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.view-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    justify-content: center;
}

.print-only {
    display: none;
}
