/* ============================================
   CDS Fianarantsoa — THÈME STABLE MARINE + OR v4
   Header : fixe horizontal (navbar + dropdowns)
   Contenu : fond clair (lisibilité garantie)
   ============================================ */

/* --- HEADER FIXE --- */
header[class*="fixed"] {
  background-color: #0D1F3C !important;
  border-bottom: 1px solid #1E3A5F !important;
}

header button.btn-ghost {
  background-color: transparent !important;
  border: none !important;
}

header .dropdown label.btn-ghost[style*="border-radius:20px"] {
  background-color: #1E3A5F !important;
}

/* --- HORIZONTAL NAV DROPDOWNS --- */
header nav a.no-underline:hover {
  color: #E8EDF5 !important;
  background-color: #112240 !important;
}

/* --- FOND DE PAGE (zone contenu) --- */
body {
  background-color: #F0F4F8 !important;
}

main,
.main,
[class*="main-content"],
[class*="page-content"],
.content-wrapper {
  background-color: #F0F4F8 !important;
}

/* --- CARDS / PANELS (fond blanc, lisible) --- */
.card,
.panel,
[class*="card"]:not([class*="nav"]),
[class*="panel"],
.box,
.widget {
  background-color: #ffffff !important;
  border: 0.5px solid #D1DCE8 !important;
  color: #0A1628 !important;
}

/* --- TEXTES dans le contenu --- */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: #0A1628 !important;
}

p,
span,
div,
td,
li {
  color: inherit;
}

.text-muted,
.text-secondary,
small,
[class*="text-muted"] {
  color: #64748B !important;
}

/* --- TITRES DE PAGE --- */
.page-title,
[class*="page-title"],
h1[class*="title"],
.section-header h2 {
  color: #0A1628 !important;
}

.page-title i,
.page-title svg,
[class*="page-title"] i {
  color: #C9A84C !important;
}

/* --- SOUS-CARDS internes --- */
.card .card,
.sub-card,
[class*="inner-card"],
.panel .panel,
.card>.card-body>.card {
  background-color: #F8FAFC !important;
  border: 0.5px solid #E2E8F0 !important;
}

/* --- CARDS DE RDV / LISTE PATIENTS --- */
[class*="rdv-card"],
[class*="appointment"],
[class*="patient-row"],
[class*="list-item"] {
  background-color: #ffffff !important;
  border: 0.5px solid #D1DCE8 !important;
  color: #0A1628 !important;
}

[class*="rdv-card"]:hover,
[class*="appointment"]:hover {
  border-color: #C9A84C !important;
}

/* --- TEMPS / HEURE RDV --- */
[class*="rdv-time"],
[class*="time-val"],
.time,
[class*="hour"] {
  color: #C9A84C !important;
  font-weight: 600 !important;
}

/* --- SÉPARATEURS DE DATE --- */
[class*="date-separator"],
[class*="date-group"],
[class*="date-header"] {
  color: #94A3B8 !important;
  border-color: #E2E8F0 !important;
  font-size: 12px !important;
  font-weight: 400 !important;
}

/* --- BADGES DE STATUT --- */
[class*="badge-traite"],
.status-done,
[class*="status-traite"] {
  background-color: #DCFCE7 !important;
  color: #166534 !important;
}

[class*="badge-attente"],
.status-waiting,
[class*="status-attente"] {
  background-color: #FEF3C7 !important;
  color: #92400E !important;
}

[class*="badge-malade"],
[class*="badge-urgent"],
.status-danger {
  background-color: #FEE2E2 !important;
  color: #991B1B !important;
}

[class*="badge-fait"] {
  background-color: #DCFCE7 !important;
  color: #166534 !important;
}

/* --- TAGS ID PATIENT --- */
[class*="patient-id"],
[class*="tag-id"],
code,
.badge-id {
  background-color: #F1F5F9 !important;
  color: #475569 !important;
  font-family: monospace !important;
  font-size: 11px !important;
  padding: 1px 6px !important;
  border-radius: 4px !important;
}

/* --- NOMS PATIENTS ET STATUTS --- */
[class*="patient-name"],
[class*="rdv"] h3,
[class*="rdv"] h4,
[class*="rdv"] strong,
[class*="appointment"] .name {
  color: #0A1628 !important;
}

[class*="status-malade"],
[class*="badge-malade"] {
  color: #991B1B !important;
  background: #FEE2E2 !important;
  padding: 2px 8px !important;
  border-radius: 10px !important;
  font-size: 11px !important;
}

/* --- SOUS-TITRE DE DATE --- */
[class*="subtitle"],
[class*="date-sub"],
h1+span,
h1+p,
h2+span,
.page-subtitle {
  color: #94A3B8 !important;
}

/* --- DROPDOWN UTILISATEUR --- */
[class*="dropdown-content"],
[class*="user-menu"],
[class*="profile-dropdown"] {
  background-color: #0D1F3C !important;
  border: 0.5px solid #1E3A5F !important;
  color: #E8EDF5 !important;
}

[class*="dropdown-content"] a,
[class*="dropdown-content"] span,
[class*="dropdown-content"] li {
  color: #E8EDF5 !important;
}

[class*="dropdown-content"] a:hover {
  background: #112240 !important;
  color: #C9A84C !important;
}

/* --- BOUTONS --- */
.btn-primary,
button[type="submit"],
[class*="btn-primary"] {
  background-color: #C9A84C !important;
  color: #0A1628 !important;
  border: none !important;
  font-weight: 600 !important;
}

.btn-primary:hover {
  background-color: #E2BC6A !important;
}

.btn-secondary,
.btn-outline,
[class*="btn-secondary"],
[class*="btn-ghost"] {
  background-color: #F8FAFC !important;
  color: #475569 !important;
  border: 0.5px solid #D1DCE8 !important;
}

.btn-secondary:hover {
  border-color: #C9A84C !important;
  color: #C9A84C !important;
}

/* --- INPUTS --- */
input,
select,
textarea {
  background-color: #ffffff !important;
  border: 0.5px solid #D1DCE8 !important;
  color: #0A1628 !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #C9A84C !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.15) !important;
}

input::placeholder,
textarea::placeholder {
  color: #6B7280 !important;
}

/* --- TABLES --- */
table {
  background-color: #ffffff !important;
}

thead,
th {
  background-color: #F8FAFC !important;
  color: #64748B !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  border-bottom: 0.5px solid #E2E8F0 !important;
}

td {
  color: #0A1628 !important;
  border-bottom: 0.5px solid #F1F5F9 !important;
}

tr:hover td {
  background-color: #F8FAFC !important;
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: #F0F4F8;
}

::-webkit-scrollbar-thumb {
  background: #D1DCE8;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #C9A84C;
}

/* --- BADGE WARNING --- */
.badge-warning,
[class*="badge-warning"] {
  background-color: #FEF3C7 !important;
  color: #92400E !important;
  border-radius: 10px !important;
  font-size: 11px !important;
  padding: 3px 10px !important;
  font-weight: 500 !important;
  border: none !important;
}

/* --- LIENS PATIENTS dans les tables --- */
table a,
td a,
[class*="patient-link"],
[class*="patient-name"] a {
  color: #0A1628 !important;
  text-decoration: none !important;
  font-weight: 500 !important;
}

table a:hover,
td a:hover {
  color: #C9A84C !important;
  text-decoration: underline !important;
}

/* --- MODAL --- */
.modal-box,
dialog .modal-box,
[class*="modal-content"] {
  background-color: #ffffff !important;
  border: 0.5px solid #D1DCE8 !important;
  border-radius: 12px !important;
}

.modal-box h2,
dialog h3,
[class*="modal"] h2,
[class*="modal"] h3 {
  color: #0A1628 !important;
  font-weight: 600 !important;
}

.modal-box p,
dialog p,
[class*="modal"] p {
  color: #475569 !important;
}

.modal-box strong,
dialog strong,
[class*="modal"] strong {
  color: #0A1628 !important;
  font-weight: 600 !important;
}

.modal-box .btn-ghost,
dialog .btn-ghost,
.modal-action .btn-ghost {
  background-color: #F1F5F9 !important;
  color: #475569 !important;
  border: 0.5px solid #D1DCE8 !important;
  border-radius: 8px !important;
}

.modal-box .btn-error,
dialog .btn-error {
  background-color: #DC2626 !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
}

/* --- MODAL FORM FIELDS : style des champs bruts (forms sans classes widgets) --- */
#medicament-modal-content input:not([type="checkbox"]):not([type="radio"]),
#medicament-modal-content select,
#medicament-modal-content textarea,
#fournisseur-modal-content input:not([type="checkbox"]):not([type="radio"]),
#fournisseur-modal-content select,
#fournisseur-modal-content textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid #D1DCE8 !important;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background-color: #ffffff;
  color: #1E3A5F;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#medicament-modal-content input:not([type="checkbox"]):not([type="radio"]):focus,
#medicament-modal-content select:focus,
#medicament-modal-content textarea:focus,
#fournisseur-modal-content input:not([type="checkbox"]):not([type="radio"]):focus,
#fournisseur-modal-content select:focus,
#fournisseur-modal-content textarea:focus {
  border-color: #C9A84C !important;
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
}

#medicament-modal-content input[type="checkbox"],
#fournisseur-modal-content input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #C9A84C;
}

#medicament-modal-content select[multiple],
#fournisseur-modal-content select[multiple] {
  min-height: 110px;
  padding: 0.375rem;
}

#medicament-modal-content select[multiple] option,
#fournisseur-modal-content select[multiple] option {
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
}

#medicament-modal-content select[multiple] option:checked,
#fournisseur-modal-content select[multiple] option:checked {
  background-color: #C9A84C;
  color: #ffffff;
  font-weight: 600;
}

/* --- CARD HEADER AVATAR (UC) --- */
header .avatar.placeholder div.avatar-user {
  background-color: #C9A84C !important;
  color: #FFFFFF !important;
  border: none !important;
  border-radius: 50% !important;
}

/* --- RESPONSIVE --- */
@media (max-width: 480px) {
  .topbar-username {
    display: none !important;
  }

  header[class*="fixed"] {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

@media (max-width: 767px) {
  .table-actions .btn-text {
    display: none !important;
  }

  .table-actions .btn-icon-only {
    display: inline-flex !important;
  }

  .pagination-pages {
    display: none !important;
  }

  .pagination-compact {
    display: flex !important;
  }
}

@media (min-width: 768px) {
  .table-actions .btn-icon-only {
    display: none !important;
  }

  .pagination-compact {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  .accueil-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  .table-actions {
    flex-direction: column;
    gap: 2px;
  }

  .btn-text {
    display: none;
  }

  .table th,
  .table td {
    padding: 6px 4px;
    font-size: 0.7rem;
  }
}

/* --- PAGINATION --- */
.join.flex-wrap {
  max-width: 100%;
  overflow-x: auto;
}

/* --- LISIBILITÉ --- */
input::placeholder,
textarea::placeholder {
  color: #6B7280 !important;
  opacity: 1;
}

.text-primary\/60 {
  color: rgba(201, 168, 76, 0.85) !important;
}

.text-primary\/40 {
  color: rgba(201, 168, 76, 0.65) !important;
}

.text-neutral-content\/50 {
  color: rgba(255, 255, 255, 0.65) !important;
}

.text-neutral-content\/40 {
  color: rgba(255, 255, 255, 0.55) !important;
}

/* --- TITRES CARDS --- */
.card h1,
.card h2,
.card h3,
[class*="card-title"],
.text-2xl,
.text-xl,
.text-lg {
  color: #0A1628 !important;
}

.card .text-primary\/60,
.card .text-primary\/50,
.card .text-primary\/40 {
  color: #4A6080 !important;
}

/* --- TEXTES HINTS --- */
.bg-base-100 p,
.bg-base-100 small,
.bg-base-100 .text-sm {
  color: #1E3A5F;
}

.bg-base-100 .text-base-content\/50,
.bg-base-100 .opacity-50,
.card .text-neutral-content {
  color: #4A6080 !important;
  opacity: 1 !important;
}

/* --- NUCLEAR OVERRIDE : grands titres --- */
.bg-white h1,
.bg-base-100 h1,
.bg-white h2,
.bg-base-100 h2,
.bg-white h3,
.bg-base-100 h3,
.bg-white h4,
.bg-base-100 h4,
.card h1,
.card h2,
.card h3,
.card h4,
.drawer-content h1,
.drawer-content h2,
.drawer-content h3,
main h1,
main h2,
main h3 {
  color: #0A1628 !important;
  opacity: 1 !important;
}

.bg-white .text-sm,
.bg-base-100 .text-sm,
.bg-white .text-xs,
.bg-base-100 .text-xs,
.card .text-sm,
.card .text-xs {
  color: #1E3A5F !important;
  opacity: 1 !important;
}

.bg-white p,
.bg-base-100 p,
.card p {
  color: #1E3A5F !important;
  opacity: 1 !important;
}

.bg-white thead th,
.bg-base-100 thead th,
.card thead th {
  color: #0A1628 !important;
  opacity: 1 !important;
  font-weight: 600;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: #0A1628 !important;
}

/* --- FORCER text-base-content en sombre sur fond clair --- */
.bg-white .text-base-content,
.card .text-base-content,
main .text-base-content,
.bg-base-100 .text-base-content {
  color: #0A1628 !important;
}

.bg-white .text-base-content\/60,
.card .text-base-content\/60,
main .text-base-content\/60,
.bg-base-100 .text-base-content\/60 {
  color: #4A6080 !important;
}

.bg-white .text-base-content\/50,
.card .text-base-content\/50,
main .text-base-content\/50,
.bg-base-100 .text-base-content\/50 {
  color: #64748B !important;
}

.bg-white .text-base-content\/40,
.card .text-base-content\/40,
main .text-base-content\/40,
.bg-base-100 .text-base-content\/40 {
  color: #8899B4 !important;
}

/* --- SCROLLBAR HEADER NAV --- */
.scrollbar-none::-webkit-scrollbar {
  display: none;
}

.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* --- DaisyUI drawer suppress --- */
.drawer-overlay {
  display: none !important;
}

/* --- TOPBAR LABEL BTN-GHOST (user chip) --- */
header label.btn-ghost[tabindex="0"] {
  background: #1E3A5F !important;
  border-radius: 20px !important;
  color: #E8EDF5 !important;
}

/* --- GRANDS TITRES DE PAGE en noir lisible --- */
main h1,
main h2,
.card h1,
.card h2,
.bg-white h1,
.bg-white h2,
h1.text-primary,
h2.text-primary {
  color: #0A1628 !important;
}

h1.text-primary svg,
h2.text-primary svg,
h1 svg.text-primary,
h2 svg.text-primary {
  color: #C9A84C !important;
}


/* ============================================
   SGH-MG — LAYER VISUEL PREMIUM v1
   Additionnel : ne touche pas aux couleurs ni aux textes
   ============================================ */

/* --- TYPOGRAPHIE SYSTÈME --- */
* {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

code,
.mono,
[class*="patient-id"],
[class*="tag-id"] {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace !important;
}

/* --- TRANSITIONS GLOBALES --- */
.btn,
button,
a,
input,
select,
textarea,
.card,
[class*="card"],
[class*="rdv-card"],
tr,
.badge,
[class*="badge"] {
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* --- CARDS : élévation au hover --- */
.card,
[class*="card"]:not([class*="nav"]):not(header *) {
  border-radius: 12px !important;
  box-shadow: 0 1px 3px rgba(10, 22, 40, 0.06), 0 0 0 0.5px rgba(209, 220, 232, 0.8) !important;
}

.card:hover,
[class*="card"]:not([class*="nav"]):not(header *):hover {
  box-shadow:
    0 4px 16px rgba(10, 22, 40, 0.10),
    0 0 0 1px rgba(201, 168, 76, 0.20) !important;
  transform: translateY(-1px) !important;
}

/* --- SOUS-CARDS sans élévation --- */
.card .card,
.sub-card,
[class*="inner-card"] {
  transform: none !important;
  box-shadow: 0 0 0 0.5px rgba(226, 232, 240, 0.9) !important;
}

/* --- LIGNE D'ACCENT OR sur stat-cards --- */
[class*="stat-card"],
[class*="kpi-card"],
[class*="metric-card"],
[class*="summary-card"] {
  position: relative !important;
  overflow: hidden !important;
}

[class*="stat-card"]::before,
[class*="kpi-card"]::before,
[class*="metric-card"]::before,
[class*="summary-card"]::before {
  content: '' !important;
  position: absolute !important;
  top: 0;
  left: 0;
  right: 0 !important;
  height: 2px !important;
  background: linear-gradient(90deg, #C9A84C, #E2BC6A, #C9A84C) !important;
}

/* --- HEADER : ombre subtile en bas --- */
header[class*="fixed"] {
  box-shadow: 0 1px 0 rgba(30, 58, 95, 0.6), 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* --- BOUTONS : profondeur et états complets --- */
.btn-primary,
button[type="submit"],
[class*="btn-primary"] {
  box-shadow: 0 1px 4px rgba(201, 168, 76, 0.30) !important;
  border-radius: 8px !important;
}

.btn-primary:hover,
[class*="btn-primary"]:hover {
  box-shadow: 0 4px 12px rgba(201, 168, 76, 0.35) !important;
  transform: translateY(-1px) !important;
}

.btn-primary:active,
[class*="btn-primary"]:active {
  transform: translateY(0) scale(0.98) !important;
  box-shadow: none !important;
}

.btn-secondary,
.btn-outline,
[class*="btn-secondary"] {
  border-radius: 8px !important;
}

.btn-secondary:hover,
[class*="btn-secondary"]:hover {
  transform: translateY(-1px) !important;
}

/* --- FOCUS RING sur tous les interactifs --- */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.25) !important;
}

/* --- INPUTS : radius cohérent --- */
input,
select,
textarea {
  border-radius: 8px !important;
}

/* --- BADGES : pill parfait --- */
[class*="badge"],
.badge {
  border-radius: 20px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  letter-spacing: 0.01em !important;
  padding: 3px 10px !important;
}

/* --- TABLES : lisibilité améliorée --- */
thead th {
  font-size: 10.5px !important;
  letter-spacing: 0.07em !important;
  font-weight: 600 !important;
}

td {
  font-size: 13px !important;
}

tr {
  transition: background 100ms ease !important;
}

/* --- AVATARS INITIAUX --- */
.avatar.placeholder div,
[class*="avatar-user"] {
  border-radius: 50% !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
}

/* --- MODALS : entrée fluide --- */
.modal-box,
dialog .modal-box,
[class*="modal-content"] {
  border-radius: 16px !important;
  box-shadow:
    0 20px 60px rgba(10, 22, 40, 0.25),
    0 0 0 0.5px rgba(209, 220, 232, 0.8) !important;
  animation: modal-in 180ms cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(4px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* --- DROPDOWNS : ombre et radius --- */
[class*="dropdown-content"],
[class*="user-menu"] {
  border-radius: 10px !important;
  box-shadow: 0 8px 24px rgba(10, 22, 40, 0.20), 0 0 0 0.5px rgba(30, 58, 95, 0.5) !important;
  animation: dropdown-in 120ms ease-out !important;
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- SCROLLBAR AFFINÉE --- */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-thumb {
  border-radius: 4px;
}

/* --- SECTION DIVIDERS avec accent or --- */
[class*="date-separator"],
[class*="date-group"],
[class*="date-header"] {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

[class*="date-separator"]::before,
[class*="date-separator"]::after {
  content: '' !important;
  flex: 1 !important;
  height: 0.5px !important;
  background: #E2E8F0 !important;
}

/* --- RDV CARDS : hover avec bordure or --- */
[class*="rdv-card"],
[class*="appointment"] {
  border-radius: 10px !important;
}

[class*="rdv-card"]:hover,
[class*="appointment"]:hover {
  transform: translateX(2px) !important;
  box-shadow: -3px 0 0 #C9A84C, 0 2px 8px rgba(10, 22, 40, 0.08) !important;
}

/* --- EMPTY STATES --- */
[class*="empty-state"],
[class*="no-data"],
[class*="no-results"] {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 48px 24px !important;
  gap: 8px !important;
}

[class*="empty-state"] svg,
[class*="empty-state"] i,
[class*="no-data"] svg,
[class*="no-data"] i {
  opacity: 0.25 !important;
  font-size: 36px !important;
}

/* --- SKELETON LOADER --- */
[class*="skeleton"],
[class*="loading-placeholder"] {
  background: linear-gradient(90deg,
      #E2E8F0 25%,
      #F1F5F9 50%,
      #E2E8F0 75%) !important;
  background-size: 200% 100% !important;
  animation: shimmer 1.4s infinite !important;
  border-radius: 6px !important;
  color: transparent !important;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* --- PAGE TRANSITIONS --- */
main,
.main,
[class*="main-content"] {
  animation: page-in 200ms ease-out !important;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- PAGINATION : radius cohérent --- */
.join .btn,
.pagination .btn {
  border-radius: 6px !important;
}

/* --- SCROLLABLE NAV (header navigation) --- */
.nav-scroll {
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch !important;
  overflow-clip-margin: 300px;
  -webkit-overflow-clip-margin: 300px;
  scroll-behavior: smooth;
  /* Fade edges to indicate scrollability */
  mask-image: linear-gradient(
    to right,
    transparent 4px,
    black 20px,
    black calc(100% - 20px),
    transparent 4px
  ) !important;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 4px,
    black 20px,
    black calc(100% - 20px),
    transparent 4px
  ) !important;
}
/* --- FALLBACK x-cloak (si Alpine ne charge pas) --- */
[x-cloak] { display: none !important; }
