/* ===== PAGE-LEVEL STYLES =====
   Shared styles used across multiple pages: badges, grids,
   page headers, row states, form layouts, contract partials. */

/* ── Dog detail grid (single grid spanning all rows incl. photo) ────── */
/* Pin dt/dd to explicit columns so auto-placement never spills into the
   photo column (col 3) after the photo's row-span ends.
   Separator dd elements override grid-column via their inline style. */
.dog-detail-grid > dt { grid-column: 1; }
.dog-detail-grid > dd { grid-column: 2; }

/* ── Truncated note with CSS tooltip ─────────────── */

.truncated-note {
  cursor: default;
  position: relative;
  white-space: nowrap;
}

.truncated-note::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #f9fafb;
  font-size: .8rem;
  font-weight: 400;
  line-height: 1.4;
  padding: .35rem .6rem;
  border-radius: .3rem;
  white-space: pre-wrap;
  max-width: 260px;
  width: max-content;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
  z-index: 100;
}

.truncated-note:hover::after {
  opacity: 1;
}

/* ── Nowrap utility ───────────────────────────────── */

.nowrap { white-space: nowrap; }


/* ── Badges ───────────────────────────────────────── */

.badge {
  display: inline-block;
  margin-left: .5rem;
  padding: .1rem .4rem;
  font-size: .75rem;
  font-weight: 600;
  border-radius: .3rem;
  background: #f3f4f6;
  color: #6b7280;
}

/* Green info badge (warnings on extra/holiday booking lists) */
.badge-info {
  background: var(--brand-green);
  color: white;
}

/* Small pill for archived items */
.badge-archived {
  display: inline-block;
  margin-left: .4rem;
  padding: .1rem .4rem;
  font-size: .75rem;
  border-radius: .75rem;
  border: 1px solid #888;
  text-transform: uppercase;
}


/* ── Table Utilities ──────────────────────────────── */

th.border-left { border-left: 2px solid #556646; }
td.border-left { border-left: 2px solid #556646; }


/* ── Row State Modifiers ──────────────────────────── */

/* Archived row (reduced opacity) */
.row-archived { opacity: 0.6; }

/* Cancelled booking (faded + strikethrough) */
.cancelled-booking {
  opacity: 0.55;
  text-decoration: line-through;
}

/* Danger modifier for destructive buttons */
.danger { border-color: #fca5a5; color: #b91c1c; }

/* Text colour utilities */
.text-danger { color: #b91c1c; }
.text-muted  { color: #888; }


/* ── Page Header (title + action buttons) ─────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: 1rem;
  margin-bottom: .75rem;
}
.page-header h2 { margin: 0; font-size: 1.25rem; line-height: 1.2; }
.page-header .actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.page-header > .actions {
  display: flex;
  gap: .5rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* Prevent buttons inside page-header from stretching full width */
.page-header > .actions button,
.page-header > .actions a[role="button"] {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-width: 0;
}


/* ── List Filter Bar (green bar below page-header) ── */

.list-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .5rem 1rem;
  margin: 0 0 .75rem;
  background: var(--brand-green-light);
  border-radius: 6px;
  font-size: .875rem;
  flex-wrap: wrap;
}

.list-filter-bar form {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  flex-wrap: nowrap;
  flex: 1;
}

.list-filter-bar input[type="search"] {
  width: 16rem;
  max-width: 16rem;
  flex: 0 0 16rem;
  padding: .3rem .5rem;
  font-size: .85rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.list-filter-bar select {
  padding: .3rem .4rem;
  font-size: .85rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  max-width: 130px;
}

.list-filter-bar button[type="submit"] {
  font-size: .78rem;
  padding: .3rem .55rem;
}

/* Filter groups push to the right */
.list-filter-bar .filter-groups {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.list-filter-bar .filter-group {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
}

/* Button-style filter links (like invoicing quick-nav) */
.list-filter-bar .filter-group a {
  display: inline-flex;
  align-items: center;
  font-size: .78rem;
  padding: .3rem .55rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  line-height: 1.3;
  transition: background-color .15s, color .15s;
  background: var(--brand-green-light);
  color: #111;
  border: 1px solid var(--brand-green);
}

.list-filter-bar .filter-group a:hover {
  background: var(--brand-green-light-hover);
}

.list-filter-bar .filter-group a.active {
  background: var(--brand-green);
  color: #fff;
  font-weight: 600;
  border-color: var(--brand-green);
}

.list-filter-bar .filter-group a.active:hover {
  background: var(--brand-green-hover);
}

.list-filter-bar .filter-sep {
  color: #999;
  margin: 0 .1rem;
  font-size: .8rem;
}

.list-filter-bar .filter-label {
  font-weight: 600;
  color: #555;
  font-size: .8rem;
  margin-right: .1rem;
}

.list-filter-bar .form-check {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .82rem;
}


/* ── Form Grid Layouts ────────────────────────────── */

.grid_customer_form {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .6rem;
  margin-bottom: .5rem;
}

.grid_regular_contract_form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
  margin-bottom: .5rem;
}

.grid_extra_booking_form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
  margin-bottom: .5rem;
}

.grid_extra_booking_row {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: .6rem;
  margin-bottom: .5rem;
  align-items: end;
}

/* Generic multi-column grids */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: end;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  align-items: end;
}

.grid-4-ext {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 2fr;
  gap: 1rem;
  align-items: center;
}

.grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 1rem;
  align-items: end;
}

.grid-5-ext {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 2fr;
  gap: 1rem;
  align-items: center;
}

.grid-6-ext {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr 2fr;
  gap: 1rem;
  align-items: center;
}

.grid-5 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
  gap: 1rem;
  justify-items: center;
  align-items: center;
  text-align: center;
}

.col-span-2 { grid-column: span 2; }


/* ── Contract Detail Partial ──────────────────────── */
/* Used in _regular_contracts_for_customer_partial.html */

.contracts-header {
  margin-top: 0;
  background: transparent;
}

.contract-dog-name {
  margin: 0 0 0.25rem 0;
  font-size: 1.2rem;
}

.contracts-section {
  margin-bottom: 1.25rem;
}

.contract-separator {
  margin: 0.6rem 0;
  border: none;
  border-top: 1px solid #eee;
}

.contracts-table {
  width: 100%;
  font-size: 0.9rem;
  border-collapse: collapse;
  background: transparent;
}

.contracts-table th,
.contracts-table td {
  background: transparent;
  border: none;
  padding: 0.15rem 0.5rem 0.15rem 0;
}

.contracts-table th {
  text-align: left;
  white-space: nowrap;
}

.contracts-table td {
  padding-left: 0;
}


/* ── Pause day calendar grid ──────────────────────── */
/* Used on the contract pause create form              */

.pause-grid-wrapper {
  overflow-x: auto;
}

.pause-grid {
  border-collapse: collapse;
  font-size: .88rem;
  min-width: 560px;
}

.pause-grid th,
.pause-grid td {
  border: 1px solid #dee2e6;
  padding: 5px 10px;
  text-align: left;
  vertical-align: middle;
  min-width: 0;
}

.pause-grid th.pause-grid-week,
.pause-grid td.pause-grid-week {
  min-width: 88px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pause-grid thead th {
  background: var(--brand-green-light);
  font-weight: 600;
}

/* Highlight the current week row */
.pause-grid-current-week td {
  background: #fffce8;
}

/* ── Two-cell day layout ──────────────────────────── */
/* Each weekday column is split into two adjacent tds: */
/*   .pause-grid-check  – narrow checkbox cell         */
/*   .pause-grid-date   – date text cell               */
/* No border between them so they read as one unit.    */

/* Checkbox sub-cell: narrow, no right border */
.pause-grid td.pause-grid-check,
.pause-grid th.pause-grid-check {
  width: 22px;
  padding: 5px 2px 5px 8px;
  border-right: none;
  text-align: center;
}

/* Date sub-cell: no left border */
.pause-grid td.pause-grid-date,
.pause-grid th.pause-grid-date {
  min-width: 72px;
  padding: 5px 8px 5px 4px;
  border-left: none;
  white-space: nowrap;
}

/* Clickable date label for available days */
.pause-grid-date label {
  cursor: pointer;
  margin: 0;
  font-weight: normal;
}

/* Non-selectable day — greyed out with reason in brackets */
/* font-size intentionally NOT overridden so all cells match */
.pause-grid-blocked {
  color: #999;
  white-space: nowrap;
}


/* ── Dog form: checkbox wrapper ──────────────────────── */
/* Gives checkbox-only cells the same visual height as   */
/* adjacent select/text inputs so the grid rows match.   */
.checkbox-field {
  height: 2.1rem;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}


/* ── Customer list table ──────────────────────────── */

.customer-list-table td {
  border-bottom: 1px solid #e5e7eb;
}

.customer-list-table tr:nth-child(even) {
  background-color: transparent;
}

.customer-list-table tr:hover {
  background-color: #f5f5f5;
}
