/* Australian Stock Horse Society members site theme.
   Brand green #005030 is sampled from the ASHS logo. */

:root {
  --ashs-green: #005030;
  --ashs-green-dark: #003a23;
  --ashs-green-darker: #002416;
  --ashs-green-light: #e6efeb;
  --ashs-green-rgb: 0, 80, 48;
  --topbar-height: 4rem;
  --sidebar-width: 15rem;

  --bs-primary: var(--ashs-green);
  --bs-primary-rgb: var(--ashs-green-rgb);
  --bs-link-color: var(--ashs-green);
  --bs-link-color-rgb: var(--ashs-green-rgb);
  --bs-link-hover-color: var(--ashs-green-dark);
  --bs-link-hover-color-rgb: 0, 58, 35;
  --bs-primary-bg-subtle: var(--ashs-green-light);
  --bs-primary-border-subtle: #99b9ac;
  --bs-primary-text-emphasis: var(--ashs-green-darker);
  --bs-focus-ring-color: rgba(var(--ashs-green-rgb), 0.25);
  --bs-body-font-family: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ashs-page-bg: #f5f7f6;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .display-6 {
  font-family: "Barlow Semi Condensed", var(--bs-body-font-family);
  font-weight: 600;
  color: var(--ashs-green-darker);
}

/* Bootstrap buttons recoloured to the brand */
.btn-primary {
  --bs-btn-bg: var(--ashs-green);
  --bs-btn-border-color: var(--ashs-green);
  --bs-btn-hover-bg: var(--ashs-green-dark);
  --bs-btn-hover-border-color: var(--ashs-green-dark);
  --bs-btn-active-bg: var(--ashs-green-darker);
  --bs-btn-active-border-color: var(--ashs-green-darker);
  --bs-btn-disabled-bg: var(--ashs-green);
  --bs-btn-disabled-border-color: var(--ashs-green);
  --bs-btn-focus-shadow-rgb: var(--ashs-green-rgb);
}

.btn-outline-primary {
  --bs-btn-color: var(--ashs-green);
  --bs-btn-border-color: var(--ashs-green);
  --bs-btn-hover-bg: var(--ashs-green);
  --bs-btn-hover-border-color: var(--ashs-green);
  --bs-btn-active-bg: var(--ashs-green-dark);
  --bs-btn-active-border-color: var(--ashs-green-dark);
  --bs-btn-disabled-color: var(--ashs-green);
  --bs-btn-disabled-border-color: var(--ashs-green);
  --bs-btn-focus-shadow-rgb: var(--ashs-green-rgb);
}

.form-control:focus, .form-select:focus {
  border-color: #80a898;
  box-shadow: 0 0 0 0.25rem var(--bs-focus-ring-color);
}

.form-check-input:checked {
  background-color: var(--ashs-green);
  border-color: var(--ashs-green);
}

.page-link {
  --bs-pagination-color: var(--ashs-green);
  --bs-pagination-active-bg: var(--ashs-green);
  --bs-pagination-active-border-color: var(--ashs-green);
}

/* Environment banner (development / staging only) */
.env-banner {
  background: #f0ad00;
  color: #2b2000;
  letter-spacing: 0.08em;
  padding: 0.15rem 0;
}

/* Top bar */
.topbar {
  background: var(--ashs-green);
  min-height: var(--topbar-height);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.topbar-logo {
  height: 2.75rem;
  width: auto;
}

.brand-text {
  font-family: "Barlow Semi Condensed", var(--bs-body-font-family);
  font-weight: 600;
  font-size: 1.2rem;
  line-height: 1.1;
}

.brand-sub {
  display: block;
  font-family: var(--bs-body-font-family);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.75;
}

/* Layout: sidebar on the left from lg upwards, offcanvas below */
body {
  background-color: var(--ashs-page-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-shell {
  display: flex;
  flex: 1;
}

.app-main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 1rem;
}

@media (min-width: 768px) {
  .app-main {
    padding: 2rem;
  }
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--bs-border-color);
}

@media (min-width: 992px) {
  .sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    padding-top: 1rem;
  }

  .sidebar .offcanvas-body {
    position: sticky;
    top: var(--topbar-height);
  }
}

.sidebar-heading {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
  padding: 1.25rem 1rem 0.4rem;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--bs-body-color);
  padding: 0.6rem 1rem;
  border-left: 3px solid transparent;
  font-weight: 500;
}

.sidebar-nav .nav-link:hover {
  background: var(--ashs-green-light);
  color: var(--ashs-green-darker);
}

.sidebar-nav .nav-link.active {
  background: var(--ashs-green-light);
  color: var(--ashs-green);
  border-left-color: var(--ashs-green);
  font-weight: 600;
}

/* Home */
.hero-logo {
  width: 9rem;
  height: auto;
}

/* Tables: numeric columns right-aligned with tabular digits */
.table td.num, .table th.num {
  text-align: right;
  padding-right: 1rem;
  font-variant-numeric: tabular-nums;
}

/* UI showcase */
.swatch {
  height: 4rem;
  border-radius: var(--bs-border-radius);
}

.swatch-green { background: var(--ashs-green); }
.swatch-green-dark { background: var(--ashs-green-dark); }
.swatch-green-darker { background: var(--ashs-green-darker); }
.swatch-green-light { background: var(--ashs-green-light); border: 1px solid var(--bs-border-color); }

/* Scrollable code block (Test API raw XML) */
.code-scroll {
  max-height: 32rem;
  overflow: auto;
}

/* Member login */
.login-emblem {
  width: 4.5rem;
  height: auto;
}

/* House rule: radios look like ticked boxes, site-wide (same tick as Bootstrap's checkbox) */
.form-check-input[type="radio"] {
  border-radius: var(--bs-border-radius);
}

.form-check-input[type="radio"]:checked {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

/* House form field widths: a field is as wide as what goes in it (max-width only, so fields still shrink on phones).
   Tom Select copies the select's classes onto its .ts-wrapper, so autocomplete selects are sized too. */
.field-w-date { max-width: 11rem; }
.field-w-num { max-width: 7rem; }
.field-w-md { max-width: 24rem; }
.field-w-lg { max-width: 36rem; }

/* Keep long forms readable on wide screens */
.form-narrow { max-width: 48rem; }

/* Branch email preview page */
.email-preview-frame { width: 100%; height: 75vh; border: 1px solid var(--bs-border-color); background: #fff; }

/* Drawn signatures (core/signature.py, static/js/signature.js). Only the canvas stops touch scrolling. */
.signature-pad { max-width: 36rem; }
.signature-box { position: relative; }
.signature-canvas { display: block; width: 100%; height: 12rem; touch-action: none; cursor: crosshair; }
.signature-hint { position: absolute; left: 1rem; bottom: 0.75rem; pointer-events: none; }
.signature-pad.is-signed .signature-hint { display: none; }
.signature-image { max-width: 100%; height: 6rem; }

/* Tables that sit straight inside a card line up with the card header and list groups:
   the first and last cells use the card's own side padding (1rem) instead of the table's 0.5rem. */
.card > .table > :not(caption) > * > :first-child,
.card > .table-responsive > .table > :not(caption) > * > :first-child {
  padding-left: var(--bs-card-spacer-x);
}

.card > .table > :not(caption) > * > :last-child,
.card > .table-responsive > .table > :not(caption) > * > :last-child {
  padding-right: var(--bs-card-spacer-x);
}
