/* ==============================================
   Saisie paie — Styles spécifiques
   ============================================== */

.saisie-table-wrap {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow-x: auto;
    margin-top: 1rem;
}

.saisie-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }

.saisie-table thead th {
    background: #f8f9fa;
    padding: 0.6rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #555;
    border-bottom: 2px solid #e2e5ea;
    white-space: nowrap;
    text-align: center;
}

.saisie-table thead th:first-child { text-align: left; padding-left: 1rem; }

.saisie-table thead .th-group { color: #fff; font-size: 0.7rem; padding: 0.35rem 0.5rem; }
.saisie-table thead .th-group.heures { background: #2d5be3; }
.saisie-table thead .th-group.absences { background: #e67e22; }
.saisie-table thead .th-group.conges { background: #27ae60; }
.saisie-table thead .th-group.divers { background: #7f8fa6; }

.saisie-table tbody tr { border-bottom: 1px solid #f0f2f5; transition: background 0.15s; }
.saisie-table tbody tr:hover { background: #f8f9fb; }
.saisie-table tbody td { padding: 0.5rem 0.35rem; vertical-align: middle; }
.saisie-table tbody td:first-child { padding-left: 1rem; }

.emp-info { display: flex; flex-direction: column; gap: 0.1rem; min-width: 140px; }
.emp-info .emp-name { font-weight: 700; font-size: 0.88rem; color: #1a1a2e; white-space: nowrap; }
.emp-info .emp-poste { font-size: 0.73rem; color: #7f8fa6; }
.emp-info .emp-contrat { font-size: 0.7rem; color: #a0aab5; }

.saisie-table input, .saisie-table select {
    padding: 0.4rem 0.45rem;
    border: 1px solid #e2e5ea;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    background: #fafbfc;
    transition: border-color 0.2s;
}

.saisie-table input:focus, .saisie-table select:focus {
    outline: none;
    border-color: #2d5be3;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(45,91,227,0.1);
}

.saisie-table input[type="number"] { width: 70px; text-align: right; }
.saisie-table input[type="date"] { width: 130px; }
.saisie-table input[type="text"] { width: 120px; }
.saisie-table select { width: 120px; }

/* Sticky save bar */
.saisi-bar {
    background: #fff;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
    position: sticky;
    bottom: 1rem;
    z-index: 10;
}

.saisi-bar input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e5ea;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    width: 220px;
}

.saisi-bar input:focus { outline: none; border-color: #2d5be3; }

/* Locked rows */
.saisie-table tbody tr.locked { background: #f8f9fa; }
.saisie-table tbody tr.locked:hover { background: #f0f1f3; }

.saisie-table tbody tr.locked input,
.saisie-table tbody tr.locked select {
    background: #eef0f3;
    color: #999;
    border-color: #e2e5ea;
    cursor: not-allowed;
}

.td-actions { text-align: center; white-space: nowrap; }
.td-brut { text-align: right; font-size: 0.85rem; color: #1a1a2e; }

.td-cp-readonly { text-align: center; font-weight: 600; font-size: 0.82rem; white-space: nowrap; color: #555; }
.td-solde-cp.solde-positif { color: #27ae60; font-weight: 700; }
.td-solde-cp.solde-negatif { color: #c0392b; font-weight: 700; }

.btn-save-row, .btn-lock-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    padding: 0;
}

.btn-save-row { color: #2d5be3; }
.btn-save-row:hover { background: rgba(45,91,227,0.1); transform: scale(1.15); }
.btn-save-row:active { transform: scale(0.95); }

.btn-lock-row { color: #e67e22; }
.btn-lock-row:hover { background: rgba(230,126,34,0.1); transform: scale(1.15); }
.btn-lock-row:active { transform: scale(0.95); }

.btn-locked {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #c0392b;
}

/* PDF bulletin button */
.btn-pdf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    padding: 0;
    color: #c0c4cc;
}
.btn-pdf:hover { background: rgba(192,196,204,0.15); transform: scale(1.15); }
.btn-pdf:active { transform: scale(0.95); }
.btn-pdf.has-pdf { color: #e74c3c; }
.btn-pdf.has-pdf:hover { background: rgba(231,76,60,0.1); }

/* CP Pris cell with + button */
.td-cp-pris { white-space: nowrap; text-align: center; }
.cp-pris-val { font-weight: 600; font-size: 0.85rem; color: #1a1a2e; }
.btn-cp-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #27ae60;
    background: none;
    color: #27ae60;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}
.btn-cp-plus:hover { background: #27ae60; color: #fff; transform: scale(1.15); }
.btn-cp-plus:active { transform: scale(0.95); }

/* Modal congés */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-conges {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    width: 520px;
    max-width: 95vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-conges-header {
    padding: 1.2rem 1.5rem 0.8rem;
    border-bottom: 1px solid #e2e5ea;
}
.modal-conges-header h3 { margin: 0 0 0.2rem; font-size: 1.1rem; color: #1a1a2e; }
.modal-emp-name { font-size: 0.82rem; color: #7f8fa6; }

.modal-conges-body {
    padding: 1rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.periodes-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.periodes-table thead th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #7f8fa6;
    padding: 0.4rem 0.3rem;
    border-bottom: 1px solid #e2e5ea;
}
.periodes-table tbody td { padding: 0.5rem 0.3rem; vertical-align: middle; }
.periodes-table input[type="date"] {
    padding: 0.4rem 0.45rem;
    border: 1px solid #e2e5ea;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    background: #fafbfc;
    width: 140px;
}
.periodes-table input[type="date"]:focus {
    outline: none;
    border-color: #2d5be3;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(45,91,227,0.1);
}
.periodes-table .p-jours { font-weight: 600; color: #27ae60; text-align: center; min-width: 60px; }

.btn-del-periode {
    background: none;
    border: none;
    color: #c0392b;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 0.3rem;
    line-height: 1;
    transition: transform 0.15s;
}
.btn-del-periode:hover { transform: scale(1.2); }

.btn-add-periode {
    margin-top: 0.8rem;
    padding: 0.45rem 1rem;
    border: 1px dashed #27ae60;
    border-radius: 8px;
    background: none;
    color: #27ae60;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.btn-add-periode:hover { background: #27ae60; color: #fff; }

.modal-conges-footer {
    padding: 0.8rem 1.5rem;
    border-top: 1px solid #e2e5ea;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-total { font-size: 0.95rem; color: #1a1a2e; }
.modal-total strong { font-size: 1.05rem; color: #27ae60; }
.modal-btns { display: flex; gap: 0.6rem; }

.modal-btns .btn {
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
.modal-btns .btn-secondary { background: #e2e5ea; color: #555; }
.modal-btns .btn-secondary:hover { background: #d0d4da; }
.modal-btns .btn-primary { background: #27ae60; color: #fff; }
.modal-btns .btn-primary:hover { background: #219a52; }

/* Modal PDF viewer */
.modal-pdf {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    width: 800px;
    max-width: 95vw;
    height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-pdf-header {
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid #e2e5ea;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-pdf-title {
    font-weight: 700;
    font-size: 1rem;
    color: #1a1a2e;
}
.modal-pdf-btns {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-pdf-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid #e2e5ea;
    border-radius: 8px;
    cursor: pointer;
    color: #2d5be3;
    transition: background 0.2s, transform 0.15s;
}
.btn-pdf-download:hover { background: rgba(45,91,227,0.08); transform: scale(1.05); }
.btn-pdf-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid #e2e5ea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    color: #999;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}
.btn-pdf-close:hover { background: #fee; color: #c0392b; transform: scale(1.05); }
.modal-pdf-body {
    flex: 1;
    overflow: hidden;
}
.modal-pdf-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Responsive */
@media (max-width: 768px) {
    .saisie-table-wrap { border-radius: 8px; }
    .saisi-bar { flex-direction: column; align-items: stretch; }
    .saisi-bar input { width: 100%; }
}
