/* =====================================================================
   PROF component layer — canonical styling for shared UI primitives.

   Single source of truth for cross-app consistency of BUTTONS, INPUTS,
   CARDS and PAGINATION. Loaded LAST in every base template so it wins
   the cascade over:
     - paper-dashboard.css   (.btn 20px, .btn-lg 50px, .btn-sm 26px)
     - incodeks style.css    (.btn / .btn-sutro / .btn-primary 8px !important)
     - legacy sutro.css / stores.css button + card rules

   HOW TO RETUNE THE WHOLE APP: change the tokens in :root below. Every
   button radius, input radius, card radius, etc. keys off these — a
   one-line edit here restyles every page. Per-role exceptions (e.g. the
   search pill) are defined once, further down, and also token-driven.

   Scope: main portals + incodeks_inrec internal pages.
   NOT applied to WAR/print documents or email templates (those use inline
   hex for PDF / email-client compatibility and are intentionally excluded).
   ===================================================================== */

:root {
  /* ---- Shape tokens (radius) ---- */
  --prof-btn-radius: 4px;         /* standard actions: Add / Edit / View / Submit / Save / Delete / Cancel */
  --prof-btn-radius-pill: 20px;   /* search + other explicit pill actions */
  --prof-input-radius: 4px;       /* text inputs, selects, textareas */
  --prof-card-radius: 6px;        /* cards / panels */

  /* ---- Surface tokens ---- */
  --prof-card-border: #e6e9f0;
  --prof-card-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
  --prof-modal-radius: 14px;       /* modal dialog corners (from PRF-1145 design) */
  --prof-modal-inner-radius: 8px;  /* inputs/buttons inside modals */

  /* ---- Pagination tokens — mirror the dashboard .ptd-page-btn exactly ---- */
  --prof-page-radius: 8px;
  --prof-page-size: 32px;          /* min box width & height (dashboard = 32px) */
  --prof-page-pad: 0 9px;
  --prof-page-gap: 3px;            /* 3px each side = 6px between boxes (dashboard gap) */
  --prof-page-font: 12.5px;
  --prof-page-color: #46536b;      /* --ink-2: page-number text */
  --prof-page-border: #e4ebf4;     /* --line */
  --prof-page-hover-bg: #eef2f8;   /* --line-soft */
  --prof-page-hover-border: #cfdcef;
  --prof-page-disabled: #8493a8;   /* --ink-3 */
}

/* =====================================================================
   BUTTONS
   ---------------------------------------------------------------------
   One canonical radius for every standard action button, regardless of
   which theme/class it happens to use. !important + high specificity are
   required here purely to defeat the pre-existing !important radius rules
   in incodeks style.css and the hard-coded pill radii in paper-dashboard.

   Circular icon buttons (.btn-round / .rounded-circle) and intentional
   pills (.rounded-pill / .btn-search / .btn-pill) are excluded so we
   don't square off things that are meant to be round.
   ===================================================================== */
.btn:not(.btn-round):not(.rounded-circle):not(.rounded-pill):not(.btn-search):not(.btn-pill),
.btn-sutro,
.btn-sutro-seconday,
.btn-teal,
.btn-white,
.btn-red {
  border-radius: var(--prof-btn-radius) !important;
}

/* Search + explicit pill actions keep the rounded look (per design:
   the search control is a pill, standard actions are not). */
.btn-search,
.btn.btn-search,
.btn-pill {
  border-radius: var(--prof-btn-radius-pill) !important;
}

/* Filled brand buttons must carry their own border colour — otherwise they
   inherit paper-dashboard's cream .btn border (#F1EAE0) as a stray outline. */
.btn-teal {
  border-color: var(--prof-primary, #003DA5) !important;
}
.btn-white {
  border-color: var(--prof-primary, #003DA5) !important;
}

/* =====================================================================
   INPUTS
   ---------------------------------------------------------------------
   Consistent corner radius on form controls everywhere. Deliberately no
   !important so third-party widgets (select2, flatpickr, intlTelInput)
   keep their own control styling. The PROF blue border on body.store /
   Sutro Central surfaces still comes from prof-theme.css; this only
   normalises the radius to match buttons.
   ===================================================================== */
.form-control,
select.form-control,
textarea.form-control {
  border-radius: var(--prof-input-radius);
}

/* =====================================================================
   CARDS
   ---------------------------------------------------------------------
   One canonical card shell (Bootstrap .card). Specialised card systems
   (.ptd-card dashboard tiles, .chemical-form-card, .treatment-form-card)
   are separate classes and are NOT touched here — they'll be folded into
   this system in the per-portal rollout.
   ===================================================================== */
.card {
  border-radius: var(--prof-card-radius);
  border: 1px solid var(--prof-card-border);
  box-shadow: var(--prof-card-shadow);
}

/* =====================================================================
   PAGINATION — one canonical "boxed / separated" design everywhere.
   ---------------------------------------------------------------------
   Two markup styles exist in the app and BOTH are covered here so every
   list page looks identical to the reference design (rounded boxes with a
   light border + gap, solid PROF-blue active page):
     A) Bootstrap:   <ul class="pagination"><li class="page-item">
                        <a class="page-link">…</a></li>
     B) Legacy store: <ul class="pagination"><li class="px-2">
                        <a>…</a> / <span>…</span></li>   (no .page-link)
   ===================================================================== */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}

/* Neutralise the legacy per-<li> spacing so gaps are uniform in both markups
   (.px-2 sets padding with !important, hence the !important override here). */
.pagination > li {
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin: 0;
}

/* The page box — applies to <a>/<span> (legacy) and .page-link (Bootstrap).
   !important on the appearance props defeats incodeks style.css, which sets
   .pagination .page-link colour/border/radius with !important. */
.pagination > li > a,
.pagination > li > span,
.pagination .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--prof-page-size);
  height: var(--prof-page-size);
  padding: var(--prof-page-pad);
  margin: 0 var(--prof-page-gap) !important;
  border: 1px solid var(--prof-page-border) !important;
  border-radius: var(--prof-page-radius) !important;
  background: #fff;
  color: var(--prof-page-color) !important;
  font-size: var(--prof-page-font);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: all .15s ease;
}

/* Hover (clickable boxes only). */
.pagination > li > a:hover,
.pagination .page-link:hover {
  background: var(--prof-page-hover-bg);
  color: var(--prof-primary, #003DA5) !important;
  border-color: var(--prof-page-hover-border) !important;
}

/* Active page — solid PROF blue. */
.pagination > li.active > a,
.pagination > li.active > span,
.pagination .page-item.active .page-link {
  background: var(--prof-primary, #003DA5) !important;
  border-color: var(--prof-primary, #003DA5) !important;
  color: #fff !important;
}

/* Disabled controls (« ‹ › » when at an end). */
.pagination > li.disabled > span,
.pagination > li.disabled > a,
.pagination .page-item.disabled .page-link {
  color: var(--prof-page-disabled) !important;
  background: #fff;
  border-color: var(--prof-page-border) !important;
  cursor: default;
  pointer-events: none;
}

.pagination > li > a:focus,
.pagination .page-link:focus {
  outline: none;
  box-shadow: 0 0 0 0.15rem rgba(0, 61, 165, 0.15);
}

/* =====================================================================
   MODALS — canonical design, generalised from the PRF-1145 technician /
   manager modal redesign (.tech-modal-*) so EVERY Bootstrap modal in the
   app shares one look:
     - 14px rounded dialog
     - centered header, close button pinned top-right, no divider
     - bold, centered title
     - 8px rounded inputs & buttons inside the modal

   !important mirrors the source design — it's needed to beat the legacy
   square-input modal rules in stores.css (.modal input { border-radius:0 }).
   The 6 cherry-picked templates keep their inline .tech-modal-* styles too;
   those now just re-assert the same values (harmless).
   ===================================================================== */
.modal-content {
  border-radius: var(--prof-modal-radius) !important;
}

.modal-content .form-control,
.modal-content input:not([type=checkbox]):not([type=radio]),
.modal-content select,
.modal-content textarea,
.modal-content .btn:not(.btn-round):not(.rounded-circle):not(.rounded-pill) {
  border-radius: var(--prof-modal-inner-radius) !important;
}

.modal-header {
  position: relative;
  justify-content: center;
  border-bottom: none;
}
/* Close button — crisp CSS-drawn ✕ inside a soft round button.
   The &times; glyph is hidden (font-size:0) and the ✕ is drawn as two
   rotated lines via ::before/::after, so it looks identical in every modal
   and no template markup has to change. Also beats the legacy stores.css
   rule that made every modal close a 40px RED glyph. */
.modal .modal-header .close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  margin: 0;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  opacity: 1;
  font-size: 0;            /* hide the &times; glyph */
  line-height: 0;
  color: transparent;
  text-shadow: none;
  cursor: pointer;
  transition: background .15s ease;
}
.modal .modal-header .close::before,
.modal .modal-header .close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: #8b95a5;
  transition: background .15s ease;
}
.modal .modal-header .close::before { transform: translate(-50%, -50%) rotate(45deg); }
.modal .modal-header .close::after  { transform: translate(-50%, -50%) rotate(-45deg); }
.modal .modal-header .close:hover {
  background: #eef2f8;     /* soft circle fills on hover */
  opacity: 1;
}
.modal .modal-header .close:hover::before,
.modal .modal-header .close:hover::after {
  background: #46536b;     /* lines darken on hover */
}
.modal .modal-header .close:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 61, 165, 0.15);
}
.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
}
.modal-footer {
  border-top: none;
  justify-content: center;
}

/* Reusable detail list for view / details modals (label ↔ value rows). */
.prof-detail-list { list-style: none; padding: 0; margin: 0; }
.prof-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 12px 0;
  border-bottom: 1px solid #eef2f8;
}
.prof-detail-row:last-child { border-bottom: none; }
.prof-detail-label { color: #6c757d; font-weight: 600; white-space: nowrap; }
.prof-detail-value { color: var(--prof-primary, #003DA5); font-weight: 600; text-align: right; }