/* --- TABLE STYLES --- */
.wht-table-detailed { 
    width: 100%; 
    border-collapse: collapse; 
    table-layout: fixed; 
    word-wrap: break-word;
}

.wht-table-detailed th:nth-child(1) { width: 14%; }
.wht-table-detailed th:nth-child(2) { width: 14%; }
.wht-table-detailed th:nth-child(3) { width: 14%; }
.wht-table-detailed th:nth-child(4) { width: 12%; }
.wht-table-detailed th:nth-child(5) { width: 36%; }
.wht-table-detailed th:nth-child(6) { width: 10%; }

.val-workSiteAddress, .val-note {
    display: block;
    width: 100%;
    white-space: normal; 
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.val-note {
    color: #666;
    font-style: italic;
    margin-top: 5px;
    border-top: 1px solid #eee;
    padding-top: 5px;
}

/* --- MODAL BASE --- */
.wht-modal {
    display: none;           
    position: fixed;         
    z-index: 9999;           
    left: 0;
    top: 0;
    width: 100%;             
    height: 100%;            
    background-color: rgba(0,0,0,0.6); 
}

.wht-modal-content {
    background-color: #fff;
    margin: 5% auto; /* Adjusted from 10% to fit better on smaller screens */        
    padding: 20px;
    border-radius: 8px;
    width: 95%;
    max-width: 500px;        
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

#modal-title {
    font-size: 1.2rem; 
    font-weight: bold;
    color: #333;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* --- FORM LAYOUT & FIELDS --- */
.modal-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 15px; 
    margin-bottom: 15px; 
    align-items: flex-end; /* Prevents vertical stretching of inputs */
}

.field { margin-bottom: 12px; }

.field label { 
    display: block; 
    font-weight: bold; 
    font-size: 0.9em; 
    margin-bottom: 4px; 
}

/* Standardized input heights */
.wht-input, 
.wht-input-inline, 
.pause-inputs-row input[type="number"] {
    height: 38px !important; 
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 14px;
}

.wht-input { width: 100%; display: block; }

/* Specific behavior for textareas */
textarea.wht-input {
    height: auto !important;
    min-height: 80px;
    resize: vertical;
}

/* --- SPECIAL INPUT GROUPS --- */
.time-select-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pause-inputs-row {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

.pause-inputs-row input[type="number"] {
    width: 70px !important; 
    text-align: center;
    flex: none; /* Prevents flexbox from stretching them */
}

/* Remove Arrows from Number Inputs */
.pause-inputs-row input::-webkit-outer-spin-button,
.pause-inputs-row input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* --- BUTTONS --- */
.close { float: right; font-size: 28px; font-weight: bold; cursor: pointer; line-height: 20px; }
.wht-edit-btn, .wht-save-btn { 
    background: #c20d31; 
    color: white; 
    border: none; 
    padding: 8px 15px; 
    border-radius: 4px; 
    cursor: pointer; 
    font-weight: bold;
}
.wht-save-btn { width: 100%; margin-top: 10px; padding: 12px; }
.wht-save-btn:hover { background: #a10b29; }

.wht-summary-container {
    margin-top: 20px;
    max-width: 400px; /* Limits width on desktop */
    margin-left: auto; /* Aligns to the right of the table on desktop */
}

.wht-summary-card {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
}

.wht-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.wht-summary-row:last-child {
    margin-bottom: 0;
}

.wht-summary-row span {
    color: #555;
    font-size: 0.95em;
}

.wht-summary-row strong {
    color: #333;
}

/* Specific styling for the Grand Total */
.grand-total-card {
    background-color: #e9ecef;
    border: 2px solid #0073aa;
}

.grand-total-card span:first-child {
    font-weight: bold;
    color: #333;
}

#grand-total {
    font-size: 1.4em;
    font-weight: bold;
    color: #0073aa;
}

.wht-lost-password-container {
    max-width: 400px;
    margin: 40px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Fix the large Header */
.wht-lost-password-container h2 {
    font-size: 1.4rem !important; /* Forces a smaller size */
    margin-bottom: 20px;
    color: #333;
    text-align: center;
    line-height: 1.2;
    border-bottom: 2px solid #c20d31; /* Optional: matches your modal style */
    padding-bottom: 10px;
}


@media screen and (max-width: 768px) {
    /* Hide the original table headers */
    .wht-table-detailed thead {
        display: none;
    }

    /* Make the table and body behave like blocks */
    .wht-table-detailed, 
    .wht-table-detailed tbody, 
    .wht-table-detailed tr, 
    .wht-table-detailed td {
        display: block;
        width: 100% !important;
    }

    /* Style each row as a separate card */
    .wht-table-detailed tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        background: #fff;
        padding: 10px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }

    /* Style each cell to look like a labeled row */
    .wht-table-detailed td {
        text-align: left;
        padding: 8px 5px;
        border-bottom: 1px solid #eee;
        position: relative;
    }

    /* Remove border from the last cell in the card */
    .wht-table-detailed td:last-child {
        border-bottom: none;
        text-align: center; /* Center the "Modifier" button */
    }

    /* 1. Only apply labels to the body rows, NOT the footer totals */
    .wht-table-detailed tbody td:nth-of-type(2):before { content: "Employeur : "; font-weight: bold; color: #c20d31; }
    .wht-table-detailed tbody td:nth-of-type(3):before { content: "Heures : "; font-weight: bold; color: #c20d31; }
    .wht-table-detailed tbody td:nth-of-type(4):before { content: "Pauses : "; font-weight: bold; color: #c20d31; }

    /* 2. Style the Date/Jour header (Keep this part) */
    .wht-table-detailed td:first-child {
        background: #f8f9fa;
        margin: -10px -10px 10px -10px;
        padding: 10px;
        border-bottom: 2px solid #c20d31;
        border-radius: 8px 8px 0 0;
    }

    /* 3. Hide redundant small tags (Keep this part) */
    .wht-table-detailed td br {
        display: none;
    }
    
    /* 4. THE GRID FIX - MUCH MORE STABLE */
    .wht-table-detailed tfoot tr {
        display: grid !important;
        grid-template-columns: 1fr 1fr; /* Two equal columns */
        margin-top: 15px;
        background: #f8f9fa !important;
        border: 1px solid #ddd !important;
        border-radius: 8px;
        padding: 10px;
    }

    .wht-table-detailed tfoot td {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
    }

    /* Force every line to have the exact same height */
    .wht-table-detailed tfoot td span, 
    .wht-table-detailed tfoot td strong {
        display: block !important;
        height: 30px; 
        line-height: 30px; 
        margin: 0 !important;
        white-space: nowrap;
    }

    /* Left Side */
    .wht-table-detailed tfoot td.label-cell {
        text-align: left !important;
    }

    /* Right Side */
    .wht-table-detailed tfoot td.value-cell {
        text-align: right !important;
    }

    /* The Blue Total Row */
    .grand-total-row {
        background-color: #e9ecef !important;
        border: 2px solid #0073aa !important;
        margin-top: 5px !important;
        align-items: center;
    }

    #grand-total {
        font-size: 1.3em;
        color: #0073aa;
        font-weight: bold;
    }
    .wht-summary-container {
        max-width: 100%; /* Spans full width on phones */
        margin-top: 25px;
    }
    .wht-form-title {
        font-size: 18px !important; /* Smaller for mobile */
        margin-bottom: 15px !important;
    }
}