/* =========================================================
   Post Op — Dashboard clone
   Custom design tokens & components (exact values pulled from
   the live application stylesheet). Bootstrap 5.3 supplies the
   grid / flex / spacing / dropdown / accordion utilities.
   ========================================================= */

:root {
  /* Brand palette */
  --bs-primary: #5E37EF;
  --bs-primary-rgb: 94, 55, 239;
  --bs-orange: #FE5935;
  --bs-orange-rgb: 254, 89, 53;
  --bs-orange-light: #FE7235;
  --bs-orange-light-rgb: 254, 114, 53;
  --bs-link-color: #5E37EF;
  --bs-link-color-rgb: 94, 55, 239;
  --bs-link-hover-color: #4a2cbf;
  --bs-body-font-family: "Lato", sans-serif;
  --bs-body-color: #212529;

  --po-dark-blue: #1f2e99;
  --po-bg: #e9f0fe;
}

* { -webkit-font-smoothing: antialiased; }

body {
  font-family: "Lato", sans-serif;
  color: #212529;
  background: #fff;
}

/* ---------- Base helpers ---------- */
.blue-background { background: #e9f0fe; }
.card-border-radius { border-radius: 24px; }
.border-radius-25px { border-radius: 25px; }
.input-border-radius { border-radius: 24px !important; }
.border-unset { border: unset !important; }
.bg-unset { background: unset !important; }
.thin-border { border: .42px solid #DFE1E6; }
.z-index-2 { z-index: 2; }
.w-fit-content { width: fit-content; }
.mh-100 { max-height: 100% !important; }
.lh-30 { line-height: 30px; }
.lh-14px { line-height: 14px; }
.cursor-pointer { cursor: pointer; }
.light2-bg { background: #eeecec !important; }
.light-bg { background-color: #fafbfc !important; }

/* ---------- Brand colours ---------- */
.bg-primary { background-color: #5E37EF !important; }
.text-primary { color: #5E37EF !important; }
.text-dark-blue { color: #1f2e99 !important; }
.text-light-blue2 { color: #07f !important; }
.text-orange { color: #FE5935 !important; }
.text-white { color: #fff !important; }
.text-gray5 { color: #acb4bc !important; }
.text-gray6 { color: #81868b !important; }
.text-gray7 { color: gray !important; }
.text-gray11 { color: #798599 !important; }

/* ---------- Font-size utilities ---------- */
.fs-11px { font-size: 11px; }
.fs-12px { font-size: 12px; }
.fs-13px { font-size: 13px; }
.fs-14px { font-size: 14px; }
.fs-15px { font-size: 15px; }
.fs-16px { font-size: 16px; }
.fs-18px { font-size: 18px; }
.fs-20px { font-size: 20px; }
.fs-22px { font-size: 22px; }
.fs-32px { font-size: 32px; }
.fs-35px { font-size: 35px; }
.fs-40px { font-size: 40px; }
@media (min-width: 992px) {
  .fs-lg-15px { font-size: 15px; }
  .fs-lg-16px { font-size: 16px; }
  .fs-lg-22px { font-size: 22px; }
  .fs-lg-40px { font-size: 40px; }
}

/* =========================================================
   NAVBAR
   ========================================================= */
#app-navbar {
  height: 72px;
  padding-top: .7px !important;
  z-index: 1000;
}
.navbar-brand { margin-right: 0; }

/* GLOBAL: app uses a 2.5rem container gutter → 20px side padding at every breakpoint */
.container, .container-fluid, .container-sm, .container-md, .container-lg, .container-xl, .container-xxl { --bs-gutter-x: 2.5rem; }
#app-navbar .container-fluid { padding-left: 20px; padding-right: 20px; }

/* mobile/tablet menu toggler (shown below xl, like the original) */
.menu-toggler {
  width: 24px; height: 18px; display: block;
  background-size: cover; background-position: center center;
  background-image: url("data:image/svg+xml,%3csvg%20width='26'%20height='18'%20viewBox='0%200%2026%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M1%201H25'%20stroke='%23D3DAE1'%20stroke-width='2'%20stroke-linecap='round'/%3e%3cpath%20d='M1%209H25'%20stroke='%23D3DAE1'%20stroke-width='2'%20stroke-linecap='round'/%3e%3cpath%20d='M1%2017H25'%20stroke='%23D3DAE1'%20stroke-width='2'%20stroke-linecap='round'/%3e%3c/svg%3e");
}

/* hospital selector — normal weight, fills navbar height */
#app-navbar .dropdown-toggle.nav-link { font-weight: 400; font-size: 16px; padding-top: 23.2px; padding-bottom: 19.2px; }
#app-navbar .dropdown-toggle::after {
  margin-left: .5em; vertical-align: middle;
  border-top-color: #5E37EF;
}

/* role tabs ("Clinician" / "Hospital admin") */
.nav-link.bordered {
  border-bottom: 4px solid transparent;
  color: #999fa4;
  font-weight: 400;
  padding-left: 0; padding-right: 0;
}
.nav-link.bordered.active { border-color: #5e37ef; color: #5E37EF; }

/* center icon nav — inactive label text is #999fa4 (icons stay #D3DAE1);
   full-height padding so labels/underline align with the original navbar */
#app-navbar .navbar-nav .nav-link { color: #999fa4; padding: 23.2px 0 19.2px; }
/* .nav-ico inherits the link color so currentColor icons (Procedure board) match
   the original (#999fa4 inactive); the other icons use hard-coded #D3DAE1 fills. */
#app-navbar .navbar-nav .nav-link .nav-ico { display: inline-block; line-height: 0; }
#app-navbar .navbar-nav .nav-link.active { color: #5E37EF; }
#app-navbar .navbar-nav .nav-link.active .nav-ico,
#app-navbar .navbar-nav .nav-link.active .nav-ico svg [fill="#D3DAE1"] { color: #5E37EF; }
#app-navbar .navbar-nav .nav-link.active .nav-ico svg path[fill="#D3DAE1"] { fill: #5E37EF; }
#app-navbar .navbar-nav .nav-link.active .nav-ico svg path[stroke="#D3DAE1"] { stroke: #5E37EF; }
#app-navbar .nav-link .fs-12px { color: inherit; }

/* navbar hover states (verbatim from the app) */
.nav-link:hover, .nav-link:focus,
.navbar-nav .nav-link.active, .navbar-nav .nav-link.show { color: #5e37ef; }
.nav-link.bordered:hover, .nav-link.bordered:focus,
.navbar-nav .nav-link.bordered.active, .navbar-nav .nav-link.bordered.show { border-color: #5e37ef; }
.navbar-nav .nav-link.active path, .nav-link:hover path { fill: #5e37ef; }
.dropdown-item:hover, .dropdown-item:focus,
.dropdown-menu .dropdown-item.active { background: #ececff; color: #5e37ef !important; }

/* notification bell */
#notification-dropdown > a { display: inline-block; cursor: pointer; }
.notification-number {
  width: 14px; height: 14px; border-radius: 50%;
  background: #ef3737; flex-shrink: 0; color: #fff;
  position: absolute; top: -5px; right: -5px;
  font-size: 10px; text-align: center; line-height: 14px;
}
.no-rotate { transform: none; }
.notifications-dropdown { width: 400px; max-height: 500px; overflow-y: auto; box-shadow: 0 0 20px #0000000d; }

/* user menu */
.initials-circle {
  width: 46px; height: 46px; border-radius: 50%;
  line-height: 46px; text-align: center;
  background: #36c2d5; color: #fff; text-transform: uppercase;
  flex-shrink: 0 !important; overflow: hidden;
}
.profile-photo {
  width: 36px !important; height: 36px !important;
  line-height: 32px !important; border-radius: 50%;
  border: 2px solid #5E37EF; overflow: hidden;
  font-size: 16px;
}
.user-menu-dropdown { width: 200px; border: 1px solid #F2F2F2; }
.profile-btn { color: #1f2e99; text-decoration: none; font-weight: 700; }

/* =========================================================
   DASHBOARD GRID
   ========================================================= */
.dashboard-wrapper { display: block; }
@media (min-width: 768px) {
  .dashboard-wrapper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(100px, auto);
    gap: 1.5rem;
  }
  .dashboard-wrapper .one   { grid-column: 1 / 5; grid-row: 1; }
  .dashboard-wrapper .two   { grid-column: 1 / 3; grid-row: 2; }
  .dashboard-wrapper .three { grid-column: 3 / 5; grid-row: 2; }
}
@media (min-width: 1200px) {
  .dashboard-wrapper { grid-template-columns: repeat(5, 1fr); }
  .dashboard-wrapper .one,
  .dashboard-wrapper .two   { grid-column: 1 / 4; }
  .dashboard-wrapper .one   { grid-row: 1; }
  .dashboard-wrapper .two   { grid-row: 2; }
  .dashboard-wrapper .three { grid-column: 4 / 6; grid-row: 1 / 3; }
}

/* =========================================================
   ATTENTION CARDS
   ========================================================= */
.proms-score {
  border-radius: 2px; padding: 0 10px;
  height: min-content; font-weight: 700;
}
.proms-score.positive { background: #6dd80333; color: #6dd803; }
.proms-score.negative { background: #ff6d6d33; color: #ff6d6d; }
.proms-score.positive::before {
  width: 12px; height: 14px; display: inline-block; content: "";
  background-image: url("data:image/svg+xml,%3csvg%20width='12'%20height='14'%20viewBox='0%200%2012%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.0762%206.42527C10.1888%206.53786%2010.3415%206.6011%2010.5007%206.6011C10.6599%206.6011%2010.8126%206.53786%2010.9252%206.42528C11.0377%206.3127%2011.101%206.16002%2011.101%206.00081C11.101%205.8416%2011.0377%205.68892%2010.9252%205.57634L6.42509%201.07627C6.36933%201.02047%206.30317%200.976224%206.23035%200.946034C6.15751%200.915839%206.07943%200.900298%206.00058%200.900298C5.92173%200.900298%205.84365%200.915839%205.77081%200.946034C5.69799%200.976223%205.63183%201.02047%205.57611%201.07623L1.076%205.57634C0.963428%205.68892%200.900182%205.8416%200.900182%206.00081C0.900182%206.16002%200.963428%206.3127%201.076%206.42528C1.18858%206.53786%201.34127%206.6011%201.50047%206.6011C1.65968%206.6011%201.81237%206.53786%201.92494%206.42528L5.40057%202.94906L5.40057%2012.501C5.40057%2012.6601%205.46378%2012.8127%205.57631%2012.9252C5.68883%2013.0378%205.84145%2013.101%206.00058%2013.101C6.15971%2013.101%206.31233%2013.0378%206.42485%2012.9252C6.53738%2012.8127%206.60059%2012.6601%206.60059%2012.501L6.60059%202.94906L10.0762%206.42527Z'%20fill='%236DD803'%20stroke='%236DD803'%20stroke-width='0.2'/%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: center;
  margin-right: 4px;
}

/* stacked patient avatars */
.dashboard-user-photo {
  width: 32px; height: 32px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0;
  background: #07f; color: #fff; text-align: center;
  font-size: 16px; line-height: 28px; border: 2px solid #fff;
}
.dashboard-user-photo:not(:first-of-type) { margin-left: -5px; }

/* =========================================================
   CHART CARDS
   ========================================================= */
.dashboard-period-picker {
  color: #acb4bc; text-decoration: none; border-radius: 15px;
}
.dashboard-period-picker:hover { background: #f2f2f2; color: #1f2e99; }
.dashboard-period-picker.active { background: #f2f2f2; }

.dropdown-light-bg { background: #f2f2f2; border-color: #e8e9ed; }
.dropdown-light-bg a { color: #81868b; }

.legend-square { width: 15px; height: 15px; border-radius: 4px; flex-shrink: 0; }
.legend-square.blue        { background: #81bcff; }
.legend-square.purple      { background: #9e84ff; }
.legend-square.green       { background: #a7e36c; }
.legend-square.light-green { background: #ceff67; }
.legend-square.yellow      { background: #f3d953; }
.legend-square.orange      { background: #f3b352; }
.legend-square.peach       { background: #ffa984; }
.legend-square.red         { background: #ff7a72; }

/* line chart (amCharts 5 container) */
.po-chart-box { width: 100%; aspect-ratio: 1 / 0.5; min-height: 155px; }
/* donut */
.po-donut { width: 100%; max-width: 204px; margin: 0 auto; display: block; aspect-ratio: 1/1; }

/* =========================================================
   MESSAGES PANEL
   ========================================================= */
#messages { height: 100%; overflow: hidden; }

.dashboard-messages-tab-container {
  background: #fff; border-radius: 9px;
  border: 1px solid #F6F6F6; padding: 5px;
}
.dashboard-messages-tab-container .tab {
  text-decoration: none; padding: 5px; width: 50%;
  border-radius: 9px; font-size: 12px; color: #5e37ef;
  display: flex; align-items: center; justify-content: center;
}
.dashboard-messages-tab-container .tab.active,
.dashboard-messages-tab-container .tab:hover { background: #5e37ef; color: #fff; }
.w-70 { width: 70%; }

.dashboard-unread-count {
  display: inline-block;
  width: 18px; height: 18px; border-radius: 6px;
  background: #ef3737; font-size: 11px; line-height: 18px;
  color: #fff; font-weight: 700; text-align: center;
}

.dashboard-search-messages { border-color: #e8e9ed !important; }
.dashboard-search-messages .form-control:focus { box-shadow: none; }
.dashboard-search-messages .form-control::placeholder { color: #81868b; }

.dashboard-chat-window { overflow-y: auto; min-height: 0; }
@media (max-width: 991.98px) { .mh-up-to-lg-700px { max-height: 700px; } }

/* The message list is taken out of flow at lg+ so the (tall) list never
   stretches the dashboard grid rows. The chat window is the scroll container;
   the grid height is driven by the cards + charts column — matches the live app. */
.left-10px  { left: 10px; }
.right-10px { right: 10px; }
@media (min-width: 992px) {
  .position-lg-absolute { position: absolute !important; top: 0; }
}
/* let the flex chain shrink so flex-fill heights resolve and the chat scrolls */
#messages,
#messages > .bg-white,
#messages > .bg-white > .d-flex.flex-column.h-100 { min-height: 0; }

.dashboard-messages-separator {
  width: 100%; position: relative; height: 1px; background: #e2daff;
}
.dashboard-messages-separator > div {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: #fff; padding: 0 12px;
  color: #b3a9e0; font-size: 12px; white-space: nowrap;
}

.dashboard-message-item { border-radius: 16px; transition: background .15s; }
.dashboard-message-item:hover { background: #f6f4ff; }

.dashboard-message-recovery-status { width: 14px; height: 14px; border-radius: 5px; }
.dashboard-message-recovery-status.good { background: #6dd803; }
.dashboard-message-recovery-status.status { background: #d3dae1; }

/* =========================================================
   BUTTONS
   ========================================================= */
.btn-orange {
  --bs-btn-color: #fff; --bs-btn-bg: #FE5935; --bs-btn-border-color: #FE5935;
  --bs-btn-hover-color: #FE5935; --bs-btn-hover-bg: #fff; --bs-btn-hover-border-color: #FE5935;
  --bs-btn-active-color: #FE5935; --bs-btn-active-bg: #fff; --bs-btn-active-border-color: #FE5935;
  --bs-border-width: 2px; font-weight: 400;
}
/* On hover/active the button flips to white bg + orange content, but the inline
   SVG icon is hard-coded stroke="#FFFFFF" and disappears — recolor it to match. */
.btn-orange:hover svg [stroke],
.btn-orange:focus-visible svg [stroke],
.btn-orange:active svg [stroke] { stroke: #FE5935; }
/* app uses 13px for small buttons (Bootstrap default is 14px) */
.btn-sm { --bs-btn-font-size: 13px; }
.btn-primary {
  --bs-btn-color: #fff; --bs-btn-bg: #5E37EF; --bs-btn-border-color: #5E37EF;
  --bs-btn-hover-color: #5E37EF; --bs-btn-hover-bg: #fff; --bs-btn-hover-border-color: #5E37EF;
  --bs-btn-active-color: #fff; --bs-btn-active-bg: #4a2cbf; --bs-btn-active-border-color: #4a2cbf;
  --bs-border-width: 2px;
}
.btn-danger {
  --bs-btn-bg: #ef3737; --bs-btn-border-color: #ef3737;
  --bs-btn-hover-bg: #d52f2f; --bs-btn-hover-border-color: #d52f2f;
  font-weight: 700;
}

/* =========================================================
   ATTENTION ACCORDION (UKHSA / NHFD / FLS)
   ========================================================= */
#accordionExample .accordion-item { background: #fff0f0; border: none; border-radius: 12px; overflow: hidden; }
.accordion-button.ukhsa-past-due {
  background: #fff0f0; box-shadow: none; font-weight: 700; color: #ff2525;
  border-radius: 12px !important; padding: 1rem 1.5rem;
}
.accordion-button.ukhsa-past-due:not(.collapsed) { background: #fff0f0; color: #ff2525; }
.accordion-button.focus-unset:focus { box-shadow: none; border-color: transparent; }
.accordion-button.ukhsa-past-due::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23ff2525' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3e%3cpath d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
.ukhsa-past-due .light-danger-border,
.border-top.light-danger-border { border-top: 1px solid #ffd9d9 !important; }
.ps-md-45px { }
@media (min-width: 768px) { .ps-md-45px { padding-left: 45px; } }
.btm-sm { font-size: 15px; padding: .35rem 1.1rem; }

/* =========================================================
   FLOATING TUTORIALS BUTTON
   ========================================================= */
.tutorials-button-container { position: fixed; left: 30px; bottom: 30px; z-index: 1030; }
.tutorials-button {
  width: 40px; height: 40px; border-radius: 50%;
  background: #5E37EF; display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 12px rgba(94,55,239,.35);
}
.tutorials-button img { width: 20px; height: 20px; filter: brightness(0) invert(1); }

/* =========================================================
   SCROLLBAR (chat window) — subtle like the original
   ========================================================= */
.dashboard-chat-window::-webkit-scrollbar { width: 6px; }
.dashboard-chat-window::-webkit-scrollbar-thumb { background: #d9d9e3; border-radius: 3px; }
.dashboard-chat-window::-webkit-scrollbar-track { background: transparent; }

/* =========================================================
   SECTION TABS — global underline tab pattern.
   Mirrors the live app's in-page tab bar (`.pre-op-tab` on
   app.postop.ai patient pages): text labels, 2px grey baseline,
   inactive grey #798599, active primary #5E37EF with a 4px
   purple underline. Reusable app-wide: put `.po-tabs` on the
   container and `.po-tab` on each tab; add `.active` (or `.on`)
   for the selected tab, and an optional `.tab-count` badge.
   ========================================================= */
.po-tabs {
  display: flex;
  align-items: flex-end;
  border-bottom: 2px solid #dee2e6;
}
.po-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 28px -2px 0;            /* -2px overlaps the 2px baseline */
  padding: 0 0 7px;
  border: 0;
  border-bottom: 4px solid transparent;
  background: none;
  font-family: "Lato", sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  color: #798599;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.po-tab:last-child { margin-right: 0; }
.po-tab:hover { color: #5e37ef; }
.po-tab.active,
.po-tab.on { color: #5e37ef; border-bottom-color: #5e37ef; }
.po-tab .tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #fe5935;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
@media (max-width: 767.98px) {
  .po-tab { font-size: 14px; margin-right: 20px; }
}
