/* ZwiCoat Portal theme — palette matches the public site (zwicoat.com). */

:root {
  --primary-1: #3b96d0;
  --primary-2: #39a1d9;
  --primary-3: #89c4ed;
  --black: #222;
  --grey-light: #cbd5e1;
  --grey-darker: #94a3b8;
  --grey-darkest: #0f172a;
}

body {
  color: var(--black);
  background-color: #f8fafc;
}

/* ---- Navbar ---- */

.navbar-zwicoat {
  background-color: var(--primary-1);
}

.navbar-zwicoat .navbar-brand,
.navbar-zwicoat .nav-link {
  color: #fff;
}

.navbar-zwicoat .nav-link:hover,
.navbar-zwicoat .nav-link:focus {
  color: var(--primary-3);
}

.navbar-zwicoat .nav-link.active {
  color: #fff;
  font-weight: 600;
  border-bottom: 2px solid var(--primary-3);
}

.navbar-zwicoat .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.5);
}

.navbar-zwicoat .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba%28255,255,255,0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

/* ---- Navbar brand logo (WP9.2 lead review: too small/low-contrast at
   40px straight on the blue bar) — a small light pill behind the mark so
   it reads clearly against navbar-zwicoat's blue. ---- */

.navbar-brand-badge {
  display: inline-flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.92);
  border-radius: 0.5rem;
  padding: 0.3rem 0.75rem;
}

.navbar-brand-badge img {
  display: block;
}

/* ---- Navbar tabs as prominent buttons (WP9.2 v2, Kam) ---- */

.zwicoat-nav-btn {
  padding: 0.5rem 1.1rem;
  font-weight: 500;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* Bootstrap's .btn-outline-light.active already fills the button (same
   visual treatment as :hover) — this just makes sure it reads clearly
   against the blue bar too. */
.zwicoat-nav-btn.active {
  color: var(--primary-1);
}

@media (max-width: 991.98px) {
  .zwicoat-nav-buttons {
    width: 100%;
  }

  .zwicoat-nav-buttons .nav-item,
  .zwicoat-nav-buttons .zwicoat-nav-btn {
    width: 100%;
  }
}

/* ---- Content ---- */

main.portal-content {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

/* ---- Page-width container (WP10.1, Kam: "the entire portal would
   benefit from small margins on the left and right") ----
   container-fluid alone ran text edge-to-edge on wide monitors. Applied
   to both the navbar's inner row and main.portal-content so they line up
   at the same width; the navbar's own background (.navbar-zwicoat) still
   spans full-bleed -- this only constrains what's inside it. Stacks on
   top of Bootstrap's .container-fluid (kept alongside it on both
   elements) rather than replacing it, so the flex layout Bootstrap's
   navbar CSS expects from a `.navbar > .container-fluid` child is
   untouched. */
.portal-container {
  max-width: 1400px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

@media (max-width: 576px) {
  .portal-container {
    padding-inline: 1rem;
  }
}

.btn-primary {
  background-color: var(--primary-2);
  border-color: var(--primary-2);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--primary-1);
  border-color: var(--primary-1);
}

a {
  color: var(--primary-1);
}

a:hover {
  color: var(--primary-2);
}

/* ---- Hydrogel formulations download card (WP9.2 §3) ----
   Pinned top-right of the ZwiCoat Procedures Home content area only. */
.home-hydrogel-card {
  max-width: 20rem;
  width: 100%;
}

@media (min-width: 768px) {
  .home-hydrogel-card {
    width: auto;
  }
}

/* ---- Safety tab: SDS sheets card grid (WP-G §3c) ----
   Same auto-fill grid approach as .projects-card-grid: collapses to a
   single column under ~16rem-per-card, so it's responsive at 375px with
   no separate mobile breakpoint needed. */
.safety-sds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
}

/* ---- Home secondary subnav (SPEC.md §4) ---- */

.home-subnav .nav-link {
  color: var(--black);
  background-color: #eef4fa;
  margin-right: 0.375rem;
  margin-bottom: 0.375rem;
}

.home-subnav .nav-link:hover {
  background-color: var(--primary-3);
  color: var(--black);
}

.home-subnav .nav-link.active {
  background-color: var(--primary-2);
  color: #fff;
}

/* ---- Experiment Log (SPEC.md §5) ---- */

/* Method-tag badges shown in the experiments table. */
.explog-tag-badge {
  background-color: #eef4fa;
  color: var(--black);
  border: 1px solid var(--grey-light);
  font-weight: 500;
}

/* Click-to-apply tag pills on the create/edit form: a CheckboxSelectMultiple
   rendered as toggleable pills using only :has()/sibling CSS — no JS. */
.explog-tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.explog-tag-pills .form-check {
  margin: 0;
  padding: 0;
}

.explog-tag-pills .form-check-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.explog-tag-pills .form-check-label {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--grey-light);
  background-color: #fff;
  color: var(--black);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.1s ease-in-out, color 0.1s ease-in-out, border-color 0.1s ease-in-out;
}

.explog-tag-pills .form-check-input:checked + .form-check-label {
  background-color: var(--primary-2);
  border-color: var(--primary-2);
  color: #fff;
}

.explog-tag-pills .form-check-input:focus-visible + .form-check-label {
  outline: 2px solid var(--primary-1);
  outline-offset: 2px;
}

/* The folder-name callout (create-time and detail page). */
.explog-folder-callout {
  border: 2px solid var(--primary-2);
  background-color: #eef4fa;
}

.explog-folder-callout code {
  font-size: 1.05rem;
  word-break: break-all;
}

.explog-search-form .row > * {
  margin-bottom: 0.5rem;
}

@media (min-width: 992px) {
  .explog-search-form .row > * {
    margin-bottom: 0;
  }
}

/* ---- Time Tracking (SPEC.md §6) ---- */

/* Month calendar (WP11.2: replaces the old two-week grid -- "show a full
   calendar (by month)... make the demarcations between pay periods
   clear"). Weeks run Sunday -> Saturday, same as pay periods, so every
   week-row belongs to exactly one period (see timesheets/periods.py's
   month_weeks() docstring) and periods are grouped into
   .month-period-group blocks: a header strip + that period's 1-2 week
   rows, sharing one background band and one colored left rail so it's
   visually obvious which rows a header belongs to. Alternating bands +
   a heavy rule between groups is deliberately redundant with the left
   rail's alternating color -- demarcation should read even in
   grayscale/print, not rely on color alone. */
.month-weekday-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.375rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--grey-darkest);
  text-align: center;
}

.month-period-group {
  border-left: 5px solid var(--primary-3);
  border-radius: 0.375rem;
  background-color: #fff;
  padding: 0.5rem 0.5rem 0.75rem;
  margin-bottom: 0;
}

.month-period-group.is-band-odd {
  background-color: #f4f8fc;
  border-left-color: var(--primary-1);
}

.month-period-group + .month-period-group {
  border-top: 4px solid var(--grey-darkest);
  margin-top: 1rem;
  padding-top: 0.75rem;
}

.month-period-group.is-anchored {
  box-shadow: 0 0 0 2px var(--primary-1);
}

.month-period-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.25rem 0.25rem 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--grey-light);
}

.month-period-header h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.month-week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

.month-week-row + .month-week-row {
  margin-top: 0.5rem;
}

.month-day-cell {
  display: block;
  min-height: 6rem;
  padding: 0.5rem;
  border: 1px solid var(--grey-light);
  border-radius: 0.375rem;
  background-color: rgba(255, 255, 255, 0.6);
  color: var(--black);
  text-decoration: none;
}

.month-day-cell:hover,
.month-day-cell:focus {
  border-color: var(--primary-2);
  color: var(--black);
  text-decoration: none;
}

.month-day-cell.is-weekend {
  background-color: rgba(15, 23, 42, 0.05);
}

.month-day-cell.is-outside-month {
  opacity: 0.6;
}

.month-day-cell.is-today {
  border-color: var(--primary-1);
  border-width: 2px;
  box-shadow: 0 0 0 1px var(--primary-1);
}

.month-day-cell.is-highlighted {
  background-color: #eef4fa;
}

.timesheet-day-date {
  font-weight: 600;
  font-size: 0.875rem;
}

.timesheet-day-total {
  font-weight: 600;
}

.timesheet-chip {
  display: inline-block;
  margin: 0.15rem 0.15rem 0 0;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--grey-light);
  border-radius: 999px;
  background-color: #eef4fa;
  color: var(--black);
  font-size: 0.75rem;
  white-space: nowrap;
}

.month-holiday-marker {
  font-size: 0.7rem;
  color: var(--grey-darker);
}

/* Mobile: vertical list grouped by pay period instead of a shrunk grid
   (WP11.2 deliverable 4 -- "do not simply shrink the grid"). */
.month-mobile-list {
  display: none;
}

.month-mobile-period {
  border-left: 5px solid var(--primary-3);
  border-radius: 0.375rem;
  background-color: #fff;
  padding: 0.5rem;
  margin-bottom: 1rem;
}

.month-mobile-period.is-band-odd {
  background-color: #f4f8fc;
  border-left-color: var(--primary-1);
}

.month-mobile-day-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.4rem 0.25rem;
  border-bottom: 1px solid var(--grey-light);
  text-decoration: none;
  color: var(--black);
}

.month-mobile-day-row:last-child {
  border-bottom: none;
}

.month-mobile-day-row.is-today {
  background-color: #eef4fa;
}

.month-mobile-day-row.is-outside-month {
  opacity: 0.6;
}

@media (max-width: 767.98px) {
  .month-calendar,
  .month-weekday-header {
    display: none;
  }

  .month-mobile-list {
    display: block;
  }
}

/* Review grid (SPEC.md §6 / PLAN.md "Template facts"). */
.timesheet-grid-section-label td {
  background-color: #f1f5f9;
  font-weight: 600;
}

.timesheet-grid th {
  white-space: nowrap;
}

/* ---- Projects & Tasks (SPEC.md §7 / PLAN.md "Tasks/to-dos") ---- */

.projects-tabs .nav-link {
  color: var(--black);
  border: 1px solid var(--grey-light);
}

.projects-tabs .nav-link.active {
  background-color: var(--primary-2);
  border-color: var(--primary-2);
  color: #fff;
}

/* Board switcher: a row of name pills, wraps on mobile. */
.projects-people-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.projects-person-pill.active {
  background-color: var(--primary-2);
  border-color: var(--primary-2);
  color: #fff;
  pointer-events: none;
}

.projects-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.5rem;
}

.projects-card-title {
  font-weight: 600;
  text-decoration: none;
  color: var(--black);
}

.projects-card-title:hover {
  color: var(--primary-1);
  text-decoration: underline;
}

.projects-status-badge {
  color: #fff;
  font-weight: 500;
}

.projects-status-proposed {
  background-color: var(--grey-darker);
}

.projects-status-active {
  background-color: var(--primary-2);
}

.projects-status-backburner {
  background-color: #b98b2a;
}

.projects-status-done {
  background-color: #4a9b5e;
}

/* Checklist / My Tasks rows: a big, easy-to-tap round check button rather
   than a tiny native checkbox — brief §5: "Big tap targets, mobile-first." */
.projects-task-check,
.projects-task-check-static {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  border-radius: 999px;
  border: 2px solid var(--grey-light);
  background-color: #fff;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

button.projects-task-check {
  cursor: pointer;
}

.projects-task-check.is-done,
.projects-task-check-static.is-done {
  background-color: var(--primary-2);
  border-color: var(--primary-2);
}

.projects-task-row {
  padding: 0.25rem 0;
}

/* ---- Supplies (SPEC.md §8) ---- */

/* One row on desktop (brief: "the fastest form in the portal"); flex-wrap
   naturally stacks each field full-width on narrow/mobile viewports
   without a separate breakpoint rule. */
.supplies-quick-add-description {
  min-width: 220px;
}

.supplies-quick-add-link {
  min-width: 160px;
  flex: 1 1 160px;
}

.supplies-quick-add-small {
  width: 8rem;
}

.supplies-status-badge {
  color: #fff;
  font-weight: 500;
}

.supplies-status-open {
  background-color: #b98b2a;
}

.supplies-status-ordered {
  background-color: var(--primary-2);
}

.supplies-delete-btn {
  font-size: 1.25rem;
  line-height: 1;
  text-decoration: none;
}

/* ---- Rendered Markdown content (SPEC.md §3/§4, WP7.1) ----
   Handbook/policy/training/library pages render admin-authored Markdown
   (content/render.py) wrapped in .md-content — scale headings down so a
   long document reads like a document, not a billboard of oversized page
   titles. Deliberately scoped to .md-content only; base page <h1>s
   elsewhere are untouched. */

.md-content h1,
.md-content h2,
.md-content h3,
.md-content h4,
.md-content h5,
.md-content h6 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.md-content > :first-child {
  margin-top: 0;
}

.md-content h1 {
  font-size: 1.35rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--grey-light);
}

.md-content h2 {
  font-size: 1.2rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--grey-light);
}

.md-content h3 {
  font-size: 1.1rem;
}

.md-content h4,
.md-content h5,
.md-content h6 {
  font-size: 1rem;
}

/* ---- Publications (WP10.1 §6): year in a narrow left column, title a
   normal-weight link (not a heading), venue + summary below it. ---- */

.publications-year {
  flex: 0 0 3.25rem;
  font-weight: 600;
}

.publications-title {
  font-weight: 400;
  font-size: 1rem;
}

/* ---- Admin dashboard / user management (SPEC.md §9) ---- */

.accounts-state-badge {
  color: #fff;
  font-weight: 500;
}

.accounts-state-requested {
  background-color: var(--grey-darker);
}

.accounts-state-approved {
  background-color: #b98b2a;
}

.accounts-state-active {
  background-color: #4a9b5e;
}

.accounts-state-retired {
  background-color: var(--grey-darkest);
}

/* ---- Profile photo avatars (WP9.3 §1): Team Directory cards, navbar user
   menu, and the profile page's own preview. `object-fit: cover` keeps a
   non-square upload from stretching; the initials fallback (no photo
   uploaded yet) is a plain muted circle so the grid stays even either
   way. */

.zwicoat-avatar {
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
}

.zwicoat-avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: var(--grey-light);
  color: var(--grey-darkest);
  font-weight: 600;
  flex-shrink: 0;
}

.zwicoat-avatar-sm,
.zwicoat-avatar-sm.zwicoat-avatar-initials {
  width: 28px;
  height: 28px;
  font-size: 0.7rem;
}

.zwicoat-avatar-lg,
.zwicoat-avatar-lg.zwicoat-avatar-initials {
  width: 72px;
  height: 72px;
  font-size: 1.5rem;
}

/* ---- Signature pad (WP11.3): the drawn-signature canvas embedded on the
   profile page, the "Add your signature" onboarding step, and inline at
   signing time. `touch-action: none` is what lets a finger draw on the
   canvas instead of scrolling the page underneath it. */

.zwicoat-signature-canvas {
  display: block;
  width: 100%;
  max-width: 420px;
  height: 160px;
  border: 1px solid var(--grey-darker);
  border-radius: 4px;
  background-color: #fff;
  touch-action: none;
  cursor: crosshair;
}

.zwicoat-signature-preview {
  max-width: 420px;
  max-height: 120px;
  border: 1px solid var(--grey-light);
  border-radius: 4px;
  background-color: #fff;
  padding: 0.5rem;
}
