/**
 * Paper A4 Pro Design System
 * Pour les modules Brouillards de Caisse et Contrôles de Caisse
 */

/* =================================================================
   GRILLE DE FORMULAIRE
   ================================================================= */
body .paper-sheet .custom-form .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    padding-bottom: 40px;
}

/* Espacement accru pour la première ligne de champs sur grand écran */
@media (min-width: 769px) {
    body .paper-sheet .custom-form .form-grid:first-of-type {
        padding-bottom: 55px;
    }
}

body .paper-sheet .custom-form .form-grid .form-group,
body .paper-sheet .custom-form .form-grid > div {
    margin-bottom: 0;
}

/* Champ pleine largeur */
body .paper-sheet .custom-form .form-grid .full-width {
    grid-column: 1 / -1;
}

/* =================================================================
   SÉPARATIONS
   ================================================================= */
body .paper-sheet .custom-form .form-divider {
    grid-column: 1 / -1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
    margin: 5px 0;
}

/* =================================================================
   ACTIONS (Boutons)
   ================================================================= */
body .paper-sheet .custom-form .form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
    padding-top: 25px;
    border-top: 1px solid #e2e8f0;
}

body .paper-sheet .custom-form .form-actions-left {
    justify-content: flex-start;
}

body .paper-sheet .custom-form .form-actions-center {
    justify-content: center;
}

/* =================================================================
   TABLEAUX DE DONNÉES (Améliorations)
   ================================================================= */
body .paper-sheet .data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

body .paper-sheet .data-table thead,
body .paper-sheet .data-table tr:first-child th {
    background: linear-gradient(135deg, var(--primary, #34495e), var(--secondary, #2c3e50));
    color: white;
}

body .paper-sheet .data-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.8px;
    border: none;
}

body .paper-sheet .data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: middle;
    transition: background-color 0.15s;
}

body .paper-sheet .data-table tbody tr:hover td {
    background-color: #f8fafc;
}

body .paper-sheet .data-table tbody tr:last-child td {
    border-bottom: 2px solid #e2e8f0;
}

/* Ligne d'en-tête de tableau (caption) */
body .paper-sheet .data-table .table-caption {
    background-color: #f8fafc;
    font-weight: 700;
    color: var(--secondary, #2c3e50);
    text-align: center;
    padding: 16px;
    font-size: 15px;
    letter-spacing: 0.3px;
    border-bottom: 2px solid #e2e8f0;
}

/* Cellules avec indicateur de survol */
body .paper-sheet .data-table td:first-child {
    border-left: 3px solid transparent;
    transition: border-color 0.2s;
}

body .paper-sheet .data-table tbody tr:hover td:first-child {
    border-left-color: var(--accent, #3498db);
}

/* Ligne de total / report */
body .paper-sheet .data-table .total-row td,
body .paper-sheet .data-table .report-row td {
    background-color: #f8fafc;
    font-weight: 700;
    color: var(--secondary, #2c3e50);
}

/* =================================================================
   MODALS
   ================================================================= */
body .modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease-out;
}

body .modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 70px rgba(0,0,0,0.25);
    max-width: 480px;
    width: 92%;
    overflow: hidden;
    animation: modalSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255,255,255,0.2);
}

body .modal-header {
    background: linear-gradient(135deg, var(--primary, #34495e), var(--secondary, #2c3e50));
    color: white;
    padding: 22px 28px;
    position: relative;
}

body .modal-header h5 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

body .modal-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 28px;
    right: 28px;
    height: 1px;
    background: rgba(255,255,255,0.2);
}

body .modal-body {
    padding: 28px;
    font-size: 15px;
    line-height: 1.6;
    color: #475569;
}

body .modal-footer {
    padding: 18px 28px;
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #f1f5f9;
}

/* =================================================================
   ANIMATIONS
   ================================================================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =================================================================
   SÉPARATEURS HR
   ================================================================= */
body .paper-sheet hr {
    display: block;
    height: 2px;
    background-color: #94a3b8;
    border: 0;
    margin: 30px 0;
}

/* =================================================================
   SECTIONS DE FICHE
   ================================================================= */
body .sheet-section {
    padding: 25px 0;
    border-bottom: 1px solid #e2e8f0;
}

body .sheet-section:last-child {
    border-bottom: none;
}

body .sheet-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--secondary, #2c3e50);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary, #34495e);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =================================================================
   GRILLE D'INFORMATION
   ================================================================= */
body .info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 20px;
}

body .info-grid-single {
    grid-template-columns: 1fr;
}

body .info-grid.info-grid-single {
    grid-template-columns: 1fr;
}

body .info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px dashed #e2e8f0;
}

body .info-row:last-child {
    border-bottom: none;
}

body .info-label {
    font-weight: 600;
    color: var(--secondary, #2c3e50);
    flex: 0 0 180px;
    font-size: 14px;
}

body .info-value {
    font-weight: 500;
    color: #334155;
    text-align: right;
    flex: 1;
}

/* =================================================================
   RESPONSIVE
   ================================================================= */
@media (max-width: 768px) {
    body .paper-sheet .custom-form .form-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding-bottom: 30px;
    }

    body .paper-sheet .custom-form .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    body .paper-sheet {
        padding: 25px;
    }

    body .modal-content {
        width: 95%;
        border-radius: 12px;
    }

    body .info-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    body .info-row {
        flex-direction: column;
    }

    body .info-label {
        flex: none;
        margin-bottom: 5px;
    }
}

/* =================================================================
   STYLES DU MODÈLE (Formulaires type SODISGEN)
   ================================================================= */
body .paper-sheet .form-group {
    margin-bottom: 18px;
}

body .paper-sheet .form-group:last-child {
    margin-bottom: 0;
}

body .paper-sheet .flex-row {
    display: flex;
    gap: 15px;
}

body .paper-sheet .flex-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

body .paper-sheet .clean-input,
body .paper-sheet .form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}

body .paper-sheet .clean-input:focus,
body .paper-sheet .form-control:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

body .paper-sheet .form-label,
body .paper-sheet label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--secondary, #2c3e50);
}

body .paper-sheet .info-box {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

body .paper-sheet .info-box .box-header {
    background: #f8f9fa;
    padding: 12px 20px;
    font-size: 13px;
    font-weight: bold;
    color: var(--primary, #34495e);
    border-bottom: 1px solid #e0e0e0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body .paper-sheet .info-box .box-body {
    padding: 25px;
}

body .paper-sheet .btn-submit {
    display: block !important;
    width: 100% !important;
    padding: 14px !important;
    background: #34495e !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    text-align: center !important;
    transition: transform 0.15s, box-shadow 0.15s !important;
    margin-top: 10px !important;
}

body .paper-sheet .btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

/* ================================================================= */
/* STYLES POLYMORPHES PAR PAILLASSE (LABORATOIRE)                    */
/* ================================================================= */

/* --- Bactériologie (vert menthe) --- */
body .paper-sheet.paillasse-bacteriologie {
    border-left: 5px solid #1abc9c;
}
body .paper-sheet.paillasse-bacteriologie .sheet-header {
    border-bottom-color: #1abc9c;
}
body .paper-sheet.paillasse-bacteriologie .sheet-title {
    color: #16a085;
}
body .paper-sheet.paillasse-bacteriologie .sheet-title i {
    color: #1abc9c;
}

/* --- Biochimie (bleu) --- */
body .paper-sheet.paillasse-biochimie {
    border-left: 5px solid #3498db;
}
body .paper-sheet.paillasse-biochimie .sheet-header {
    border-bottom-color: #3498db;
}
body .paper-sheet.paillasse-biochimie .sheet-title {
    color: #2980b9;
}
body .paper-sheet.paillasse-biochimie .sheet-title i {
    color: #3498db;
}

/* --- Immuno-Sérologie (violet) --- */
body .paper-sheet.paillasse-immuno-serologie {
    border-left: 5px solid #9b59b6;
}
body .paper-sheet.paillasse-immuno-serologie .sheet-header {
    border-bottom-color: #9b59b6;
}
body .paper-sheet.paillasse-immuno-serologie .sheet-title {
    color: #8e44ad;
}
body .paper-sheet.paillasse-immuno-serologie .sheet-title i {
    color: #9b59b6;
}

/* --- Hématologie (rouge) --- */
body .paper-sheet.paillasse-hematologie {
    border-left: 5px solid #e74c3c;
}
body .paper-sheet.paillasse-hematologie .sheet-header {
    border-bottom-color: #e74c3c;
}
body .paper-sheet.paillasse-hematologie .sheet-title {
    color: #c0392b;
}
body .paper-sheet.paillasse-hematologie .sheet-title i {
    color: #e74c3c;
}

/* --- Banque de sang (rouge foncé) --- */
body .paper-sheet.paillasse-banque-de-sang {
    border-left: 5px solid #c0392b;
}
body .paper-sheet.paillasse-banque-de-sang .sheet-header {
    border-bottom-color: #c0392b;
}
body .paper-sheet.paillasse-banque-de-sang .sheet-title {
    color: #a93226;
}
body .paper-sheet.paillasse-banque-de-sang .sheet-title i {
    color: #c0392b;
}

/* --- Anapath (rose/magenta) --- */
body .paper-sheet.paillasse-anapath {
    border-left: 5px solid #e91e63;
}
body .paper-sheet.paillasse-anapath .sheet-header {
    border-bottom-color: #e91e63;
}
body .paper-sheet.paillasse-anapath .sheet-title {
    color: #c2185b;
}
body .paper-sheet.paillasse-anapath .sheet-title i {
    color: #e91e63;
}

/* --- Parasitologie (orange/amber) --- */
body .paper-sheet.paillasse-parasitologie {
    border-left: 5px solid #f39c12;
}
body .paper-sheet.paillasse-parasitologie .sheet-header {
    border-bottom-color: #f39c12;
}
body .paper-sheet.paillasse-parasitologie .sheet-title {
    color: #d68910;
}
body .paper-sheet.paillasse-parasitologie .sheet-title i {
    color: #f39c12;
}

/* --- Biologie Moléculaire (cyan) --- */
body .paper-sheet.paillasse-biologie-moleculaire {
    border-left: 5px solid #00bcd4;
}
body .paper-sheet.paillasse-biologie-moleculaire .sheet-header {
    border-bottom-color: #00bcd4;
}
body .paper-sheet.paillasse-biologie-moleculaire .sheet-title {
    color: #0097a7;
}
body .paper-sheet.paillasse-biologie-moleculaire .sheet-title i {
    color: #00bcd4;
}

/* --- Autres / Non classé (gris) --- */
body .paper-sheet.paillasse-autres {
    border-left: 5px solid #95a5a6;
}
body .paper-sheet.paillasse-autres .sheet-header {
    border-bottom-color: #95a5a6;
}
body .paper-sheet.paillasse-autres .sheet-title {
    color: #7f8c8d;
}
body .paper-sheet.paillasse-autres .sheet-title i {
    color: #95a5a6;
}

/* ================================================================= */
/* STYLES D'IMPRESSION POLYMORPHES PAR PAILLASSE                     */
/* ================================================================= */

@media print {
    body .paper-sheet.paillasse-bacteriologie,
    body .paper-sheet.paillasse-biochimie,
    body .paper-sheet.paillasse-immuno-serologie,
    body .paper-sheet.paillasse-hematologie,
    body .paper-sheet.paillasse-banque-de-sang,
    body .paper-sheet.paillasse-anapath,
    body .paper-sheet.paillasse-parasitologie,
    body .paper-sheet.paillasse-biologie-moleculaire,
    body .paper-sheet.paillasse-autres {
        border-left: none;
        box-shadow: none;
    }
}
