/* ==========================================================================
   MODULE SOINS & MÉDECINS - DESIGN SYSTEM & CLINICAL WORKFLOW
   Fichier : assets/css/soins.css
   ========================================================================== */

/* --- 1. Structure du Layout --- */
.soins-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-body, #f8fafc);
}

.soins-sidebar {
  width: 260px;
  background: #0f172a;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.soins-sidebar .sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.soins-sidebar .sidebar-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.soins-sidebar .sidebar-title h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: #ffffff;
}

.soins-sidebar .sidebar-title span {
  font-size: 0.75rem;
  color: #94a3b8;
}

.soins-sidebar .sidebar-nav {
  padding: 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.soins-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.soins-sidebar .nav-link svg {
  width: 20px;
  height: 20px;
}

.soins-sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.soins-sidebar .nav-link.active {
  background: var(--primary, #0284c7);
  color: #ffffff;
}

.soins-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.soins-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.soins-topbar h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.25rem 0;
}

.sub-header-date {
  font-size: 0.82rem;
  color: #64748b;
}

.soins-content {
  padding: 2rem;
}

/* --- 2. Alertes Visuelles Haut de Page (Positionnées dans le flux principal) --- */
.soins-main .alert-banner {
  margin: 1.25rem 2rem 0 2rem;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  border-left: 5px solid #059669;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-left: 5px solid #dc2626;
}

.alert-content {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.alert-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: inherit;
  padding: 0;
}

.print-quick-links {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.btn-print-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #ffffff;
  color: #047857;
  border: 1.5px solid #059669;
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.82rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease-in-out;
}

.btn-print-tag:hover {
  background-color: #059669;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.25);
}

/* --- 3. Barre de Filtres & Sélecteur --- */
.praticien-select-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
}

.praticien-select-form select {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-weight: 500;
  color: #0f172a;
}

.toolbar-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

.filter-group select {
  height: 38px;
  padding: 0 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
}

/* --- 4. Tableau File Active --- */
.table-card {
    background: #ffffff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    overflow-x: auto !important; /* Permet le scroll horizontal si l'écran est étroit */
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.table-card .data-table {
    width: 100%;
    min-width: 980px; /* Garantit que toutes les colonnes s'affichent sans compression */
    border-collapse: collapse;
}

.table-card .data-table th,
.table-card .data-table td {
    white-space: nowrap; /* Évite les retours à la ligne intempestifs sur les boutons */
}

.ticket-pill {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-weight: 800;
  color: #0f172a;
  font-family: monospace;
}

.patient-name { font-weight: 700; color: #0f172a; }
.patient-id { font-size: 0.75rem; color: #64748b; }
.motif-titre { font-weight: 600; color: #0f172a; }
.service-sous-titre { font-size: 0.78rem; color: #64748b; }

.status-indicator {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
}
.status-attente  { background: #f1f5f9; color: #475569; }
.status-appele   { background: #e0f2fe; color: #0369a1; }
.status-en_cours { background: #dcfce7; color: #15803d; }
.status-termine  { background: #f8fafc; color: #94a3b8; text-decoration: line-through; }
.status-absent   { background: #fee2e2; color: #b91c1c; }

.badge-constantes {
  display: inline-block;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-constantes-none { color: #94a3b8; font-size: 0.75rem; font-style: italic; }

.badge-suivi {
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
}
.badge-suivi-none { color: #94a3b8; font-size: 0.75rem; font-style: italic; }

.row-vitale { background: #fff1f2 !important; border-left: 4px solid #e11d48; }

.actions-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* --- 5. Fenêtres Modales --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-container {
  background: #ffffff;
  border-radius: 12px;
  width: 90%;
  box-shadow: 0 20px 30px rgba(0,0,0,0.2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-large {
  max-width: 920px !important;
  width: 95% !important;
}

.modal-table-select {
  max-width: 680px !important;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  color: #0f172a;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: #94a3b8;
}

.modal-body-scroll {
  padding: 1.5rem;
  max-height: 72vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* --- 6. Formulaires & Sections --- */
.form-section {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  background: #ffffff;
}

.form-section legend {
  font-weight: 700;
  color: #0f172a;
  padding: 0 0.5rem;
  font-size: 0.9rem;
}

.section-footer-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.input-form {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 0.88rem;
  width: 100%;
}

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }

/* --- 7. TDR Gratuits (mg/dL & Radios Positif/Négatif) --- */
.tdr-list-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.tdr-card-item {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
}

.tdr-col-type { flex: 2; }
.tdr-col-valeur { flex: 3; }

.select-tdr-type {
  width: 100%;
  height: 38px;
  padding: 0 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background-color: #ffffff;
  color: #0f172a;
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.select-tdr-type:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.select-tdr-type option:disabled {
  color: #94a3b8;
  background-color: #f1f5f9;
}

.dextro-input-wrap {
  display: flex;
  gap: 6px;
}

.select-unit {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 8px;
  font-weight: 600;
  background: #f8fafc;
}

.radio-pill-group {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.radio-pill.pill-neg:hover { border-color: #0284c7; background: #f0f9ff; }
.radio-pill.pill-pos:hover { border-color: #ef4444; background: #fef2f2; }

.btn-delete-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1rem;
  flex-shrink: 0;
  margin-bottom: 2px;
  transition: all 0.2s;
}

.btn-delete-circle:hover { background: #dc2626; color: #ffffff; }

/* --- 8. Tableaux d'Examens Demandés --- */
.examens-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.btn-action-card {
  background: #ffffff;
  border: 1.5px solid #0284c7;
  color: #0284c7;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.btn-action-card:hover {
  background: #0284c7;
  color: #ffffff;
}

.examens-tables-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.exam-table-box h5 {
  margin: 0 0 8px 0;
  font-size: 0.82rem;
  color: #475569;
}

.table-mini-exam {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.table-mini-exam th {
  background: #f1f5f9;
  font-size: 0.75rem;
  padding: 6px 10px;
  border-bottom: 1px solid #e2e8f0;
}

.table-mini-exam td {
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.82rem;
}

.empty-row {
  text-align: center;
  color: #94a3b8;
  font-style: italic;
  padding: 12px !important;
}

.btn-delete-row {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-delete-row:hover { background: #dc2626; color: #ffffff; }

/* Grille interactive de sélection d'examens */
.search-input-modal {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.examens-grid-wrapper {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.exam-row-label {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.15s ease;
}

.exam-row-label:hover {
  background: #f0f9ff;
}

.exam-row-check {
  margin-right: 12px;
  display: flex;
  align-items: center;
}

.exam-row-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.exam-row-info {
  flex: 1;
  font-size: 0.88rem;
  color: #0f172a;
}

.exam-row-price {
  font-weight: 700;
  color: #0284c7;
  font-size: 0.85rem;
}

/* --- 9. Tableau Ordonnance --- */
.table-ordonnance {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}

.table-ordonnance th {
  background: #f8fafc;
  font-size: 0.78rem;
  color: #475569;
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.table-ordonnance td { padding: 4px 6px; }

/* --- 10. Boutons d'Action & Pied de Modale --- */
.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  outline: none;
}

.btn-primary {
  background-color: #0284c7;
  color: #ffffff;
}
.btn-primary:hover { background-color: #0369a1; }

.btn-outline {
  background-color: #ffffff;
  color: #475569;
  border: 1px solid #cbd5e1;
}
.btn-outline:hover { background-color: #f1f5f9; color: #0f172a; }

.btn-ghost {
  background: #f1f5f9;
  color: #475569;
}
.btn-ghost:hover { background: #e2e8f0; color: #0f172a; }

.btn-outline-primary {
  background: transparent;
  border-color: #0284c7;
  color: #0284c7;
}
.btn-outline-primary:hover { background: #f0f9ff; }

.btn-success {
  background: #059669;
  color: #ffffff;
}
.btn-success:hover { background: #047857; }

.decision-radios {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.decision-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #f8fafc;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
}

.d-none { display: none !important; }

/* ==========================================================================
   DROPDOWN AUTOCOMPLÉTION LIVRET PHARMACIE EN CONSULTATION
   ========================================================================== */

/* Cellule parente de saisie */
#tbodyOrdonnance td {
    position: relative;
}

/* Boîte flottante de suggestions */
#tbodyOrdonnance .actes-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 380px !important;       /* Largeur fixe idéale pour afficher marque + DCI + dosage */
    max-height: 220px !important;  /* Hauteur plafonnée nette */
    overflow-y: auto !important;   /* Défilement fluide interne */
    background: #ffffff !important;
    border: 1.5px solid #0284c7 !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18) !important;
    z-index: 99999 !important;
    margin-top: 4px;
    padding: 0 !important;
}

/* Ligne individuelle de suggestion */
#tbodyOrdonnance .acte-suggestion-item {
    padding: 8px 12px !important;
    cursor: pointer !important;
    border-bottom: 1px solid #f1f5f9 !important;
    transition: background 0.15s ease !important;
    text-align: left !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

#tbodyOrdonnance .acte-suggestion-item:last-child {
    border-bottom: none !important;
}

#tbodyOrdonnance .acte-suggestion-item:hover {
    background: #f0f9ff !important;
}

/* Masquage propre */
#tbodyOrdonnance .actes-search-results.d-none {
    display: none !important;
}
