/* ===== WEEKLY DASHBOARD =====
   Main landing page: 7-column grid of day cards,
   dog rows with status colors, toolbar navigation,
   move-booking modal. Also used by daily dashboard
   for shared classes (dog-row, count-badge, etc.). */


/* ── Week Quick-Nav Buttons ──────────────────────── */

.page-header a.week-quick-nav,
.page-header button.week-quick-nav {
  font-size: .78rem;
  padding: .3rem .7rem;
  min-width: 0;
  letter-spacing: -.01em;
  line-height: 1.3;
}

/* Week selector (KW + year inputs) */
.week-selector {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin: 0;
}
.page-header .week-selector__input {
  width: 3.5rem;
  padding: .3rem .3rem;
  font-size: .78rem;
  line-height: 1.3;
  border: 1px solid var(--brand-green);
  border-radius: 6px;
  text-align: center;
  box-sizing: border-box;
}
.week-selector__input--year {
  width: 4.2rem;
}


/* ── Week Grid ────────────────────────────────────── */

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(180px, 1fr));
  gap: .75rem;
  margin-top: 0.5rem;
  margin-bottom: 2rem;
}

/* Day column (wraps the shift strip + day-card + overnight-card).
   Spacing is margin-based (not `gap`) so the shift strip can sit tight to the
   first card while the stacked cards keep their larger 2rem separation. */
.day-column {
  display: flex;
  flex-direction: column;
}
.day-column > .day-card + .day-card {
  margin-top: 2rem;
}


/* ── Day Card ─────────────────────────────────────── */

.day-card {
  background-color: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 0.5rem .75rem;
  min-height: auto;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: all 0.15s ease-in-out;
  display: flex;
  flex-direction: column;
}

/* Today column highlight */
.day-card.today {
  background-color: #f1f3f5;
  border-color: #ced4da;
  box-shadow: inset 0 0 0 2px #dee2e6;
}
.day-card.today .day-header {
  background-color: #e9ecef;
  border-bottom-color: #ced4da;
}
.day-card.today:hover {
  transform: none;
  box-shadow: inset 0 0 0 2px #adb5bd;
}

.day-card form { margin-top: 0.5rem; }


/* ── Day Header ───────────────────────────────────── */

.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 0.25rem;
}
.day-left {
  display: flex;
  align-items: baseline;
  gap: .25rem;
  font-weight: 600;
}
.day-right {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.day-header .small {
  font-weight: 400;
  color: #6c757d;
}

/* Count badge (shared with daily dashboard) */
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  height: 1.5em;
  padding: 0 .45em;
  border-radius: 5px;
  background: #fff;
  color: #212529;
  font-weight: 700;
  font-size: 0.75rem;
  line-height: 1;
  border: 1px solid #212529;
}

.count-badge--attendant {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #212529;
}


/* ── Dog Row (two-line card per dog) ──────────────── */

.dog-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.4rem;
  background: #f9fafb;
  border: 1px solid #f1f3f5;
  margin-bottom: 0.35rem;
  transition: background 0.2s ease;
  text-align: left;
  font-size: 0.8rem;
}

.row-top, .row-bottom {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: nowrap;
  width: 100%;
}

/* Left text block */
.row-left {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}
.dog-name {
  font-weight: 600;
  line-height: 1.2;
  font-size: clamp(0.75rem, 1.2vw, 0.95rem);
  color: #212529;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  display: block;
}
.dog-name-trial,
a.dog-name.dog-name-trial {
  color: #E28850;
}

/* Dog name as link (no underline, subtle hover) */
a.dog-name {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
a.dog-name:hover {
  color: var(--bs-primary, var(--brand-green, #dee2e6));
  text-decoration: none;
}
a.dog-name.dog-name-trial:hover {
  color: #c06f38;
}

/* Comment indicator */
.dog-comment-indicator {
  color: #dc3545;
  font-weight: 700;
  margin-left: 1px;
}
.customer-name {
  font-weight: 500;
  line-height: 1.2;
  font-size: clamp(0.6rem, 0.85vw, 0.72rem);
  color: #495057;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Right source badge */
.row-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: .15rem;
}
.source-badge {
  font-weight: 600;
  line-height: 1.2;
  font-size: clamp(0.75rem, 1.2vw, 0.95rem);
  color: #212529;
  border-radius: 0.25rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  display: block;
}

/* Moved-from / moved-to date badge */
.moved-date-badge {
  font-weight: 500;
  font-size: clamp(0.6rem, 0.9vw, 0.75rem);
  color: #6c757d;
  white-space: nowrap;
}


/* ── Action Buttons (attend / absent / move) ──────── */

.row-actions {
  display: grid;
  grid-template-columns: 1.35rem 1.35rem 1.35rem;
  gap: 0.25rem;
  justify-items: center;
  align-items: center;
}
.row-actions form {
  display: contents;
  margin: 0;
}

/* Base action button — small pill, matching logout style */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  min-width: 1.35rem;
  min-height: 1.35rem;
  padding: 0;
  margin: 0;
  font-size: .8rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
  background: #fff;
  color: #495057;
  box-shadow: none;
}
.action-btn:hover {
  filter: brightness(0.92);
}

/* Attend (green) */
.action-btn--attend {
  background-color: #d4edda;
  border-color: #b1dfbb;
  color: #256030;
}
.action-btn--attend:hover {
  background-color: #b1dfbb;
  border-color: #8fd4a2;
}

/* Absent (grey) */
.action-btn--absent {
  background-color: #e2e3e5;
  border-color: #cbccce;
  color: #495057;
}
.action-btn--absent:hover {
  background-color: #cbccce;
  border-color: #b0b2b5;
}

/* Move (white) */
.action-btn--move {
  background-color: #fff;
  border-color: #dee2e6;
  color: #495057;
}
.action-btn--move:hover {
  background-color: #f1f3f5;
  border-color: #ced4da;
}


/* ── Weekend column (Sat + Sun + weekly notes) ────── */

/* Occupies the last two columns of the 7-col grid. Stacks the two weekend
   day-columns side by side, with the notes panel directly beneath them — so
   the panel ends just below Sat/Sun, independent of the taller weekday rows. */
.weekend-column {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Status legend, tucked bottom-right below the grid to save vertical space. */
.week-legend {
  display: flex;
  justify-content: flex-end;
  margin-top: -1rem;
  margin-bottom: 1rem;
}

.weekend-days {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  align-items: start;
}

/* ── Weekly notes panel ───────────────────────────── */

.weekly-notes-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: .75rem;
}

.weekly-note {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
  padding: .4rem .5rem;
  background-color: #f7f8f5;
  border: 1px solid var(--border-color, #e3e6df);
  border-radius: .375rem;
}

.weekly-note__body { min-width: 0; flex: 1; }

.weekly-note__text {
  font-size: .9rem;
  word-break: break-word;
  white-space: normal;
}

.weekly-note__meta {
  margin-top: .15rem;
  font-size: .72rem;
  color: #6b7280;
}

.weekly-note__dog {
  font-weight: 700;
  color: var(--brand-green, #667854);
}

.weekly-note__actions {
  display: flex;
  gap: .25rem;
  flex-shrink: 0;
}

.weekly-note__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .2rem;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  border-radius: .25rem;
  line-height: 0;
}

.weekly-note__btn:hover { background-color: #e9ece4; color: #374151; }

.weekly-note__btn--delete:hover { background-color: #fde8e8; color: #c0392b; }

.weekly-note-form {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  border-top: 1px solid var(--border-color, #e3e6df);
  padding-top: .6rem;
}

.weekly-note-form__text { width: 100%; resize: vertical; }

.weekly-note-form__controls {
  display: flex;
  gap: .4rem;
  align-items: center;
}

.weekly-note-form__dog { flex: 1; min-width: 0; }


/* ── Responsive Grid ──────────────────────────────── */

@media (max-width: 1100px) {
  .week-grid { grid-template-columns: repeat(3, 1fr); }
  .weekend-column { grid-column: span 2; }
}
@media (max-width: 700px)  {
  .week-grid { grid-template-columns: 1fr; }
  .weekend-column { grid-column: 1 / -1; }
  .weekend-days { grid-template-columns: 1fr; }
}


/* ── Toolbar (shared with monthly dashboard) ──────── */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* Toolbar group containers */
.toolbar-left,
.toolbar-middle,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 0 0 auto;
}

/* Compact form inputs inside toolbar */
.toolbar .form-control-sm {
  height: calc(1.5em + .5rem + 2px);
  padding: .25rem .4rem;
  font-size: .8rem;
  line-height: 1.2;
}
.toolbar a.btn,
.toolbar button {
  min-width: 2rem;
  text-align: center;
}
.toolbar label {
  margin-bottom: 0;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .toolbar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}


/* ── Status Color Coding ──────────────────────────── */

.dog-row--booked {
  background-color: #ffffff;
  border-color: #dee2e6;
}
.dog-row--attendant {
  background-color: #d4edda;
  border-color: #c3e6cb;
}
.dog-row--absent {
  background-color: #e2e3e5;
  border-color: #d6d8db;
}
.dog-row--cancelled {
  background-color: #f8d7da;
  border-color: #f5c6cb;
}
.dog-row--cancelled .dog-name {
  text-decoration: line-through;
}
.dog-row--planned {
  background-color: #fff3cd;
  border-color: #ffeaa7;
}
.dog-row--paused {
  background-color: #d1ecf1;
  border-color: #bee5eb;
}
.dog-row--paused .dog-name {
  text-decoration: line-through;
}
.dog-name--trial {
  background: transparent;
  color: #E28850;
}

/* Hover states */
.dog-row--booked:hover    { background-color: #f8f9fa; }
.dog-row--attendant:hover { background-color: #c3e6cb; }
.dog-row--absent:hover    { background-color: #d6d8db; }
.dog-row--cancelled:hover { background-color: #f5c6cb; }
.dog-row--planned:hover   { background-color: #ffeaa7; }
.dog-row--paused:hover    { background-color: #bee5eb; }


/* ── Section Separators ───────────────────────────── */

.section-sep {
  border: 0;
  border-top: 3px solid var(--bs-border-color, #dee2e6);
  margin: .35rem 0;
}


/* ── Public Holidays ──────────────────────────────── */

.holiday-row {
  background: #ea9000;
  border: 1px solid #ce8004;
  border-radius: .4rem;
  padding: .4rem .5rem;
  margin-bottom: .35rem;
}
.holiday-row .holiday-name {
  font-weight: 600;
  font-size: .85rem;
  color: #4f3000;
}


/* ── Move Booking Modal ───────────────────────────── */

.move-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.move-modal.move-modal--open {
  display: flex;
}
.move-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.move-modal__dialog {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 0.6rem;
  padding: 1rem 1.25rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.move-modal__header,
.move-modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.move-modal__header {
  margin-bottom: .5rem;
}
.move-modal__title {
  margin: 0;
  font-size: 1rem;
}
.move-modal__body {
  margin: .5rem 0 1rem 0;
}
.move-modal__close {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

/* Prevent page scroll when modal is open */
body.move-modal-open {
  overflow: hidden;
}


/* ── Screen: hide print-only title ── */
.print-title {
  display: none;
}


/* ══════════════════════════════════════
   PRINT / PDF  —  A4 landscape, one page
   ══════════════════════════════════════ */
@media print {

  @page {
    size: A4 landscape;
    margin: 10mm 8mm;
  }

  /* Preserve background colors (status colors) */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    box-shadow: none !important;
    transition: none !important;
  }

  body {
    font-size: 8pt;
    background: #fff !important;
    color: #000 !important;
    margin: 0;
    padding: 0;
  }

  /* Hide: site header + nav */
  .app-header { display: none !important; }

  /* Hide: page-header (title + navigation buttons + week selector) */
  .page-header { display: none !important; }

  /* Hide: legend row */
  .mb-3 { display: none !important; }

  /* Hide: action buttons (attend/absent/move) */
  .row-actions { display: none !important; }

  /* Hide: move booking modal */
  .move-modal { display: none !important; }

  /* Hide: dog popup dialog */
  dialog { display: none !important; }

  /* Show: print-only title */
  .print-title {
    display: block !important;
    font-size: 13pt;
    font-weight: 700;
    margin-bottom: 4mm;
    color: #000;
  }

  /* Page wrapper: remove screen constraints */
  .app-main {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .page {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Week grid: 7 equal columns */
  .week-grid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 2mm !important;
    width: 100% !important;
    margin: 0 !important;
  }

  .day-column {
    gap: 2mm !important;
    break-inside: avoid;
  }

  /* Day card */
  .day-card {
    border: 1px solid #ccc !important;
    border-radius: 2px !important;
    padding: 1.5mm !important;
    background: #fff !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .day-card.today {
    background-color: #f1f3f5 !important;
    border-color: #aaa !important;
  }

  /* Day header */
  .day-header {
    font-size: 7.5pt;
    font-weight: 700;
    padding-bottom: 1mm;
    margin-bottom: 1.5mm;
    border-bottom: 1px solid #ccc !important;
  }
  .day-header .small { font-size: 6.5pt; color: #555 !important; }
  .count-badge {
    font-size: 6pt;
    min-width: 1.2em;
    height: 1.2em;
    padding: 0 2px;
    border: 1px solid #888 !important;
    background: #fff !important;
    color: #000 !important;
  }

  /* Dog rows: compact */
  .dog-row {
    font-size: 6.5pt;
    padding: 0.8mm 1mm !important;
    margin-bottom: 0.8mm !important;
    border-radius: 1px !important;
  }
  .row-top, .row-bottom { gap: 0 !important; }

  /* Dog name */
  a.dog-name, a.dog-link {
    color: #000 !important;
    text-decoration: none !important;
  }
  .dog-row--cancelled a.dog-name,
  .dog-row--paused   a.dog-name { text-decoration: line-through !important; }

  .customer-name { font-size: 5.5pt !important; color: #444 !important; }
  .source-badge  { font-size: 5.5pt !important; color: #333 !important; }
  .moved-date-badge { font-size: 5pt !important; color: #555 !important; }

  /* Status background colors (explicit for print engines) */
  .dog-row--booked    { background-color: #ffffff !important; border-color: #ccc !important; }
  .dog-row--attendant { background-color: #d4edda !important; border-color: #b2d8bb !important; }
  .dog-row--absent    { background-color: #e2e3e5 !important; border-color: #ccc !important; }
  .dog-row--cancelled { background-color: #f8d7da !important; border-color: #f0b8be !important; }
  .dog-row--planned   { background-color: #fff3cd !important; border-color: #ffe59e !important; }
  .dog-row--paused    { background-color: #d1ecf1 !important; border-color: #aadde6 !important; }

  /* Holiday row */
  .holiday-row {
    background-color: #ea9000 !important;
    border-radius: 1px !important;
    padding: 0.8mm 1mm !important;
    margin-bottom: 0.8mm !important;
  }
  .holiday-name { font-size: 6.5pt !important; color: #3d2400 !important; }

  /* Section separator */
  .section-sep { border-top: 1px solid #bbb !important; margin: 0.8mm 0 !important; }

  /* Comment indicator */
  .dog-comment-indicator { color: #c00 !important; }

} /* end @media print */
