/* ===== General ===== */
body {
  background-color: #f5f6fa;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ===== Button XS ===== */
.btn-xs {
  padding: 0.1rem 0.35rem;
  font-size: 0.72rem;
  line-height: 1.4;
  border-radius: 3px;
}

/* ===== Planning table ===== */
.planning-table {
  font-size: 0.85rem;
  border-collapse: separate;
  border-spacing: 0;
}

/* Re-apply borders lost by switching away from border-collapse:collapse */
.planning-table th,
.planning-table td {
  border: 1px solid #111;
}

.planning-table thead th {
  background-color: #212529; /* table-dark; explicit so cells don't show through */
  border-bottom-width: 2px;
}

/* Sticky thead inside the scroll wrapper (overflow: auto on both axes) */
.planning-sticky-head th {
  position: sticky;
  top: 0;
  z-index: 4;
  background-color: #212529;
  color: #fff;
}

.planning-scroll-wrapper {
  overflow: auto;
  max-height: calc(100vh - 170px);
}

/* Header table sits above the scroll wrapper; no longer needed but kept for safety */
.planning-header-table {
  margin-bottom: 0;
}

/* Crew column header — draggable */
.crew-col-header {
  white-space: nowrap;
  user-select: none;
}

.crew-col-header:not([data-crew-col="unassigned"]) {
  cursor: grab;
}

.crew-col-header:not([data-crew-col="unassigned"]):active {
  cursor: grabbing;
}

/* ===== Holiday badge on dashboard ===== */
.holiday-badge {
  display: inline-block;
  font-size: 0.68rem;
  padding: 1px 5px;
  border-radius: 3px;
  background-color: #e74c3c;
  color: white;
  margin-right: 3px;
  margin-top: 2px;
  white-space: nowrap;
}

/* ===== Continuation indicator for multi-week projects ===== */
.project-card.continuation {
  opacity: 0.75;
  border-left: 4px solid rgba(255,255,255,0.5);
}

/* ===== Notification badge ===== */
.notif-badge {
  font-size: 0.65rem;
  padding: 0.15em 0.45em;
  border-radius: 999px;
  background: #e74c3c;
  color: white;
  vertical-align: top;
  margin-left: 2px;
}

.week-number-cell {
  font-size: 0.85rem;
  vertical-align: middle;
  background-color: #f8f9fa;
  min-width: 50px;
}

.week-active .week-number-cell {
  background-color: #e8f4fd;
}

.week-empty td {
  padding-top: 3px;
  padding-bottom: 3px;
  opacity: 0.55;
  background-color: #fafafa;
}

.week-empty .projects-cell {
  height: 28px;
  min-height: unset;
}

.week-active td {
  padding-top: 5px;
  padding-bottom: 5px;
}

/* ===== Current week highlight ===== */
.week-current td {
  background-color: rgba(255, 193, 7, 0.07) !important;
}

.week-current .week-number-cell {
  background-color: rgba(255, 193, 7, 0.28) !important;
  border-left: 3px solid #ffc107 !important;
}

/* Current-week highlight for list-style views (crew / client) */
tr.week-current-row > td {
  background-color: rgba(255, 193, 7, 0.10) !important;
}

tr.week-current-row > td:first-child {
  border-left: 3px solid #ffc107;
}

.projects-cell {
  padding: 4px 6px !important;
}

/* ===== Project card ===== */
.project-card {
  border-radius: 6px;
  padding: 7px 8px;
  color: white;
  font-size: 0.8rem;
  min-width: 220px;
  max-width: 320px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.project-card[data-row-link] {
  cursor: pointer;
}

.excavator-inline-icon {
  width: 14px;
  height: 14px;
  margin-left: 3px;
  object-fit: contain;
  vertical-align: -2px;
}

.project-client-name {
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.project-title-text {
  font-size: 0.82rem;
  line-height: 1.3;
}

.project-location {
  font-size: 0.75rem;
  opacity: 0.85;
}

/* ===== Crew select inside card ===== */
.crew-select {
  font-size: 0.72rem;
  padding: 0.15rem 1.5rem 0.15rem 0.4rem;
  background-color: rgba(255,255,255,0.2);
  color: white;
  border-color: rgba(255,255,255,0.4);
  border-radius: 4px;
}

.crew-select option {
  color: #333;
  background-color: white;
}

/* ===== Checkbox buttons on cards ===== */
.checkbox-btn {
  font-size: 0.72rem;
  border-color: rgba(255,255,255,0.5);
  color: white;
  background-color: rgba(211, 84, 0, 0.75);
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
}

.checkbox-btn.checked {
  background-color: rgba(39, 174, 96, 0.85);
  border-color: rgba(255,255,255,0.7);
  color: white;
}

.checkbox-btn:hover {
  background-color: rgba(255,255,255,0.2);
  color: white;
}

/* ===== Add week button ===== */
.add-week-btn {
  color: #adb5bd;
  text-decoration: none;
  font-size: 1.1rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

.add-week-btn:hover {
  color: #495057;
}

/* ===== Week-item (Weekmelding) banner on dashboard ===== */
.week-item-banner {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 4px;
  background-color: #e67e22;
  color: white;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  white-space: normal;
  margin-top: 1px;
}

.week-item-icon {
  flex-shrink: 0;
}

.week-item-title {
  font-weight: 600;
}

/* ===== Crew unassigned badge ===== */
.crew-unassigned {
  background-color: #95a5a6 !important;
}

/* ===== Crew filter buttons ===== */
.crew-filter-btn {
  font-size: 0.78rem;
  padding: 0.2rem 0.7rem;
  border-width: 2px;
  opacity: 0.7;
  transition: opacity 0.15s, box-shadow 0.15s;
}

.crew-filter-btn.active {
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.15);
}

.crew-filter-btn[data-crew-id="all"].active {
  background-color: #343a40;
  color: white;
}

.crew-filter-btn[data-crew-id="unassigned"] {
  color: #6c757d;
}

.crew-filter-btn[data-crew-id="unassigned"].active {
  background-color: #95a5a6;
  color: white;
}

/* ===== Login page ===== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* ===== Navbar ===== */
.navbar-brand {
  font-size: 1.1rem;
}

/* ===== Cards ===== */
.card {
  border: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* ===== Tables ===== */
.table-hover tbody tr:hover {
  background-color: rgba(0,0,0,0.03);
}

.clickable-row {
  cursor: pointer;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .project-card {
    min-width: 150px;
    max-width: 220px;
  }
}

/* ===== Te plannen drag-drop ===== */
.unplanned-row.dragging {
  opacity: 0.45;
}

.drag-handle {
  cursor: grab;
}

/* ===== Checklist template list drag-drop ===== */
.template-row.dragging {
  opacity: 0.45;
}

/* ===== Project detail checklist ===== */
.checklist-yesno-btn {
  min-width: 50px;
}

/* ===== Checklist group ===== */
.checklist-group {
  border: 2px solid #000;
  border-radius: 6px;
  margin-bottom: 0;
}

.checklist-group-header-row {
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.checklist-group-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 12px;
  background-color: #212529;
  color: #fff;
  border-radius: 4px 4px 0 0;
}

.checklist-group-label--incomplete {
  background-color: #ff4500;
}

.settings-icon-preview {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: -3px;
}

/* ===== Project card drag-drop within week cell ===== */
.project-card[data-sortable-card] {
  cursor: grab;
}

.project-card[data-sortable-card]:active {
  cursor: grabbing;
}

/* ===== Checklist sub-questions ===== */
.checklist-subquestions {
  border-left: 3px solid #6f42c1;
  margin-left: 8px;
  background-color: rgba(111, 66, 193, 0.04);
}

/* ===== Checklist date picker ===== */
.checklist-date-picker {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  width: 240px;
  padding: 6px;
  background: #fff;
}

.checklist-date-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.checklist-date-picker-title {
  font-size: 0.78rem;
  font-weight: 600;
}

.checklist-date-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.checklist-date-grid th,
.checklist-date-grid td {
  text-align: center;
  padding: 1px;
}

.checklist-date-grid .week-label {
  width: 28px;
  font-size: 0.66rem;
  color: #6c757d;
  font-weight: 700;
}

.checklist-date-grid .day-btn {
  width: 26px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-size: 0.72rem;
}

.checklist-date-grid .day-btn:hover {
  background: #e9ecef;
}

.checklist-date-grid .day-btn.active {
  background: #198754;
  color: #fff;
}

.checklist-date-grid .day-btn.today {
  outline: 1px solid #0d6efd;
}

/* Planner note editor */
#plannerNoteEditor[contenteditable="true"] {
  cursor: text;
  border-radius: 4px;
  padding: 4px;
  transition: background 0.1s;
}

#plannerNoteEditor[contenteditable="true"]:hover {
  background: #fffef5;
}

#plannerNoteEditor[contenteditable="true"]:focus {
  background: #fffef5;
  box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.35);
  border-radius: 4px;
}

#plannerNoteEditor[contenteditable="true"]:empty::before {
  content: attr(data-placeholder);
  color: #adb5bd;
  pointer-events: none;
}

#plannerNoteEditor img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Printable project folder (A3 landscape) */
.print-folder-page {
  width: 420mm;
  min-height: 297mm;
  margin: 0 auto 20px auto;
  padding: 8mm;
  background: #fff;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8mm;
  color: #111;
}

.print-folder-left,
.print-folder-right {
  display: flex;
  flex-direction: column;
  gap: 6mm;
}

.print-folder-logo-space {
  border: 1px solid #9fb4c9;
  min-height: 40mm;
  padding: 3mm;
}

.print-folder-logos {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  height: 100%;
  min-height: 34mm;
}

.print-folder-logo-img {
  max-height: 34mm;
  max-width: 80mm;
  object-fit: contain;
}

.print-folder-section-title {
  font-size: 12px;
  font-weight: 700;
}

.print-folder-blue-title {
  background: #176bb3;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  padding: 2mm 3mm;
}

.print-folder-checklist-wrap {
  border: 1px solid #9fb4c9;
  flex: 1;
  overflow: hidden;
}

.print-folder-checklist-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.print-folder-checklist-cols .print-folder-checklist-table {
  border-left: none;
}

.print-folder-checklist-cols .print-folder-checklist-table:first-child {
  border-right: 1px solid #c6d3df;
}

.print-folder-checklist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.print-folder-checklist-table th,
.print-folder-checklist-table td {
  border: 1px solid #c6d3df;
  padding: 1.5mm 2mm;
  vertical-align: top;
}

.print-folder-checklist-table th {
  background: #f1f6fb;
  font-weight: 700;
}

.print-folder-checklist-table .print-folder-group-row td {
  background: #dfeaf5;
  font-weight: 700;
}

.print-folder-sub-item {
  padding-left: 6mm !important;
}

.print-folder-resource-info {
  display: block;
  font-size: 9px;
  color: #555;
  margin-top: 0.5mm;
}

.print-folder-right-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5mm;
}

.print-folder-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.print-folder-info-table th,
.print-folder-info-table td {
  border: 1px solid #c6d3df;
  padding: 1.5mm 2mm;
  vertical-align: top;
}

.print-folder-info-table th {
  width: 36%;
  background: #f1f6fb;
  font-weight: 700;
}

.print-folder-approval-box {
  border: 2px solid #cc3f73;
  min-height: 62mm;
  padding: 3mm;
  font-size: 12px;
}

.print-folder-write-row {
  min-height: 13mm;
  border-bottom: 1px solid #e5e5e5;
  padding-top: 1mm;
}

.print-folder-write-row:last-child {
  border-bottom: none;
}

.print-folder-right-bottom {
  border: 1px solid #9fb4c9;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.print-folder-note-content {
  min-height: 80mm;
  padding: 3mm;
  font-size: 12px;
  line-height: 1.45;
  border-bottom: 1px solid #dce6ef;
  white-space: normal;
  word-break: break-word;
}

.print-folder-note-content img {
  max-width: 100%;
  height: auto;
  border-radius: 3px;
  margin: 2mm 0;
}

.print-folder-images-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3mm;
  padding: 3mm;
}

.print-folder-image-tile {
  border: 1px solid #dce6ef;
  padding: 1.5mm;
  min-height: 34mm;
  display: flex;
  align-items: center;
  justify-content: center;
}

.print-folder-image-tile img {
  max-width: 100%;
  max-height: 60mm;
  object-fit: contain;
}

@media print {
  @page {
    size: A3 landscape;
    margin: 8mm;
  }

  body {
    background: #fff !important;
  }

  .print-folder-screen-controls,
  .navbar,
  .container.mt-4 {
    display: none !important;
  }

  .print-folder-page {
    margin: 0;
    padding: 0;
    width: 404mm;   /* 420mm - 2 × 8mm margins */
    height: 281mm;  /* 297mm - 2 × 8mm margins */
    min-height: unset;
    max-height: 281mm;
    box-shadow: none;
    overflow: hidden;
    page-break-after: avoid;
    break-after: avoid;
  }

  .print-folder-left,
  .print-folder-right {
    overflow: hidden;
    max-height: 281mm;
  }

  .print-folder-checklist-wrap {
    overflow: hidden;
  }

  .print-folder-blue-title {
    font-size: 12px;
    padding: 1mm 2mm;
  }

  .print-folder-checklist-table {
    font-size: 9px;
  }

  .print-folder-checklist-table th,
  .print-folder-checklist-table td {
    padding: 0.7mm 1.5mm;
  }

  .print-folder-logo-space {
    min-height: 28mm;
  }

  .print-folder-logos {
    min-height: 22mm;
  }

  .print-folder-logo-img {
    max-height: 22mm;
  }

  .print-folder-approval-box {
    min-height: 48mm;
    font-size: 10px;
  }

  .print-folder-write-row {
    min-height: 10mm;
  }

  .print-folder-note-content {
    min-height: 50mm;
    font-size: 10px;
  }

  .print-folder-info-table {
    font-size: 9px;
  }

  .print-folder-info-table th,
  .print-folder-info-table td {
    padding: 0.7mm 1.5mm;
  }
}
