/* ==========================================================================
   base.css — the grid, utilities and form/button components this app uses.
   ==========================================================================

   The templates were written against Bootstrap class names (a hangover from
   the original Wt build, where Bootstrap arrived with WBootstrap5Theme).
   Rather than pull in the whole framework for ~80 classes, this file
   implements exactly the subset in use: a 12-column flex grid, the spacing
   and flex utilities, buttons, forms, cards, alerts and list groups.

   It is deliberately small and self-hosted — no CDN, so no CSP exception,
   and nothing render-blocking beyond one file.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

body { margin: 0; line-height: 1.5; }

/* ---------- Grid ---------- */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-left: -0.75rem;
  margin-right: -0.75rem;
}
.row > * { padding-left: 0.75rem; padding-right: 0.75rem; width: 100%; }

.col-12 { flex: 0 0 100%; max-width: 100%; }

/* Mobile-first: columns stack, then split at their breakpoint. */
@media (min-width: 768px) {
  .col-md-3  { flex: 0 0 25%;      max-width: 25%; }
  .col-md-4  { flex: 0 0 33.3333%; max-width: 33.3333%; }
  .col-md-5  { flex: 0 0 41.6667%; max-width: 41.6667%; }
  .col-md-6  { flex: 0 0 50%;      max-width: 50%; }
  .col-md-7  { flex: 0 0 58.3333%; max-width: 58.3333%; }
  .col-md-8  { flex: 0 0 66.6667%; max-width: 66.6667%; }
  .col-md-9  { flex: 0 0 75%;      max-width: 75%; }
}
@media (min-width: 992px) {
  .col-lg-3  { flex: 0 0 25%;      max-width: 25%; }
  .col-lg-4  { flex: 0 0 33.3333%; max-width: 33.3333%; }
  .col-lg-5  { flex: 0 0 41.6667%; max-width: 41.6667%; }
  .col-lg-7  { flex: 0 0 58.3333%; max-width: 58.3333%; }
  .col-lg-8  { flex: 0 0 66.6667%; max-width: 66.6667%; }
  .col-lg-9  { flex: 0 0 75%;      max-width: 75%; }
}

/* ---------- Display & flex utilities ---------- */
.d-flex   { display: flex; }
.d-block  { display: block; }
.d-inline { display: inline; }
.d-none   { display: none; }

.flex-wrap { flex-wrap: wrap; }
.flex-column { flex-direction: column; }
.align-items-center   { align-items: center; }
.align-items-start    { align-items: flex-start; }
.justify-content-between { justify-content: space-between; }
.justify-content-center  { justify-content: center; }
.justify-content-end     { justify-content: flex-end; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

.w-100   { width: 100%; }
.ms-auto { margin-left: auto; }
.me-auto { margin-right: auto; }
.float-end { float: right; }

/* ---------- Spacing ---------- */
.m-0  { margin: 0; }
.mt-0 { margin-top: 0; }      .mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 0.25rem; } .mb-1 { margin-bottom: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }  .mb-2 { margin-bottom: 0.5rem; }
.mt-3 { margin-top: 1rem; }    .mb-3 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1.5rem; }  .mb-4 { margin-bottom: 1.5rem; }
.mt-5 { margin-top: 3rem; }    .mb-5 { margin-bottom: 3rem; }
.me-2 { margin-right: 0.5rem; }
.ms-2 { margin-left: 0.5rem; }

.p-0 { padding: 0; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }

/* ---------- Type ---------- */
.small, .fs-6 { font-size: 0.875rem; }
.text-muted   { color: var(--shop-muted); }
.text-center  { text-align: center; }
.text-end     { text-align: right; }
.text-danger  { color: var(--shop-red); }
.text-success { color: var(--shop-green); }
.text-warning-emphasis { color: #a05a00; }
h1, h2, h3, h4, h5, h6 { line-height: 1.25; }
.h6 { font-size: 1rem; font-weight: 600; margin: 0 0 0.5rem; }

.bg-light { background: #f8f9fa; }
.border   { border: 1px solid var(--shop-border); }
.rounded  { border-radius: 4px; }
.shadow-sm { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.img-fluid { max-width: 100%; height: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0.45rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  background: #fff;
  color: #212529;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-sm { padding: 0.28rem 0.65rem; font-size: 0.85rem; }
.btn-lg { padding: 0.6rem 1.4rem; font-size: 1.05rem; }

.btn-primary { background: var(--shop-link); border-color: var(--shop-link); color: #fff; }
.btn-primary:hover { background: #094db1; color: #fff; }

.btn-light { background: #fff; border-color: #fff; color: #212529; }
.btn-light:hover { background: #e9ecef; }

.btn-outline-primary   { border-color: var(--shop-link); color: var(--shop-link); }
.btn-outline-primary:hover { background: var(--shop-link); color: #fff; }
.btn-outline-secondary { border-color: #adb5bd; color: #495057; }
.btn-outline-secondary:hover { background: #e9ecef; }
.btn-outline-danger    { border-color: var(--shop-red); color: var(--shop-red); }
.btn-outline-danger:hover { background: var(--shop-red); color: #fff; }
.btn-outline-light     { border-color: rgba(255,255,255,0.6); color: #fff; background: transparent; }
.btn-outline-light:hover { background: rgba(255,255,255,0.15); color: #fff; }

.btn-link {
  background: none; border: none; padding: 0;
  color: var(--shop-link); text-decoration: underline; cursor: pointer;
  font-size: inherit;
}

/* button_to renders a <form>; keep it from breaking inline layouts. */
form.button_to { display: inline-block; margin: 0; }

.btn-group { display: inline-flex; gap: 0.25rem; flex-wrap: wrap; align-items: center; }
.btn-group-sm .btn { padding: 0.28rem 0.65rem; font-size: 0.85rem; }

/* ---------- Forms ---------- */
.form-label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.25rem; }
.form-text  { font-size: 0.82rem; color: var(--shop-muted); margin-top: 0.2rem; }

.form-control, .form-select {
  display: block;
  width: 100%;
  padding: 0.4rem 0.65rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #212529;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 3px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--shop-link);
  outline: 2px solid rgba(11, 94, 215, 0.25);
  outline-offset: 0;
}
.form-control-sm { padding: 0.2rem 0.45rem; font-size: 0.85rem; }
textarea.form-control { min-height: 6rem; }

.form-check { display: flex; align-items: center; gap: 0.4rem; }
.form-check-input { width: 1rem; height: 1rem; margin: 0; }
.form-check-label { margin: 0; font-size: 0.95rem; }

/* ---------- Cards, alerts, list groups ---------- */
.card {
  background: #fff;
  border: 1px solid var(--shop-border);
  border-radius: 4px;
}

.alert {
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
}
.alert-success   { background: #e8f5e9; border-color: #a5d6a7; color: #1b5e20; }
.alert-danger    { background: #fdecea; border-color: #f5c2bd; color: #8f1d14; }
.alert-warning   { background: #fff4e5; border-color: #ffd8a8; color: #7a4100; }
.alert-info      { background: #e7f1ff; border-color: #b6d4fe; color: #084298; }
.alert-secondary { background: #f1f3f5; border-color: var(--shop-border); color: #333; }

.list-group { display: flex; flex-direction: column; }
.list-group-item {
  background: #fff;
  border: 1px solid var(--shop-border);
  padding: 0.75rem 1rem;
  color: inherit;
  text-decoration: none;
}
.list-group-item + .list-group-item { border-top: none; }
.list-group-item:first-child { border-radius: 4px 4px 0 0; }
.list-group-item:last-child  { border-radius: 0 0 4px 4px; }
a.list-group-item:hover { background: #f8f9fa; text-decoration: none; }
