/* =================
   VARIABLES GLOBALES
   ================= */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --shadow-light: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-heavy: 0 8px 16px rgba(0,0,0,0.2);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* =================
   STYLES GLOBAUX
   ================= */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.h-100 {
    height: 100vh !important;
}

/* =================
   PAGE DE CONNEXION
   ================= */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
}

.login-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    padding: 2.5rem;
    border: none;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.login-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.login-title {
    color: var(--dark-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 0;
}

.btn-login {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: var(--transition);
    box-shadow: var(--shadow-light);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.login-divider {
    margin: 2rem 0;
    border-color: rgba(108, 117, 125, 0.3);
}

.new-user-id-inline {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    background: var(--light-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 2px dashed var(--primary-color);
    margin: 1rem auto;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    user-select: all;
    transition: var(--transition);
    display: inline-block;
    max-width: 300px;
}

.new-user-id-inline:hover {
    background: rgba(13, 110, 253, 0.1);
    transform: scale(1.02);
}

/* =================
   PAGE DASHBOARD
   ================= */
.dashboard-body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar-text {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
}

/* =================
   CARTES ET PANNEAUX
   ================= */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    background: white;
}

.card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

.card-header {
    border: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.card-body {
    padding: 1.25rem;
}

/* =================
   STATISTIQUES
   ================= */
.stat-item {
    text-align: center;
    padding: 0.4rem;
    background: var(--light-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
    margin-bottom: 0.4rem;
}

.stat-item:hover {
    background: rgba(13, 110, 253, 0.1);
    transform: scale(1.02);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--secondary-color);
    margin-bottom: 0.3rem;
    font-weight: 500;
    line-height: 1.1;
}

.stat-values {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-real {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--success-color);
    line-height: 1.1;
}

.stat-real::before {
    content: "R: ";
    font-size: 0.7rem;
    opacity: 0.8;
}

.stat-conv {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    line-height: 1.1;
}

.stat-conv::before {
    content: "C: ";
    font-size: 0.7rem;
    opacity: 0.8;
}

/* Version compacte pour petits écrans */
@media (max-width: 1400px) {
    .stat-values {
        flex-direction: row;
        justify-content: space-between;
        gap: 0.3rem;
    }
    
    .stat-real,
    .stat-conv {
        font-size: 0.8rem;
        flex: 1;
    }
    
    .stat-real::before,
    .stat-conv::before {
        font-size: 0.6rem;
    }
}

@media (max-width: 1200px) {
    .stat-item {
        padding: 0.3rem;
        margin-bottom: 0.3rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
        margin-bottom: 0.2rem;
    }
    
    .stat-real,
    .stat-conv {
        font-size: 0.75rem;
    }
}

/* =================
   PANNEAUX COMPACTS
   ================= */
.card-body.p-3 {
    padding: 0.75rem !important;
}

.form-select-sm {
    font-size: 0.8rem;
    padding: 0.375rem 0.75rem;
}

.form-label {
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

/* =================
   TABLEAU OPTIMISÉ
   ================= */
.table-responsive {
    border-radius: var(--border-radius);
    overflow-x: auto;
    overflow-y: auto;
}

.table-sm th,
.table-sm td {
    padding: 0.4rem 0.3rem;
    font-size: 0.8rem;
    vertical-align: middle;
}

.table-sm .time-input {
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
    width: 52px;
}

.table-sm input[type="number"],
.table-sm textarea {
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
}

.table-sm textarea {
    min-height: 40px;
    resize: vertical;
}

/* Colonnes du tableau plus compactes */
.table th:first-child,
.table td:first-child {
    font-weight: 600;
    background-color: rgba(248, 249, 250, 0.8);
    font-size: 0.75rem;
}

.table th:nth-child(2),
.table td:nth-child(2) {
    color: var(--secondary-color);
    font-size: 0.7rem;
}

/* Boutons d'action plus compacts */
.btn-group-vertical .btn {
    min-width: 32px;
    padding: 0.2rem 0.4rem;
    font-size: 0.7rem;
    margin-bottom: 1px;
}

.btn-group-vertical .btn:last-child {
    margin-bottom: 0;
}

/* =================
   RÉCAPITULATIF
   ================= */
.recap-body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

/* Tableau récapitulatif */
#recapTable {
    font-size: 0.9rem;
}

#recapTable th {
    background: var(--dark-color);
    color: white;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.75rem 0.5rem;
    border: 1px solid #dee2e6;
}

#recapTable td {
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    font-size: 0.85rem;
    vertical-align: middle;
}

/* Styles pour les inputs de saisie des heures bulletin */
#recapTable input[type="number"] {
    width: 100px;
    text-align: center;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.375rem 0.5rem;
    font-size: 0.8rem;
}

#recapTable input[type="number"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

#recapTable input[type="number"].has-value {
    background-color: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
    font-weight: 600;
}

/* Lignes de séparation d'année */
#recapTable .table-secondary td {
    background-color: rgba(108, 117, 125, 0.2) !important;
    font-weight: bold;
    text-align: center;
    color: var(--dark-color);
    font-size: 0.9rem;
    padding: 0.75rem 0.5rem;
    border-top: 2px solid var(--secondary-color);
    border-bottom: 2px solid var(--secondary-color);
}

/* Styles pour les deltas */
.text-success.fw-bold {
    color: var(--success-color) !important;
    font-weight: 700 !important;
}

.text-danger.fw-bold {
    color: var(--danger-color) !important;
    font-weight: 700 !important;
}

/* Ligne de totaux */
#recapTable tfoot th,
#recapTable tfoot td {
    background-color: rgba(255, 193, 7, 0.3);
    font-weight: bold;
    font-size: 0.9rem;
    border-top: 2px solid var(--warning-color);
}

/* Bilan global */
#globalSummary {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-light);
}

#globalSummary .alert-heading {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

#globalSummary .alert-heading i {
    color: inherit;
}

/* Boutons de période */
.btn-group .btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-group .btn-outline-light.active {
    background-color: white;
    border-color: white;
    color: var(--info-color);
}

/* Indicateurs visuels pour les mois */
#recapTable tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

#recapTable td.text-center {
    font-family: 'Courier New', monospace;
}

/* =================
   RESPONSIVE AMÉLIORÉ
   ================= */
@media (min-width: 1200px) {
    .table-responsive {
        max-height: 80vh;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
}

@media (max-width: 1199px) {
    .table-responsive {
        max-height: 70vh;
    }
    
    .table-sm th,
    .table-sm td {
        padding: 0.3rem 0.2rem;
        font-size: 0.75rem;
    }
    
    .table-sm .time-input {
        width: 48px;
        font-size: 0.7rem;
    }
    
    /* Récapitulatif responsive */
    #recapTable {
        font-size: 0.8rem;
    }
    
    #recapTable th,
    #recapTable td {
        padding: 0.4rem 0.3rem;
        font-size: 0.75rem;
    }
    
    #recapTable input[type="number"] {
        width: 80px;
        font-size: 0.7rem;
        padding: 0.25rem 0.375rem;
    }
}

@media (max-width: 992px) {
    .col-2 {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        max-height: 60vh;
        font-size: 0.7rem;
    }
    
    .table-sm th,
    .table-sm td {
        padding: 0.25rem 0.15rem;
    }
    
    /* Récapitulatif mobile */
    #recapTable {
        font-size: 0.7rem;
    }
    
    #recapTable th,
    #recapTable td {
        padding: 0.3rem 0.2rem;
        font-size: 0.7rem;
    }
    
    #recapTable input[type="number"] {
        width: 70px;
        font-size: 0.6rem;
        padding: 0.2rem 0.3rem;
    }
}

/* =================
   HAUTEUR ADAPTATIVE
   ================= */
.card-body#entryPanel {
    height: calc(100vh - 250px);
    overflow: hidden;
}

.card-body#entryPanel .table-responsive {
    height: 100%;
    max-height: none;
}

/* Headers sticky améliorés */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--dark-color) !important;
}

/* Optimisation de l'espace vertical */
.mb-4 {
    margin-bottom: 1rem !important;
}

.card.mb-3 {
    margin-bottom: 0.75rem !important;
}

/* =================
   FORMULAIRES
   ================= */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 1px solid #dee2e6;
    transition: var(--transition);
    padding: 0.75rem 1rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

/* =================
   BOUTONS
   ================= */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 1rem;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* =================
   TABLEAUX HORAIRES
   ================= */
.table-bordered {
    border: 2px solid #dee2e6;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #dee2e6;
    vertical-align: middle;
}

.sticky-top {
    position: sticky;
    top: 0;
    z-index: 10;
}

.time-input {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

.time-input.is-invalid {
    border-color: var(--danger-color);
    background-color: rgba(220, 53, 69, 0.1);
}

.time-input-fixed {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: var(--transition);
}

.time-input-fixed.has-value {
    background-color: #d1ecf1 !important;
    border-color: #17a2b8 !important;
    color: #0c5460 !important;
    font-weight: 600 !important;
}

.time-separator {
    font-weight: bold;
    color: #6c757d;
    margin: 0 0.25rem;
    transition: var(--transition);
}

.time-separator.has-both-values {
    color: #17a2b8 !important;
    font-weight: bold !important;
}

.duration-real,
.duration-conv {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: nowrap;
}

.save-btn,
.delete-btn {
    min-width: 35px;
    padding: 0.25rem 0.5rem;
}

.btn-group-vertical .btn {
    margin-bottom: 2px;
}

.btn-group-vertical .btn:last-child {
    margin-bottom: 0;
}

/* Amélioration des inputs dans le tableau */
.table input,
.table textarea {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.table textarea {
    resize: vertical;
    min-height: 50px;
}

/* Mise en évidence des lignes avec données */
.table-success {
    background-color: rgba(25, 135, 84, 0.1) !important;
}

.table-info {
    background-color: rgba(13, 202, 240, 0.1) !important;
}

.table-light {
    background-color: rgba(248, 249, 250, 0.5) !important;
}

/* Navigation mensuelle */
.btn-group .btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

#currentMonthYear {
    font-weight: 600;
    color: var(--dark-color);
}

/* Colonnes spécifiques du tableau */
.table th:first-child,
.table td:first-child {
    font-weight: 600;
    background-color: rgba(248, 249, 250, 0.8);
}

.table th:nth-child(2),
.table td:nth-child(2) {
    color: var(--secondary-color);
    font-size: 0.8rem;
}

/* Style pour les durées */
.duration-real {
    color: var(--success-color);
    position: relative;
}

.duration-conv {
    color: var(--primary-color);
    position: relative;
    cursor: help;
}

/* Badge pour indiquer les règles appliquées */
.duration-conv::after {
    content: attr(data-rule);
    position: absolute;
    top: -8px;
    right: -5px;
    background: var(--warning-color);
    color: var(--dark-color);
    font-size: 0.6rem;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s;
}

.duration-conv:hover::after {
    opacity: 1;
}

/* Style pour les périodes avec données */
.periode-filled {
    background-color: rgba(25, 135, 84, 0.1);
    border-radius: 4px;
}

/* Amélioration du tooltip */
.duration-conv[title]:hover {
    position: relative;
}

/* Mise en évidence des lignes avec règles spéciales */
.table-warning {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

.table-primary {
    background-color: rgba(13, 110, 253, 0.1) !important;
}

/* Style pour les info-bulles personnalisées */
.custom-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

/* Amélioration des boutons d'action */
.save-btn.btn-info {
    background-color: var(--info-color);
    border-color: var(--info-color);
    color: white;
}

/* Responsive pour les petits écrans */
@media (max-width: 1200px) {
    .table th,
    .table td {
        font-size: 0.75rem;
        padding: 0.5rem 0.25rem;
    }
    
    .time-input {
        font-size: 0.7rem;
        padding: 0.2rem 0.3rem;
    }
    
    .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }
}

@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.7rem;
    }
    
    .table th,
    .table td {
        padding: 0.3rem 0.2rem;
    }
    
    .btn-group-vertical .btn {
        min-width: 30px;
        padding: 0.2rem 0.3rem;
    }
    
    /* Récapitulatif mobile spécifique */
    #recapTable th,
    #recapTable td {
        padding: 0.25rem 0.15rem;
        font-size: 0.65rem;
    }
    
    #recapTable input[type="number"] {
        width: 60px;
        font-size: 0.6rem;
        padding: 0.15rem 0.25rem;
    }
    
    .navbar-text {
        display: none;
    }
}

/* =================
   PAGINATION
   ================= */
.pagination {
    justify-content: center;
    margin-bottom: 0;
}

.page-item .page-link {
    border-radius: var(--border-radius);
    margin: 0 2px;
    border: 1px solid #dee2e6;
    transition: var(--transition);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.page-item .page-link:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
}

/* =================
   ALERTES
   ================= */
.alert {
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    box-shadow: var(--shadow-light);
}

.alert-dismissible .btn-close {
    padding: 1rem 1rem;
}

/* =================
   MODAL
   ================= */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    z-index: 1055;
}

.modal-header {
    border-bottom: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-footer {
    border-top: 1px solid rgba(0,0,0,0.1);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.modal-backdrop {
    z-index: 1050;
}

.modal {
    z-index: 1055;
}

.modal-dialog {
    z-index: 1056;
}

/* Assurer que les boutons de la modal sont cliquables */
.modal .btn {
    position: relative;
    z-index: 1057;
    pointer-events: auto;
}

.modal .new-user-id {
    position: relative;
    z-index: 1057;
    pointer-events: auto;
}

/* =================
   GROUPES DE BOUTONS
   ================= */
.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.btn-group .btn:last-child {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

/* =================
   INPUT GROUP
   ================= */
.input-group .input-group-text {
    background: var(--light-color);
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.input-group .form-control {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

/* =================
   ANIMATIONS
   ================= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* =================
   ICÔNES
   ================= */
.fas, .far {
    width: 1em;
    text-align: center;
}

/* =================
   UTILITAIRES
   ================= */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.border-radius {
    border-radius: var(--border-radius) !important;
}

.shadow-custom {
    box-shadow: var(--shadow-medium) !important;
}

/* =================
   RESPONSIVE
   ================= */
@media (max-width: 768px) {
    .login-card {
        margin: 1rem;
        padding: 2rem;
    }
    
    .col-2 {
        margin-bottom: 1rem;
    }
    
    .navbar-text {
        display: none;
    }
    
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .container-fluid {
        padding: 0.5rem;
    }
    
    .login-title {
        font-size: 1.5rem;
    }
    
    .login-icon {
        font-size: 2.5rem;
    }
    
    .btn {
        font-size: 0.875rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
}

/* =================
   DARK MODE (optionnel)
   ================= */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #343a40;
        --dark-color: #f8f9fa;
    }
    
    .card {
        background: #2d3748;
        color: var(--dark-color);
    }
    
    .table th {
        background: #4a5568;
        color: var(--dark-color);
    }
    
    .form-control, .form-select {
        background: #4a5568;
        border-color: #718096;
        color: var(--dark-color);
    }
}

/* =================
   PRINT STYLES
   ================= */
@media print {
    .navbar, .btn, .card-header .btn-group {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    body {
        background: white !important;
    }
    
    .table {
        font-size: 0.8rem;
    }
}








/* =================
   FEUILLES HEBDOMADAIRES - CSS COMPLET
   ================= */

/* Container pour l'environnement de la feuille A4 paysage */
.feuille-container {
    width: 100%;
    min-height: 100vh;
    background: #e9ecef; /* Couleur de fond comme une table */
    padding: 30px 20px;
    overflow-x: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* La feuille A4 paysage elle-même */
#feuillePreview {
    /* Simulation d'une vraie feuille A4 paysage */
    width: 29.7cm;
    min-height: 21cm;
    
    /* Apparence de feuille de papier */
    background: white;
    box-shadow: 
        0 4px 20px rgba(0,0,0,0.15),
        0 0 0 1px rgba(0,0,0,0.05);
    border-radius: 4px;
    
    /* Marges intérieures réalistes */
    padding: 1.5cm;
    
    /* Typography */
    font-size: 11px;
    font-family: Arial, sans-serif;
    line-height: 1.2;
    
    /* Centrage dans le container */
    margin: 0 auto;
    
    /* Effet de profondeur */
    position: relative;
}

/* Effet d'ombre de la feuille sur la table */
#feuillePreview::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: -6px;
    bottom: -6px;
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
    z-index: -1;
}

/* En-tête de la feuille */
.feuille-header {
    border: 2px solid #000;
    margin-bottom: 15px;
    border-radius: 4px;
}

.feuille-header table {
    width: 100%;
    border-collapse: collapse;
}

.feuille-header td {
    border: 1px solid #000;
    padding: 8px;
    vertical-align: top;
}

.feuille-header h3 {
    margin: 10px 0;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
}

/* Wrapper simplifié pour la prévisualisation */
.feuille-wrapper {
    width: 100%;
    overflow: visible; /* Pas de scroll horizontal */
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Tableau principal de la feuille - Optimisé pour prévisualisation sans scroll */
.feuille-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 10px;
    table-layout: auto;
    min-width: auto; /* Suppression min-width pour éviter scroll */
}

.feuille-table th,
.feuille-table td {
    border: 1px solid #000;
    padding: 3px;
    text-align: center;
    vertical-align: middle;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 8px; /* Police réduite */
}

.feuille-table th {
    background-color: #f0f0f0;
    font-weight: bold;
    font-size: 7px;
    padding: 2px;
}

/* Largeurs optimisées pour prévisualisation sans scroll - 5 périodes */
.feuille-table .col-date { 
    width: 12%; 
    min-width: 80px;
    text-align: left !important; /* Date à gauche, horizontale */
    font-size: 7px;
}

.feuille-table .col-tranche { 
    width: 4%; 
    min-width: 35px;
    font-size: 7px;
}

.feuille-table .col-lieu { 
    width: 10%; 
    min-width: 70px;
    font-size: 7px;
}

.feuille-table .col-annexes { 
    width: 10%; 
    min-width: 70px;
    font-size: 7px;
}

.feuille-table .col-temps { 
    width: 8%; 
    min-width: 55px;
    font-size: 7px;
}

.feuille-table .col-commentaires { 
    width: 15%; 
    min-width: 100px;
    font-size: 7px;
    text-align: left !important;
    vertical-align: top !important;
    min-height: 30px;
}

/* Cellules de temps avec police monospace */
.time-cell {
    font-family: 'Courier New', monospace;
    font-size: 9px;
}

/* Classes pour les données présentes */
.time-filled {
    background-color: rgba(25, 135, 84, 0.2);
    font-weight: 600;
}

.day-header {
    background-color: #e0e0e0;
    font-weight: bold;
}

.total-cell {
    background-color: rgba(255, 193, 7, 0.1);
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

/* Alignement spécifique pour les colonnes */
.feuille-table .col-date {
    text-align: left !important; /* Date horizontale à gauche */
    font-weight: bold;
    line-height: 1.1;
}

.feuille-table .col-tranche {
    text-align: center;
    font-family: 'Courier New', monospace;
}

.feuille-table .col-lieu {
    text-align: center;
    font-size: 6px;
    line-height: 1.1;
}

.feuille-table .col-commentaires {
    text-align: left !important;
    vertical-align: top !important;
    padding: 5px !important;
    min-height: 25px;
}

/* Section des totaux */
.totals-section {
    border: 1px solid #000;
    padding: 8px;
    background-color: #f9f9f9;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Boîte de signature */
.signature-box {
    border: 1px solid #000;
    padding: 8px;
    height: 60px;
    border-radius: 4px;
    font-size: 10px;
}

/* Conteneur flex pour totaux et signature */
.totals-container {
    margin-top: 15px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.totals-container > div:first-child {
    flex: 2;
    min-width: 300px;
}

.totals-container > div:last-child {
    flex: 1;
    min-width: 200px;
}

/* Navigation de semaine */
.week-navigation {
    background: var(--light-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-light);
}

.week-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.week-dates {
    font-size: 0.9rem;
    color: var(--secondary-color);
}

/* Boutons d'action pour les feuilles */
.feuille-actions {
    margin: 1rem 0;
    text-align: center;
}

.feuille-actions .btn {
    margin: 0 0.5rem;
}

/* Amélioration du tableau pour l'affichage écran */
.feuille-table tbody tr:nth-child(even) {
    background-color: rgba(248, 249, 250, 0.3);
}

.feuille-table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

/* Zone de commentaires */
.comments-cell {
    text-align: left;
    vertical-align: top;
    font-size: 9px;
    min-height: 30px;
}

/* Ajustements pour le logo */
.feuille-header .logo-cell {
    text-align: center;
    vertical-align: middle;
}

.feuille-header .logo-cell img {
    max-height: 30px;
    max-width: 100px;
}

/* Styles pour les infos de période */
.period-info {
    font-size: 10px;
    line-height: 1.3;
}

.period-info strong {
    font-weight: 600;
}

/* RESPONSIVE - Optimisé pour prévisualisation sans scroll */
@media (max-width: 1400px) {
    .feuille-container {
        padding: 20px 15px;
    }
    
    #feuillePreview {
        width: 95vw;
        max-width: 29.7cm;
        min-height: auto;
        font-size: 9px;
        padding: 1cm;
    }
    
    .feuille-table {
        font-size: 8px;
    }
    
    .feuille-table th,
    .feuille-table td {
        padding: 2px;
        font-size: 7px;
    }
}

@media (max-width: 1200px) {
    .feuille-container {
        padding: 15px 10px;
    }
    
    #feuillePreview {
        width: 98vw;
        font-size: 8px;
        padding: 0.8cm;
        min-height: calc(98vw * 21 / 29.7);
    }
    
    .feuille-table {
        font-size: 7px;
    }
    
    .feuille-table th,
    .feuille-table td {
        padding: 2px;
        font-size: 6px;
    }
}

@media (max-width: 992px) {
    .feuille-container {
        padding: 10px 0;
        background: white;
    }
    
    #feuillePreview {
        width: 100vw;
        border-radius: 0;
        font-size: 7px;
        padding: 0.5cm;
        min-height: calc(100vw * 21 / 29.7);
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    #feuillePreview::before {
        display: none;
    }
    
    .feuille-table {
        font-size: 6px;
    }
    
    .week-navigation {
        padding: 0.75rem;
    }
    
    .feuille-actions .btn {
        margin: 0.25rem;
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
}

@media (max-width: 768px) {
    .feuille-container {
        padding: 5px;
        min-height: auto;
        background: white;
    }
    
    #feuillePreview {
        width: 100%;
        font-size: 6px;
        padding: 0.3cm;
        border-radius: 0;
        box-shadow: none;
        min-height: auto;
        position: relative;
    }
    
    /* Message explicatif sur mobile */
    #feuillePreview::after {
        content: "📄 Prévisualisation A4 paysage optimisée";
        display: block;
        background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
        padding: 6px 10px;
        font-size: 10px;
        text-align: center;
        margin-bottom: 10px;
        border-radius: 4px;
        color: #1976d2;
        font-weight: 500;
        border: 1px solid #e1f5fe;
    }
    
    #feuillePreview::before {
        display: none;
    }
    
    .feuille-table {
        font-size: 5px;
    }
    
    .feuille-table th,
    .feuille-table td {
        padding: 1px;
        font-size: 5px;
    }
}

/* Animation de chargement pour la génération PDF */
.pdf-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    text-align: center;
}

.pdf-loading .spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* IMPRESSION - Optimisée A4 paysage */
@media print {
    .no-print {
        display: none !important;
    }
    
    .feuille-container {
        background: white;
        padding: 0;
        margin: 0;
        overflow: visible;
        min-height: auto;
    }
    
    #feuillePreview {
        width: 100%;
        min-height: auto;
        box-shadow: none;
        border: none;
        border-radius: 0;
        margin: 0;
        padding: 0.5cm; /* Marges d'impression */
        font-size: 9px;
        page-break-inside: avoid;
    }
    
    #feuillePreview::before,
    #feuillePreview::after {
        display: none !important;
    }
    
    .feuille-wrapper {
        overflow: visible;
        border: none;
    }
    
    .feuille-table {
        min-width: auto;
        font-size: 8px;
        width: 100%;
        page-break-inside: avoid;
    }
    
    .feuille-table th,
    .feuille-table td {
        padding: 2px;
        font-size: 7px;
        border: 1px solid #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .feuille-table th {
        background-color: #f0f0f0 !important;
    }
    
    .time-filled {
        background-color: rgba(25, 135, 84, 0.2) !important;
    }
    
    .day-header {
        background-color: #e0e0e0 !important;
    }
    
    .totals-section,
    .signature-box {
        border: 1px solid #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* Force les couleurs d'arrière-plan en impression */
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}


/* =================
   MODIFICATIONS À AJOUTER DANS style.css
   ================= */

/* Amélioration de la colonne commentaires dans la feuille hebdomadaire */
.feuille-table .col-commentaires {
    text-align: left !important;
    vertical-align: top !important;
    padding: 5px !important;
    font-size: 8px;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-height: 40px;
    max-width: 150px; /* Limite la largeur pour éviter l'étalement */
}

/* Style pour les informations dans les commentaires */
.comments-cell {
    background-color: rgba(255, 255, 255, 0.9);
    font-family: Arial, sans-serif;
    color: #333;
}

/* Amélioration des lignes de la feuille pour plus de hauteur */
.feuille-table tbody tr {
    min-height: 40px;
}

/* Style spécifique pour les informations dans les commentaires */
.feuille-table .col-commentaires.has-info {
    background-color: rgba(13, 110, 253, 0.05);
    border-left: 3px solid #0d6efd;
}

/* Amélioration responsive pour les commentaires */
@media (max-width: 1200px) {
    .feuille-table .col-commentaires {
        font-size: 7px;
        max-width: 120px;
        min-height: 35px;
    }
}

@media (max-width: 992px) {
    .feuille-table .col-commentaires {
        font-size: 6px;
        max-width: 100px;
        min-height: 30px;
        padding: 3px !important;
    }
}

@media (max-width: 768px) {
    .feuille-table .col-commentaires {
        font-size: 5px;
        max-width: 80px;
        min-height: 25px;
        padding: 2px !important;
    }
}

/* Style pour le PDF - hauteurs de lignes augmentées */
@media print {
    .feuille-table tbody tr {
        height: 35px !important;
        min-height: 35px !important;
    }
    
    .feuille-table .col-commentaires {
        height: 35px !important;
        vertical-align: top !important;
        padding: 3px !important;
        font-size: 8px !important;
        line-height: 1.2 !important;
    }
}

/* Animation pour les cellules de commentaires avec contenu */
.comments-cell:not(:empty) {
    animation: fadeIn 0.3s ease-in-out;
    border-left: 2px solid rgba(13, 110, 253, 0.3);
}

/* Amélioration de la lisibilité du texte dans les commentaires */
.feuille-table .col-commentaires br {
    line-height: 1.5;
}

/* Style pour les retours à la ligne dans les commentaires */
.feuille-table .col-commentaires {
    white-space: pre-wrap; /* Préserve les espaces et retours à la ligne */
}

/* Ajustement de la largeur de la colonne commentaires pour plus d'espace */
.feuille-table .col-commentaires {
    width: 16% !important; /* Augmentation de 15% à 16% */
    min-width: 120px;
}

/* Réduction légère des autres colonnes pour compenser */
.feuille-table .col-tranche {
    width: 3.8% !important; /* Réduction de 4% à 3.8% */
}

/* Indicateur visuel pour les jours avec commentaires */
.feuille-table tbody tr:has(.comments-cell:not(:empty)) {
    border-left: 3px solid #28a745;
}

/* Fallback pour les navigateurs qui ne supportent pas :has() */
.feuille-table tbody tr .comments-cell:not(:empty) {
    position: relative;
}

.feuille-table tbody tr .comments-cell:not(:empty)::before {
    content: "💬";
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    opacity: 0.6;
}










/* Modal Informations */
#infoModalTextarea {
    resize: vertical;
    font-family: inherit;
    white-space: pre-wrap;
}
#infoModal .modal-header {
    background-color: #f8f9fa;
}
#infoModal .btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}
#infoModal .btn-primary:hover {
    background-color: #0b5ed7;
}
