@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Parkinsans:wght@600&display=swap');

/* --- NOUVEAU : Variables pour le Zoom --- */
:root {
    --hour-col-width: 48px; /* Largeur par défaut */
}

/* NOUVEAU : Keyframes pour les animations du bouton */
@keyframes fadeInStatus {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
/* FIN NOUVEAU */

html {
    scroll-behavior: smooth;
}
body {
    font-family: 'Inter', sans-serif;
    color: #1f2937;
}

#sidebar h1 {
    font-family: 'Parkinsans', sans-serif;
    font-weight: 600;
}

#main-content-wrapper {
    overflow-y: scroll;
    scrollbar-width: none; 
    -ms-overflow-style: none;  
}
#main-content-wrapper::-webkit-scrollbar {
    display: none;
}

.content-section { display: none; }
.content-section.active { display: block; animation: fadeIn 0.5s ease-in-out; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.card {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 16px; 
    border: 1px solid #e5e7eb;
}
#patient-header-form .card {
    padding: 0.5rem; 
}
.card-header {
    font-size: 1.25rem;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}
.card-header.header-teal { color: #0f766e; border-bottom-color: #5eead4; border-bottom-width: 2px; } 
.card-header.header-blue { color: #1e40af; border-bottom-color: #60a5fa; border-bottom-width: 2px; } 
.card-header.header-rose { color: #be123c; border-bottom-color: #fb7185; border-bottom-width: 2px; }
.card-header.header-indigo { color: #4338ca; border-bottom-color: #a5b4fc; border-bottom-width: 2px; }
.card-header.header-green { color: #15803d; border-bottom-color: #86efac; border-bottom-width: 2px; }
.card-header.header-purple { color: #7e22ce; border-bottom-color: #d8b4fe; border-bottom-width: 2px; }
.card-header.header-orange { color: #c2410c; border-bottom-color: #fdba74; border-bottom-width: 2px; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.info-item {
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease-in-out;
    background-color: #fff;
}
.info-item:focus-within {
    border-color: #4f46e5;
    box-shadow: 0 0 0 1px #4f46e5;
}
.info-label { font-size: 0.875rem; color: #6b7280; margin-bottom: 4px; }
.info-value { font-size: 1rem; font-weight: 500; color: #1f2937; }

.timeline-item { position: relative; padding-left: 2rem; border-left: 2px solid #e5e7eb; }
.timeline-dot { position: absolute; left: -0.6rem; top: 0.25rem; height: 1rem; width: 1rem; border-radius: 9999px; border: 3px solid white; }
.timeline-dot.dot-rose { background-color: #f43f5e; }
.timeline-dot.dot-green { background-color: #22c55e; }

.diagram th, .diagram td { border: 1px solid #e5e7eb; padding: 0.5rem; vertical-align: middle; }
.diagram input[type="checkbox"] { height: 1.1rem; width: 1.1rem; accent-color: #3b82f6; }
.diagram thead { font-size: 0.8rem; background-color: #f9fafb; color: #374151; }

.diagram input[type="text"], .diagram input[type="number"] {
    width: 100%; border: none; text-align: center; padding: 4px; background-color: transparent;
    transition: background-color 0.2s; color: #1f2937; font-size: 0.75rem;
}
.diagram input[type="text"]:focus, .diagram input[type="number"]:focus {
    outline: 2px solid #3b82f6; background-color: #eff6ff; border-radius: 4px;
}
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    appearance: textfield;
    -moz-appearance: textfield;
}
.continuous-surveillance { background-image: linear-gradient(45deg, #fef3c7 25%, transparent 25%, transparent 50%, #fef3c7 50%, #fef3c7 75%, transparent 75%, transparent 100%); background-size: 20px 20px; }

.styled-input, select.styled-input { 
    background-color: #f9fafb; border: 1px solid #d1d5db; transition: all 0.2s ease-in-out;
    padding: 0.5rem 0.75rem; border-radius: 0.375rem;
    width: 100%;
    -webkit-appearance: none; 
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); 
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem; 
}
.styled-input:focus, select.styled-input:focus { 
    outline: 2px solid #3b82f6; outline-offset: -1px;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); border-color: #3b82f6;
}
textarea.info-value {
    resize: none;
    overflow: hidden;
}

.styled-input:disabled, textarea.info-value:disabled, input.info-value:disabled {
    background-color: transparent;
    border-color: transparent;
    cursor: default;
    color: #1f2937;
}
.info-item > textarea.info-value,
.info-item > input.info-value,
.info-item > textarea.info-value:disabled,
.info-item > input.info-value:disabled {
   background-color: transparent;
   border-color: transparent;
   padding: 0;
   border-radius: 0;
   box-shadow: none;
   width: 100%;
}
.info-item > textarea.info-value:focus,
.info-item > input.info-value:focus {
    outline: none;
    box-shadow: none;
    border-color: transparent;
}
.info-item > input[type="date"].info-value::-webkit-calendar-picker-indicator {
    filter: invert(0.35);
}
.info-item > input[type="date"].info-value:disabled::-webkit-calendar-picker-indicator {
    display: none;
}
.preserve-whitespace {
    white-space: pre-wrap;
}

#custom-confirm-modal #custom-confirm-box,
#cr-modal #cr-modal-box { 
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}
#sidebar {
    transition: width 0.3s ease;
}
#patient-list li button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    text-align: left;
}
#patient-list li button:hover {
    background-color: #f3f4f6; 
}
#patient-list li button.active {
    background-color: #0d9488; 
    color: white;
    font-weight: 600;
}
#patient-list li button.active .patient-room {
    color: #ccfbf1; 
}
#patient-list li button .patient-icon {
    margin-right: 0.75rem;
    width: 1.25rem;
    text-align: center;
}
.patient-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.patient-room {
    font-size: 0.8rem;
    color: #6b7280; 
    margin-left: 0.5rem;
}

.iv-bar-container {
    position: relative;
    height: 38px;
    padding: 0 !important;
    cursor: crosshair;
}
.iv-bar {
    position: absolute;
    top: 55%;
    transform: translateY(-50%);
    height: 50%;
    background-color: #60a5fa;
    border: 1px solid #2563eb;
    border-radius: 4px;
    cursor: move;
    z-index: 10;
}
/* --- UX BARRE : Indiquer le survol et la possibilité de suppression --- */
.iv-bar:hover {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8), 0 0 4px rgba(0,0,0,0.5);
    z-index: 20; 
}
.iv-bar[title*="supprimer"]:hover {
    cursor: help; 
}

.resize-handle {
    position: absolute;
    right: -2px;
    top: -2px;
    width: 10px;
    height: calc(100% + 4px);
    cursor: ew-resize;
    z-index: 11;
}
body.is-drawing-iv, body.is-resizing-iv, body.is-moving-iv {
    cursor: ew-resize !important;
    user-select: none;
}

.iv-bar-container .iv-time-label {
    position: absolute;
    font-family: monospace;
    font-size: 11px;
    font-weight: 700; 
    background-color: #1f2937; 
    color: #ffffff; 
    padding: 2px 4px; 
    border-radius: 4px; 
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25); 
    border: 1px solid rgba(0, 0, 0, 0.3);
    pointer-events: none;
    white-space: nowrap;
    z-index: 12; 
    line-height: 1.2; 
}
.iv-time-label.start {
    text-align: left;
}
.iv-time-label.end {
    text-align: right;
}


#tutorial-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
    z-index: 9990;
    transition: opacity 0.3s ease;
}
#tutorial-step-box {
    position: absolute;
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    width: 100%;
    max-width: 350px;
    transition: top 0.3s ease, left 0.3s ease, opacity 0.3s ease;
}
.tutorial-highlight {
    position: relative;
    z-index: 9995 !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.7);
    border-radius: 0.5rem;
}
.tutorial-highlight > * {
     position: relative;
     z-index: 9996;
}
#header-buttons .tutorial-highlight {
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#header-buttons .tutorial-highlight i,
#save-status-button.tutorial-highlight i {
     color: white !important;
     z-index: 9997;
}
#sidebar .tutorial-highlight {
    background-color: white;
}
#save-status-button.tutorial-highlight {
    border-radius: 9999px; 
}


/* --- MODIFICATION : Small-col utilise la variable pour le zoom --- */
.small-col {
    min-width: var(--hour-col-width);
    width: var(--hour-col-width);
    text-align: center;
    padding-left: 0.125rem; 
    padding-right: 0.125rem;
    font-size: 0.75rem;
    transition: width 0.2s ease, min-width 0.2s ease;
}
.small-col input[type="checkbox"] {
    display: block;
    margin: 0.35rem auto; 
}


/* --- NOUVEAU : STICKY PRESCRIPTION TABLE --- */

#prescriptions .overflow-x-auto {
    overflow: auto; 
}
#prescription-table {
    border-collapse: separate; 
    border-spacing: 0;
}

#prescription-thead {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 10; 
}
#prescription-thead th {
    background-color: #f9fafb; 
}

#prescription-thead tr:first-child th:nth-child(-n+4) {
    position: -webkit-sticky;
    position: sticky;
    left: 0; 
    z-index: 30; 
    top: 0; 
}
#prescription-thead tr:first-child th:nth-child(1) { left: 0px; }
#prescription-thead tr:first-child th:nth-child(2) { left: 220px; } 
#prescription-thead tr:first-child th:nth-child(3) { left: 364px; } 
#prescription-thead tr:first-child th:nth-child(4) { left: 460px; } 

#prescription-tbody tr td:nth-child(-n+4) {
    position: -webkit-sticky;
    position: sticky;
    z-index: 20; 
    background-color: white; 
}
#prescription-tbody tr td:nth-child(1) { left: 0px; }
#prescription-tbody tr td:nth-child(2) { left: 220px; }
#prescription-tbody tr td:nth-child(3) { left: 364px; } 
#prescription-tbody tr td:nth-child(4) { left: 460px; } 

#prescription-tbody tr td:nth-child(n+5) {
     position: relative;
     z-index: 1; 
}

.iv-bar-container {
    z-index: 2; 
    position: relative; 
}
.iv-bar {
    z-index: 3; 
}
.iv-bar-container .iv-time-label {
    z-index: 4; 
}
/* --- FIN STICKY PRESCRIPTION TABLE --- */

/* --- AJOUTS POUR LES MARQUEURS PER OS --- */

.iv-bar.marker-bar {
    background-color: transparent;
    border: none;
    height: 0; 
    cursor: move; 
}

.iv-bar.marker-bar::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background-color: #f97316; 
    border: 1px solid #c2410c; 
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

.iv-bar.iv-bar-respi {
    background-color: #f59e0b; 
    border-color: #b45309; 
}

.iv-bar.marker-bar .resize-handle {
    display: none;
}

.iv-bar-container.marker-container .iv-time-label.end {
    display: none;
}

#prescription-thead .small-col,
#care-diagram-thead .small-col {
    position: relative; 
    transform: translateX(-50%);
    overflow: visible; 
}

#pancarte-table th:first-child,
#pancarte-table td:first-child,
#glycemie-table th:first-child,
#glycemie-table td:first-child {
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 10;
}

#pancarte-table thead th,
#glycemie-table thead th {
    z-index: 11;
}

#pancarte-table thead tr:first-child th:first-child,
#glycemie-table thead tr:first-child th:first-child {
    z-index: 12;
}

#pancarte-table td:first-child,
#glycemie-table td:first-child {
    background-color: white;
}

#pancarte-table thead th:first-child,
#glycemie-table thead th:first-child {
    background-color: #f9fafb; 
}

.cr-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e5e7eb; 
    border-radius: 0.75rem; 
    background-color: white;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.cr-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    border-color: #d1d5db; 
}
.cr-card:focus {
    outline: 2px solid #be123c; 
    outline-offset: 2px;
}
.cr-card-icon {
    flex-shrink: 0;
    width: 2.5rem; 
    height: 2.5rem; 
    border-radius: 9999px; 
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem; 
    margin-right: 0.75rem; 
}
.cr-card-title {
    font-weight: 600; 
    color: #1f2937; 
    text-align: left;
    flex-grow: 1;
}
.cr-check-icon {
    position: absolute;
    top: 0.5rem; 
    right: 0.5rem; 
    font-size: 1.25rem; 
    color: #16a34a; 
}
.cr-check-icon.hidden {
    display: none;
}

/* --- STYLES POUR LE BOUTON DE STATUT --- */

#save-status-button {
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

#save-status-button i,
#save-status-button span {
    transition: opacity 0.3s ease, transform 0.3s ease;
    animation: fadeInStatus 0.4s ease forwards;
}

.status-saved {
    background-color: #10b981; 
    color: white;
}
.status-saved:hover {
    background-color: #059669; 
    transform: scale(1.05); 
}
.status-saved:active {
    transform: scale(0.98); 
}

.status-dirty {
    background-color: #f97316; 
    color: white;
    animation: pulse-orange 2s infinite; 
}
.status-dirty:hover {
    background-color: #ea580c; 
    animation-play-state: paused; 
    transform: scale(1.05);
}
.status-dirty:active {
    transform: scale(0.98);
}

.status-saving {
    background-color: #3b82f6; 
    color: white;
    /* ***** MODIFICATION : Ligne supprimée ***** */
    /* cursor: not-allowed; */
}
.status-saving #save-status-icon {
    animation: spin 1s linear infinite;
}


@keyframes pulse-orange {
    0% {
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(249, 115, 22, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
    }
}

/* --- NOUVEAU : STYLES POUR LE TOAST --- */
#toast-notification {
    /* Positionné par 'fixed' dans simul.html */
    z-index: 9999;
    /* L'état 'caché' par défaut. La classe 'show' sera ajoutée par JS */
    transform: translateX(calc(100% + 1rem)); /* 1rem = right-4 */
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#toast-notification.show {
    /* L'état 'visible' */
    transform: translateX(0);
}
/* --- FIN DES NOUVEAUX STYLES --- */

/* --- NOUVEAU : Style pour l'alerte Allergie --- */
.info-item.allergy-active {
    background-color: #ffedd5 !important; /* bg-orange-100 */
    border: 2px solid #f97316 !important; /* border-orange-500 */
    animation: pulse-allergy-border 2s infinite;
}
.info-item.allergy-active .info-label {
    color: #c2410c !important; /* text-orange-700 */
    font-weight: 700;
}
.info-item.allergy-active textarea {
    color: #9a3412 !important; /* text-orange-800 */
    font-weight: 600;
}

@keyframes pulse-allergy-border {
    0% { border-color: #f97316; box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4); }
    50% { border-color: #fb923c; box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.2); }
    100% { border-color: #f97316; box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}

/* --- STYLES POUR L'ÉDITEUR DE COMPTE RENDU --- */

#cr-modal-content {
    font-family: 'Times New Roman', Times, serif; /* Police type courrier/médical */
    font-size: 1.1rem;
    line-height: 1.5;
    color: #000;
}

#cr-modal-content ul {
    list-style-type: disc;
    padding-left: 20px;
    margin: 10px 0;
}

#cr-modal-content ol {
    list-style-type: decimal;
    padding-left: 20px;
    margin: 10px 0;
}

#cr-modal-content b, #cr-modal-content strong {
    font-weight: bold;
}

#cr-modal-content i, #cr-modal-content em {
    font-style: italic;
}

#cr-modal-content u {
    text-decoration: underline;
}

/* Style spécifique pour les tailles de police générées par execCommand */
#cr-modal-content font[size="5"] {
    font-size: 1.5rem;
    font-weight: bold;
    display: block;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}