/* The app's own styles, on top of Tabler (static/vendor/tabler.min.css). The brand colour is
   --app-brand, set from app/identity.py in templates/_head.html. */

.navbar-brand {
  color: var(--app-brand);
}

.btn-primary {
  --tblr-btn-bg: var(--app-brand);
  --tblr-btn-border-color: var(--app-brand);
  --tblr-btn-hover-bg: color-mix(in srgb, var(--app-brand) 85%, black);
  --tblr-btn-hover-border-color: color-mix(in srgb, var(--app-brand) 85%, black);
  --tblr-btn-active-bg: color-mix(in srgb, var(--app-brand) 75%, black);
}

.nav-link.active {
  color: var(--app-brand) !important;
  font-weight: 600;
}

a {
  color: var(--app-brand);
}

/* htmx's busy indicator (hx-indicator), shown only once a request has taken 150 ms, so a
   fast answer never flashes a spinner. Replaces the styles htmx would add itself (app.js). */
.htmx-indicator {
  opacity: 0;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
  transition: opacity 100ms ease-in 150ms;
}

/* An optimistic change waiting for the server (data-optimistic-*, static/app.js). */
.mb-pending {
  opacity: 0.75;
}

/* An optimistic change the server refused, being undone. */
.mb-reverted {
  animation: mb-reverted 0.4s ease-in-out;
}
@keyframes mb-reverted {
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* Something the server didn't save (static/app.js): the value stays, obviously unsaved. */
.mb-unsaved {
  outline: 2px solid var(--tblr-danger);
  outline-offset: 2px;
}

/* ── Buttons: three levels (docs/STARTER.md, "Buttons and icons") ─────────────────────────────
   solid  btn-primary          the one main action on a screen
   soft   btn btn-soft         secondary actions: a tinted pill, no border, full size to hit
   ghost  btn btn-ghost-*      minor ones (close, Remove, Not now), and dangerous ones as
                               btn-ghost-danger or btn-outline-danger, never soft */
.btn-soft {
  --mb-soft: color-mix(in srgb, var(--app-brand) 12%, transparent);
  background: var(--mb-soft);
  color: var(--app-brand);
  border: 0;
  border-radius: 999px;
  padding: .45rem .95rem;
  font-weight: 600;
  box-shadow: none;
}
.btn-soft:hover, .btn-soft:focus-visible, .btn-soft.active {
  background: color-mix(in srgb, var(--app-brand) 20%, transparent);
  color: var(--app-brand);
}
.btn-soft:disabled { opacity: .55; }
/* On a dark background the same tint all but disappears. */
[data-bs-theme="dark"] .btn-soft { --mb-soft: color-mix(in srgb, var(--app-brand) 22%, transparent); }
[data-bs-theme="dark"] .btn-soft:hover, [data-bs-theme="dark"] .btn-soft:focus-visible { background: color-mix(in srgb, var(--app-brand) 32%, transparent); }

/* Icons (templates/_icons.html). The space after one is its own margin, not the button's `gap`:
   with an inline-flex gap, a label like <u>D</u>aycare would split apart. */
.mb-icon {
  width: 1.05em; height: 1.05em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.btn > .mb-icon, .nav-link > .mb-icon { margin-right: .4rem; vertical-align: -.15em; }

/* ── The menu (base.html). At lg and up it sits in the bar, words only; below lg it's a side
   panel (Bootstrap's navbar offcanvas): full-width rows with icons, then who's signed in, a
   labelled Dark mode switch and Sign out at the foot. ───────────────────────────────────── */
.mb-menu-foot { display: flex; align-items: center; gap: .75rem; }
.mb-menu .nav-link { white-space: nowrap; }
@media (min-width: 992px) {
  .mb-menu .navbar-nav .mb-icon { display: none; }
}
@media (max-width: 991.98px) {
  .mb-menu { width: min(85vw, 20rem) !important; }
  .mb-menu .offcanvas-body { display: flex; flex-direction: column; padding: .5rem 1rem 1rem; }
  /* align-self, and no me-auto: an auto margin would stop the list stretching across the panel */
  .mb-menu .navbar-nav { align-self: stretch; margin-right: 0 !important; }
  .mb-menu .navbar-nav .nav-link {
    display: flex; align-items: center; gap: .75rem; padding: .75rem .5rem; font-size: 1rem;
    border-radius: var(--tblr-border-radius); width: 100%;
  }
  .mb-menu .navbar-nav .nav-link.active { background: color-mix(in srgb, var(--app-brand) 10%, transparent); }
  .mb-menu .navbar-nav .mb-icon { width: 1.25rem; height: 1.25rem; margin: 0; }
  .mb-menu-foot {
    flex-direction: column; align-items: stretch; gap: .25rem; margin-top: auto;
    padding-top: 1rem; border-top: 1px solid var(--tblr-border-color);
  }
  .mb-menu-who { padding: 0 .5rem .5rem; overflow-wrap: anywhere; }  /* a long email wraps */
  .mb-menu-row {
    display: flex; align-items: center; justify-content: space-between; flex-direction: row-reverse;
    padding: .6rem .5rem; margin: 0; min-height: 2.75rem;
  }
  .mb-menu-row .form-check-input { float: none; margin: 0; }
  .mb-menu-row .form-check-label { display: flex; align-items: center; gap: .75rem; }
  .mb-menu-row .mb-icon, .mb-sign-out .mb-icon { width: 1.25rem; height: 1.25rem; margin: 0; }
  .mb-sign-out { width: 100%; justify-content: flex-start; gap: .75rem; padding: .6rem .5rem; }
}

/* Forms inside table cells and headers sit inline. */
td form, .page-header form {
  display: inline-block;
}

/* A test copy of the live server (MESSAGES_TO redirect or none, app/mail/outbound_guard.py): a
   strip under the bar on every page, so nobody takes it for the real one. */
.mb-test-copy {
  padding: .4rem 1rem;
  text-align: center;
  font-weight: 600;
  background: var(--tblr-warning-bg-subtle, #fff3cd);
  color: var(--tblr-warning-text-emphasis, #664d03);
  border-bottom: 1px solid var(--tblr-warning-border-subtle, #ffe69c);
}

/* A sign-up whose email isn't confirmed (templates/_unconfirmed.html). */
.mb-unconfirmed {
  padding: .4rem 1rem;
  text-align: center;
  background: var(--tblr-info-bg-subtle, #cff4fc);
  color: var(--tblr-info-text-emphasis, #055160);
  border-bottom: 1px solid var(--tblr-info-border-subtle, #9eeaf9);
}
