/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ── Pagy bootstrap pagination ────────────────────────────────────────────── */
.pagy-bootstrap.series-nav {
	display: flex;
	justify-content: center;
}

.pagy-bootstrap.series-nav ul.pagination {
	margin-bottom: 0;
}

/* ── Lead temperature color overrides ─────────────────────────────────────── */
.badge.bg-azure {
	background-color: #206bc4;
	color: #fff;
}

/* ── Table polish ─────────────────────────────────────────────────────────── */
.table-vcenter td,
.table-vcenter th {
	vertical-align: middle;
}

.table th a {
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
}

.card-table thead th {
	color: var(--tblr-secondary);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.card-table tbody tr:nth-child(odd) td {
	background: rgba(15, 23, 42, 0.015);
}

.card-table tbody tr:hover td {
	background: rgba(32, 107, 196, 0.04);
}

/* ── Card compact header ──────────────────────────────────────────────────── */
.card-sm .card-body {
	padding: 0.75rem;
}

/* ── Typography overrides ─────────────────────────────────────────────────── */
.subheader {
	font-size: 0.875rem !important;
	font-weight: 600 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
}

/* ── Sidebar nav active state (Tabler overrides) ─────────────────────────── */
.navbar-vertical .nav-link.active {
	background-color: rgba(255, 255, 255, 0.07);
	border-radius: 4px;
}

.navbar-vertical .nav-link .nav-link-chevron {
	transition: transform 0.2s ease;
}

.navbar-vertical .nav-link[aria-expanded="true"] .nav-link-chevron {
	transform: rotate(180deg);
}

.navbar-subnav .nav-link {
	margin-left: 1.5rem;
	padding-left: 0.75rem;
	font-size: 0.95rem;
}

.navbar-vertical .navbar-nav .nav-link .badge {
	position: static !important;
	transform: none !important;
}

/* ── Empty-state icons ────────────────────────────────────────────────────── */
.ti.fs-1 {
	font-size: 2rem !important;
}

.ti.fs-2 {
	font-size: 1.5rem !important;
}

/* ── Performance Fixes for Firefox (Linux/macOS) ──────────────────────────── */
/* backdrop-filter was previously disabled during debugging, now restored
   for a premium glassmorphic feel where supported. */
.navbar,
.modal,
.offcanvas,
.dropdown-menu,
.glass {
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

/* Smooth transitions for progress bars */
.progress-bar {
	transition: width 0.6s ease;
}

/* ── Dossier tabs (prominence) ────────────────────────────────────────────── */
#dossierTabs {
	background: #eef2f7;
	border-radius: 6px 6px 0 0;
	padding: 0.25rem 0.5rem 0;
	border-bottom: 2px solid var(--tblr-primary);
}

#dossierTabs .nav-link {
	font-weight: 500;
	color: #475569;
	border-color: transparent;
}

#dossierTabs .nav-link:hover {
	color: var(--tblr-primary);
	background: rgba(32, 107, 196, 0.06);
}

#dossierTabs .nav-link.active {
	background: #fff;
	color: var(--tblr-primary);
	font-weight: 600;
	border-color: #dee2e6 #dee2e6 #fff;
	border-bottom-width: 3px;
}

/* ── Consultation stepper ─────────────────────────────────────────────────── */
.stepper-circle {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.75rem;
	font-weight: 600;
	border: 2px solid var(--tblr-border-color);
	color: var(--tblr-secondary);
	background: #fff;
	transition: all 0.2s ease;
}

.stepper-label {
	font-size: 0.65rem;
	color: var(--tblr-secondary);
	max-width: 72px;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.stepper-connector {
	height: 2px;
	background: var(--tblr-border-color);
	min-width: 12px;
	transition: background 0.2s ease;
}

.stepper-connector--completed {
	background: var(--tblr-success);
}

.stepper-step--completed .stepper-circle {
	background: var(--tblr-success);
	border-color: var(--tblr-success);
	color: #fff;
}

.stepper-step--completed .stepper-label {
	color: var(--tblr-success);
}

.stepper-step--current .stepper-circle {
	background: var(--tblr-primary);
	border-color: var(--tblr-primary);
	color: #fff;
	box-shadow: 0 0 0 3px rgba(32, 107, 196, 0.2);
}

.stepper-step--current .stepper-label {
	color: var(--tblr-primary);
	font-weight: 600;
}

.stepper-step--upcoming .stepper-circle {
	opacity: 0.5;
}

.stepper-step--upcoming .stepper-label {
	opacity: 0.5;
}

/* ── Patient portal ──────────────────────────────────────────────────────────── */
/* The portal's theme lives in portal.css (loaded only by layouts/portal.html.erb).
   Only rules shared with the admin layout stay here: the chat bubbles below are
   reused by the admin dossier messages tab, and .messagerie-thread--unread by
   the admin messagerie. */

/* ── Chat bubbles ─────────────────────────────────────────────────────────────── */

.portal-chat {
	display: flex;
	flex-direction: column;
	gap: .75rem;
}

.portal-chat__bubble-row {
	display: flex;
}

.portal-chat__bubble-row--patient {
	justify-content: flex-end;
}

.portal-chat__bubble-row--team {
	justify-content: flex-start;
}

.portal-chat__bubble {
	max-width: 78%;
	padding: .625rem .875rem;
	border-radius: 1rem;
	font-size: .9rem;
}

.portal-chat__bubble-row--patient .portal-chat__bubble {
	background-color: #1a2942;
	color: #fff;
	border-bottom-right-radius: .25rem;
}

.portal-chat__bubble-row--team .portal-chat__bubble {
	background-color: #fff;
	border: 1px solid #e0e5ef;
	border-bottom-left-radius: .25rem;
}

.portal-chat__meta {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: .5rem;
	margin-bottom: .2rem;
	font-size: .75rem;
}

/* Admin dossier messages tab: adds an avatar chip to the meta row, which
   doesn't suit the portal's baseline text alignment. */
.portal-chat__meta--with-avatar {
	align-items: center;
}

.portal-chat__bubble-row--patient .portal-chat__meta {
	color: rgba(255, 255, 255, .65);
}

.portal-chat__bubble-row--team .portal-chat__meta {
	color: #6c757d;
}

.portal-chat__sender {
	font-weight: 600;
}

.portal-chat__role {
	font-weight: 400;
}

.portal-chat__time {
	white-space: nowrap;
}

.portal-chat__body p {
	margin-bottom: 0;
}

.portal-chat__attachment {
	display: inline-flex;
	align-items: center;
	font-size: .8rem;
	text-decoration: none;
}

.portal-chat__bubble-row--patient .portal-chat__attachment {
	color: rgba(255, 255, 255, .8);
}

.portal-chat__bubble-row--team .portal-chat__attachment {
	color: #1a2942;
}

/* ── Global search dialog ────────────────────────────────────────────────── */

dialog.global-search {
	width: 100%;
	max-width: 600px;
	border: none;
	border-radius: .75rem;
	padding: 0;
	background: #fff;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .18), 0 4px 16px rgba(0, 0, 0, .1);
	position: fixed;
	top: 15vh;
	margin: 0 auto;
	left: 0;
	right: 0;
}

dialog.global-search::backdrop {
	background: rgba(0, 0, 0, .45);
	backdrop-filter: blur(2px);
}

.global-search__inner {
	display: flex;
	flex-direction: column;
	max-height: 70vh;
}

.global-search__input-row {
	display: flex;
	align-items: center;
	padding: .75rem 1rem;
	border-bottom: 1px solid #e8ecf0;
	gap: .5rem;
}

.global-search__input-icon {
	font-size: 1.1rem;
	color: #6c7a94;
	flex-shrink: 0;
}

.global-search__input {
	flex: 1;
	border: none;
	outline: none;
	font-size: 1rem;
	background: transparent;
	color: #1a2942;
}

.global-search__input::placeholder {
	color: #adb5bd;
}

.global-search__esc-hint {
	font-size: .7rem;
	color: #adb5bd;
	border: 1px solid #dee2e6;
	border-radius: .25rem;
	padding: .1rem .35rem;
	flex-shrink: 0;
}

.global-search__results {
	overflow-y: auto;
	flex: 1;
}

.global-search__empty {
	text-align: center;
	color: #6c7a94;
	padding: 1.5rem 1rem;
	margin: 0;
}

.global-search__group-label {
	font-size: .7rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: #6c7a94;
	padding: .6rem 1rem .3rem;
}

.global-search__item {
	display: flex;
	align-items: center;
	gap: .75rem;
	padding: .55rem 1rem;
	text-decoration: none;
	color: inherit;
	transition: background .1s;
}

.global-search__item:hover,
.global-search__item--active {
	background: #f1f5fb;
	color: inherit;
	text-decoration: none;
}

.global-search__item-icon {
	width: 1.75rem;
	height: 1.75rem;
	border-radius: .375rem;
	background: #e8ecf0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: .9rem;
	color: #6c7a94;
	flex-shrink: 0;
}

.global-search__item-body {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
}

.global-search__item-title {
	font-weight: 600;
	font-size: .9rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.global-search__item-sub {
	font-size: .78rem;
	color: #6c7a94;
	display: flex;
	align-items: center;
	gap: .25rem;
	margin-top: .1rem;
}

.global-search__item-aside {
	font-size: .78rem;
	color: #adb5bd;
	white-space: nowrap;
	flex-shrink: 0;
}

.global-search__footer {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: .5rem 1rem;
	border-top: 1px solid #e8ecf0;
	font-size: .75rem;
	color: #adb5bd;
}

.global-search__footer kbd {
	font-size: .7rem;
	border: 1px solid #dee2e6;
	border-radius: .2rem;
	padding: .1rem .3rem;
	color: #6c7a94;
	background: #f8f9fa;
}
/* ── UX pass 2026-07-06 (walkthrough batch 1) ────────────────────────────────── */

/* Solid-background badges: Tabler keeps dark text unless told otherwise —
   the count inside "badge bg-primary" was unreadable. */
.badge.bg-primary, .badge.bg-secondary, .badge.bg-success, .badge.bg-danger,
.badge.bg-info, .badge.bg-dark, .badge.bg-azure, .badge.bg-indigo,
.badge.bg-purple, .badge.bg-teal, .badge.bg-orange, .badge.bg-red,
.badge.bg-green, .badge.bg-blue, .badge.bg-cyan {
	color: #fff;
}
.badge.bg-warning, .badge.bg-yellow {
	color: #24292f;
}

/* Users are on laptops/phones and mostly 50+: slightly larger base text, and
   btn-sm was too thin to hit comfortably. */
body {
	font-size: .9375rem;
}
.btn-sm {
	padding: .375rem .75rem;
	font-size: .875rem;
}

/* Rails' button_to renders a <form>, which defaults to display:block and
   breaks inline alignment with adjacent <a class="btn"> actions in table
   cells (edit link + archive/reactivate button wrap to their own line). */
.button_to {
	display: inline-block;
	vertical-align: middle;
}

/* Notification bell count: pinned inside the link's own top-right corner
   (never into the neighboring element — wide counts grow leftward). */
.notification-count-badge {
	position: absolute;
	top: 0;
	right: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.25rem;
	height: 1.25rem;
	padding: 0 .3rem;
	border-radius: 10rem;
	font-size: .7rem;
	font-weight: 600;
	line-height: 1;
	z-index: 1;
}

/* Tabler's `.navbar-nav .nav-link .badge` rule outranks the base rule above
   for the admin topbar bell (higher specificity), so its top/right/transform
   still hang the badge over the icon's corner into the username next to it.
   Force our flush corner position back for that specific context. */
.navbar-nav .nav-link .badge.notification-count-badge {
	top: 0;
	right: 0;
	transform: none;
}

/* Message threads (dossier, WhatsApp, e-mails, portail patient): bounded and
   parked on the newest message by messages_scroll_controller.js, instead of
   growing the whole page and burying whatever follows under a long thread. */
.chat-scrollbox {
	max-height: min(480px, 60vh);
	overflow-y: auto;
}

/* Messagerie inbox: unread threads stand out instead of a flat white list. */
.messagerie-thread--unread {
	background-color: #eef5ff;
	box-shadow: inset 3px 0 0 #206bc4;
}
.messagerie-thread--unread:hover {
	background-color: #e3eefc;
}

/* ── Impression (feuille de route chauffeur) ─────────────────────────────────
   Une page A4 propre : navigation masquée, contenu pleine largeur, un jour ne
   se coupe jamais entre deux pages. */
@media print {
  .navbar-vertical,
  .navbar,
  .d-print-none { display: none !important; }
  .page-wrapper { margin-left: 0 !important; }
  .page-body { padding: 0 !important; }
  body { background: #fff !important; }
  .transfer-day { break-inside: avoid; }
  .transfer-day .card-header { background: #f5f5f5 !important; -webkit-print-color-adjust: exact; }
}

/* ── Carte d'affluence portail (D-61) ───────────────────────────────────────
   Barres en paliers discrets : l'intensité se lit, elle ne se mesure pas.
   Aucune largeur proportionnelle ici — une largeur en % permettrait de
   retrouver les effectifs absolus (docs/17 §1.2). Le nombre de segments
   allumés vient d'un niveau 0..3 calculé côté serveur. */
.affluence-row {
  display: grid;
  grid-template-columns: 6.5rem 1fr 8rem;
  align-items: center;
  gap: .75rem;
  padding: .35rem 0;
}
.affluence-label { font-weight: 500; }
.affluence-track { display: flex; gap: .25rem; }
.affluence-step {
  flex: 1;
  height: .75rem;
  border-radius: 2px;
  background-color: #e6e7e9;
}
.affluence-step.is-filled { background-color: #206bc4; }
.affluence-legend { font-size: .8125rem; }

@media (max-width: 575.98px) {
  .affluence-row { grid-template-columns: 5rem 1fr; }
  .affluence-legend { grid-column: 2; font-size: .75rem; }
}
