/* DiveCohorts CMS theme, kept consistent with https://www.divecohorts.com
   (css/landing.css there): same palette, fonts, navbar, depth rule, buttons
   and card shape. Change colours here, not inline. */

:root {
  --dc-teal-900: #0e2a32;
  --dc-teal-700: #0b6e7f;
  --dc-teal-500: #14879a;
  --dc-teal-100: #e3f0f1;
  --dc-coral: #ff6f59;
  --dc-coral-600: #e5573f;
  --dc-slate: #5c7079;
  --dc-mist: #f2f6f6;
  --dc-border: #dce6e6;

  --bs-primary: var(--dc-teal-700);
  --bs-primary-rgb: 11, 110, 127;
  --bs-body-bg: var(--dc-mist);
  --bs-body-color: var(--dc-teal-900);
  --bs-border-color: var(--dc-border);
  --bs-link-color: var(--dc-teal-700);
  --bs-link-color-rgb: 11, 110, 127;
  --bs-link-hover-color: var(--dc-teal-900);
  --bs-link-hover-color-rgb: 14, 42, 50;
  --bs-secondary-color: var(--dc-slate);

  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background-color: var(--dc-mist);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1, h2, .display-heading {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  color: var(--dc-teal-900);
}

/* Thin "depth gauge" tick rule under the navbar (the shared signature element). */
.depth-rule {
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    var(--dc-teal-700) 0px,
    var(--dc-teal-700) 2px,
    transparent 2px,
    transparent 10px
  );
  opacity: 0.35;
}

/* ---- Navbar ---- */
.navbar-dc {
  background-color: var(--dc-teal-900);
}
.navbar-dc .nav-link {
  color: rgba(255, 255, 255, 0.78) !important;
  font-weight: 500;
}
.navbar-dc .nav-link:hover,
.navbar-dc .nav-link.active {
  color: #fff !important;
}
.navbar-dc .nav-link.active {
  box-shadow: inset 0 -2px 0 var(--dc-coral);
}
.navbar-dc .navbar-text {
  color: rgba(255, 255, 255, 0.78) !important;
}
.brand-suffix {
  margin-left: 0.5rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 0.35rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* ---- Buttons ---- */
/* Coral accent for the main action on a page. */
.btn-accent {
  background-color: var(--dc-coral);
  border-color: var(--dc-coral);
  color: #fff;
  font-weight: 600;
}
.btn-accent:hover,
.btn-accent:focus,
.btn-accent:active,
.btn-accent:disabled {
  background-color: var(--dc-coral-600) !important;
  border-color: var(--dc-coral-600) !important;
  color: #fff !important;
}
.btn-outline-light-dc {
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
}
.btn-outline-light-dc:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}
/* Bootstrap compiles its own blue into .btn-primary; re-point it at teal. */
.btn-primary {
  --bs-btn-bg: var(--dc-teal-700);
  --bs-btn-border-color: var(--dc-teal-700);
  --bs-btn-hover-bg: var(--dc-teal-900);
  --bs-btn-hover-border-color: var(--dc-teal-900);
  --bs-btn-active-bg: var(--dc-teal-900);
  --bs-btn-active-border-color: var(--dc-teal-900);
  --bs-btn-disabled-bg: var(--dc-teal-700);
  --bs-btn-disabled-border-color: var(--dc-teal-700);
  --bs-btn-focus-shadow-rgb: 11, 110, 127;
}
.btn-outline-primary {
  --bs-btn-color: var(--dc-teal-700);
  --bs-btn-border-color: var(--dc-teal-700);
  --bs-btn-hover-bg: var(--dc-teal-700);
  --bs-btn-hover-border-color: var(--dc-teal-700);
  --bs-btn-active-bg: var(--dc-teal-900);
  --bs-btn-active-border-color: var(--dc-teal-900);
  --bs-btn-focus-shadow-rgb: 11, 110, 127;
}

/* ---- Forms ---- */
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--dc-teal-500);
  box-shadow: 0 0 0 0.25rem rgba(20, 135, 154, 0.25);
}
.form-check-input:checked {
  background-color: var(--dc-teal-700);
  border-color: var(--dc-teal-700);
}

/* ---- Cards and tables ---- */
/* White surfaces on the mist page background so cards and fields stand out. */
.card,
.modal-content {
  --bs-card-bg: #fff;
  --bs-modal-bg: #fff;
}
.form-control,
.form-select {
  background-color: #fff;
}
.card {
  border: 1px solid var(--dc-border);
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(14, 42, 50, 0.04);
}
.card.shadow-sm {
  box-shadow: 0 1px 2px rgba(14, 42, 50, 0.04) !important;
}
.table > thead.table-light {
  --bs-table-bg: var(--dc-teal-100);
  --bs-table-color: var(--dc-teal-900);
}
.table {
  --bs-table-bg: #fff;
}
.table td,
.table th {
  vertical-align: middle;
}
/* Values stay on one line; headings may wrap so wide tables still fit. */
.table td {
  white-space: nowrap;
}
/* Tables in narrow cards (e.g. inspection history) wrap instead. */
.table.table-wrap td {
  white-space: normal;
}
.table th {
  line-height: 1.2;
}

/* Badge linking a cylinder to its manifolded set. */
.badge-set {
  background-color: var(--dc-teal-100);
  color: var(--dc-teal-700);
  font-weight: 600;
}
.badge-set:hover {
  background-color: var(--dc-teal-700);
  color: #fff;
}

.text-slate {
  color: var(--dc-slate) !important;
}

/* ---- Page bits ---- */
.auth-card {
  max-width: 460px;
  margin: 4rem auto;
}

.brand-mark {
  width: 56px;
  height: 56px;
}

.empty-state {
  padding: 3rem 1rem;
  color: var(--dc-slate);
}

.text-pre-wrap {
  white-space: pre-wrap;
}

/* Slightly tighter cells for the wide cylinders table. */
.table-sm-cells > :not(caption) > * > * {
  padding: 0.6rem 0.55rem;
}

/* Oxygen-clean badge on cylinders. */
.badge-o2 {
  background-color: #e8f6ee;
  color: #1e7a4c;
  font-weight: 600;
}

/* Gas type badges on blends (standard gases use .badge-set). */
.badge-deco {
  background-color: #ffe9e5;
  color: #b23a26;
  font-weight: 600;
}
.badge-hypoxic {
  background-color: #efe9fb;
  color: #5b3fa3;
  font-weight: 600;
}

/* Blends switched off (e.g. bank empty): dim everything but the switch. */
.blend-unavailable > td:not(:nth-last-child(-n+2)) {
  opacity: 0.5;
}

/* ---- Printable cylinder label ---- */
.cylinder-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 30rem;
  padding: 1rem;
  background: #fff;
  border: 2px solid var(--dc-teal-900);
  border-radius: 0.75rem;
}
.label-qr svg {
  display: block;
  /* The SVG scales to this box (viewBox), white margin included. */
  width: 10rem;
  height: 10rem;
  shape-rendering: crispEdges; /* sharp module edges when scaled, on screen and in print */
}
.label-logo {
  height: 22px;
  margin-bottom: 0.4rem;
}
.label-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--dc-teal-900);
}
.label-url {
  font-size: 0.7rem;
  color: var(--dc-slate);
  word-break: break-all;
  margin-top: 0.3rem;
}
@media print {
  body {
    background: #fff;
  }
  main.container {
    padding: 0 !important;
  }
}

/* psi / bar switch in the navbar: the selected unit is solid white. */
.btn-outline-light-dc.active,
.btn-outline-light-dc.active:hover {
  background-color: #fff;
  border-color: #fff;
  color: var(--dc-teal-900);
}

/* Badges keep the body font inside Fraunces headings. */
.badge {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  vertical-align: middle;
}
h1 .badge,
h2 .badge {
  font-size: 0.6em;
}

/* Upper-case typed label codes, but not the placeholder. */
.text-uppercase:placeholder-shown {
  text-transform: none !important;
}

/* Cells allowed to wrap in otherwise single-line tables. */
.table td.text-wrap {
  white-space: normal;
  min-width: 5.5rem;
}

/* ---- Cylinders table: each cylinder (or set of doubles) is a <tbody> group,
   coloured by status with a thick left edge and light tint ---- */
.cyl-table > :not(caption) > * > * {
  padding: 0.55rem 0.6rem;
}
.cyl-table .cyl-group > tr > td:first-child {
  border-left: 6px solid #b9d3d6;
}
.cyl-table .cyl-group + .cyl-group {
  border-top: 2px solid var(--dc-border);
}
.cyl-table .status-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  background: #fff;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.cyl-table .cyl-group.status-danger > tr > td {
  --bs-table-bg: #fff6f6;
}
.cyl-table .cyl-group.status-danger > tr > td:first-child {
  border-left-color: #d9534f;
}
.cyl-table .cyl-group.status-danger .status-pill {
  color: #a12622;
}
.cyl-table .cyl-group.status-warning > tr > td {
  --bs-table-bg: #fffaf0;
}
.cyl-table .cyl-group.status-warning > tr > td:first-child {
  border-left-color: #e0a800;
}
.cyl-table .cyl-group.status-warning .status-pill {
  color: #7a5200;
}
.cyl-table .cyl-group.status-info > tr > td {
  --bs-table-bg: #f1f9fb;
}
.cyl-table .cyl-group.status-info > tr > td:first-child {
  border-left-color: var(--dc-teal-500);
}
.cyl-table .cyl-group.status-info .status-pill {
  color: var(--dc-teal-700);
}
.cyl-table .cyl-group.status-neutral .status-pill {
  color: var(--dc-slate);
}
.cyl-table .cyl-group.status-ok .status-pill {
  color: #1e7a4c;
}

/* Doubles: the set's row plus indented member rows, with only dashed lines inside the group. */
.cyl-table .set-group > tr > td {
  border-bottom-style: dashed;
}
.cyl-table .set-group > tr:last-child > td {
  border-bottom-style: solid;
}
.cyl-table .set-group .set-head > td {
  padding-bottom: 0.3rem;
}
.cyl-table .set-member > td {
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}
.cyl-table .set-member > td.member-name {
  padding-left: 1.6rem;
}
.cyl-table .set-member.status-danger .member-name {
  box-shadow: inset 3px 0 0 #d9534f;
}
.cyl-table .set-member.status-warning .member-name {
  box-shadow: inset 3px 0 0 #e0a800;
}

/* Collapsed navbar (phones): the menu toggler on the navy bar. */
.navbar-dc .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.45);
}
@media (max-width: 767.98px) {
  .navbar-dc .nav-link.active {
    box-shadow: inset 3px 0 0 var(--dc-coral);
    padding-left: 0.6rem;
  }
}

/* Fill status may wrap so the table keeps its Actions column on screen. */
.cyl-table td.fill-cell {
  white-space: normal;
  min-width: 11rem;
  max-width: 16rem;
}

/* Keep absolutely positioned children (e.g. visually-hidden button labels)
   inside a scrolling table, so they can't widen the whole page. */
.table-responsive {
  position: relative;
}

/* Long cylinder names and specs wrap rather than widening the table. */
.cyl-table td.cyl-cell {
  white-space: normal;
  min-width: 13rem;
}

/* ---- Below 1200px the cylinders table becomes rectangular cards ----
   Measured: with real data the table needs the xl container (1140px) to show
   every column; narrower, each <tbody> group becomes a card instead. */
@media (max-width: 1199.98px) {
  .cyl-table-wrap {
    background: transparent;
    border: 0;
    box-shadow: none !important;
  }
  .cyl-table-wrap > .table-responsive {
    overflow: visible;
  }
  .cyl-table,
  .cyl-table > tbody,
  .cyl-table > tbody > tr,
  .cyl-table > tbody > tr > td {
    display: block;
  }
  .cyl-table {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 0.75rem;
  }
  .cyl-table > thead {
    display: none;
  }

  /* Each group is a card: coloured left edge and tint as in the table. */
  .cyl-table .cyl-group {
    background: #fff;
    border: 1px solid var(--dc-border);
    border-left: 6px solid #b9d3d6;
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px rgba(14, 42, 50, 0.04);
    padding: 0.6rem 0.75rem;
  }
  .cyl-table .cyl-group + .cyl-group {
    border-top: 1px solid var(--dc-border);
  }
  .cyl-table .cyl-group.status-danger {
    border-left-color: #d9534f;
    background: #fff6f6;
  }
  .cyl-table .cyl-group.status-warning {
    border-left-color: #e0a800;
    background: #fffaf0;
  }
  .cyl-table .cyl-group.status-info {
    border-left-color: var(--dc-teal-500);
    background: #f1f9fb;
  }
  .cyl-table .cyl-group > tr > td,
  .cyl-table .cyl-group > tr > td:first-child {
    --bs-table-bg: transparent;
    background: transparent;
    box-shadow: none;
    border: 0;
    padding: 0.15rem 0;
    white-space: normal;
    min-width: 0;
    max-width: none;
  }
  .cyl-table > tbody > tr > td:empty {
    display: none;
  }

  /* Card layout: status + actions on top, the cylinder, then labelled values. */
  .cyl-table .cyl-group > tr {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-areas:
      "status status actions"
      "owner owner owner"
      "cyl cyl cyl"
      "hydro visual o2"
      "fill fill fill";
    column-gap: 0.75rem;
    align-items: start;
  }
  .cyl-table td.td-status { grid-area: status; }
  .cyl-table td.td-actions { grid-area: actions; }
  .cyl-table td.td-owner { grid-area: owner; }
  .cyl-table td.cyl-cell { grid-area: cyl; }
  .cyl-table td.td-hydro { grid-area: hydro; }
  .cyl-table td.td-visual { grid-area: visual; }
  .cyl-table td.td-o2 { grid-area: o2; }
  .cyl-table td.td-fill { grid-area: fill; }
  .cyl-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--dc-slate);
  }
  .cyl-table td.td-hydro,
  .cyl-table td.td-visual,
  .cyl-table td.td-o2 {
    padding-top: 0.35rem;
  }

  /* Doubles: set header, then each member as a compact block. */
  .cyl-table .set-group > tr > td {
    border-bottom: 0;
  }
  /* (more specific than ".cyl-group > tr" so members get their own compact layout) */
  .cyl-table .set-group > tr.set-member {
    grid-template-areas:
      "cyl cyl actions"
      "hydro visual o2";
    border-top: 1px dashed var(--dc-border);
    border-left: 3px solid transparent;
    margin-top: 0.45rem;
    padding: 0.4rem 0 0 0.6rem;
  }
  .cyl-table .set-group > tr.set-member > td.member-name {
    padding-left: 0;
    box-shadow: none;
  }
  .cyl-table .set-group > tr.set-member.status-danger {
    border-left-color: #d9534f;
  }
  .cyl-table .set-group > tr.set-member.status-warning {
    border-left-color: #e0a800;
  }
}

/* ---- Footer and legal pages ---- */
.site-footer {
  padding: 1.5rem 0;
  margin-top: 2rem;
  color: var(--dc-slate);
  border-top: 1px solid var(--dc-border);
}
.legal h2 {
  margin-top: 1.75rem;
}
.legal h3 {
  margin-top: 1.25rem;
}
/* Details the operator must fill in before launch. */
.legal-placeholder {
  background: #fff3a6;
  padding: 0 0.2em;
  border-radius: 0.2em;
}
.legal .alert h2 {
  margin-top: 0;
}
.legal-divider {
  margin: 3rem 0;
}
