/* Allocation Cell Styling */
/* This file handles the visual styling for allocation cells in the planner */
/* Includes: overbooked allocations, blocked dates, and cell states */

/* ============================================ */
/* BASE CELL STYLING */
/* ============================================ */

.timesheet-cell.cell-filled {
  background-color: rgba(13, 110, 253, 0.08) !important;
  color: #6c757d !important;
  font-weight: normal;
}

.timesheet-cell.cell-partial {
  background-color: #f8f9fa !important;
  color: #6c757d !important;
}

/* ============================================ */
/* BLOCKED DATES - CELL BACKGROUNDS */
/* ============================================ */

.timesheet-cell.bg-success-subtle {
  background-color: rgba(25, 135, 84, 0.15) !important;
  color: #198754 !important;
}

.timesheet-cell.bg-warning-subtle {
  background-color: rgba(255, 193, 7, 0.15) !important;
  color: #856404 !important;
}

.timesheet-cell.bg-primary-subtle {
  background-color: rgba(13, 110, 253, 0.15) !important;
  color: #0d6efd !important;
}

.timesheet-cell.bg-info-subtle {
  background-color: rgba(13, 202, 240, 0.15) !important;
  color: #0dcaf0 !important;
}

.timesheet-cell.bg-danger-subtle {
  background-color: rgba(220, 53, 69, 0.15) !important;
  color: #dc3545 !important;
}

.timesheet-cell.bg-secondary-subtle {
  background-color: rgba(108, 117, 125, 0.15) !important;
  color: #6c757d !important;
}

/* ============================================ */
/* BLOCKED DATES - FULL DAY BADGES */
/* ============================================ */

.blocked-tag {
  font-weight: bold;
  font-size: 0.85em;
  cursor: pointer;
}

.blocked-tag.bg-success {
  background-color: #198754 !important;
  color: white !important;
}

.blocked-tag.bg-warning {
  background-color: #ffc107 !important;
  color: #000 !important;
}

.blocked-tag.bg-primary {
  background-color: #0d6efd !important;
  color: white !important;
}

.blocked-tag.bg-info {
  background-color: #0dcaf0 !important;
  color: white !important;
}

.blocked-tag.bg-danger {
  background-color: #dc3545 !important;
  color: white !important;
}

.blocked-tag.bg-light {
  background-color: #f8f9fa !important;
  color: #000 !important;
}

/* ============================================ */
/* OVERBOOKED ALLOCATIONS */
/* ============================================ */

/* Overbooked cells - red background by default (when reserved are visible) */
.timesheet-cell.cell-overbooked-all {
  background-color: rgba(220, 53, 69, 0.1) !important;
  color: #6c757d !important;
}

/* Override cell-filled background when overbooked */
.timesheet-cell.cell-overbooked-all.cell-filled {
  background-color: rgba(220, 53, 69, 0.1) !important;
  color: #6c757d !important;
  font-weight: bold;
}

/* Override cell-partial background when overbooked */
.timesheet-cell.cell-overbooked-all.cell-partial {
  background-color: rgba(220, 53, 69, 0.1) !important;
  color: #6c757d !important;
}

/* Show overbooked warning icon by default when overbooked */
.timesheet-cell.cell-overbooked-all .overbooked-warning-all,
.timesheet-cell.cell-overbooked-non-reserved .overbooked-warning-all {
  display: inline !important;
}

.timesheet-cell .overbooked-warning-non-reserved {
  display: none !important;
}

/* ============================================ */
/* WHEN RESERVED ALLOCATIONS ARE HIDDEN */
/* ============================================ */

/* Show blue background for cells that have allocations but they're all hidden (reserved) */
body.hide-reserved-allocations .timesheet-cell.cell-filled[data-non-reserved-hours="0"],
body.hide-reserved-allocations .timesheet-cell.cell-filled[data-non-reserved-hours="0.0"] {
  background-color: rgba(13, 110, 253, 0.08) !important;
  color: #6c757d !important;
}

/* If overbooked only due to reserved (has cell-overbooked-all but NOT cell-overbooked-non-reserved) */
/* Remove red background and restore appropriate background based on content */
body.hide-reserved-allocations .timesheet-cell.cell-overbooked-all:not(.cell-overbooked-non-reserved) {
  background-color: rgba(13, 110, 253, 0.08) !important;
  color: #6c757d !important;
}

body.hide-reserved-allocations .timesheet-cell.cell-overbooked-all:not(.cell-overbooked-non-reserved).cell-filled {
  background-color: rgba(13, 110, 253, 0.08) !important;
  color: #6c757d !important;
  font-weight: normal;
}

body.hide-reserved-allocations .timesheet-cell.cell-overbooked-all:not(.cell-overbooked-non-reserved).cell-partial {
  background-color: rgba(13, 110, 253, 0.08) !important;
  color: #6c757d !important;
}

/* Special case: if cell has 0 non-reserved hours, it should be white/empty looking */
body.hide-reserved-allocations .timesheet-cell.cell-overbooked-all:not(.cell-overbooked-non-reserved)[data-non-reserved-hours="0"],
body.hide-reserved-allocations .timesheet-cell.cell-overbooked-all:not(.cell-overbooked-non-reserved)[data-non-reserved-hours="0.0"] {
  background-color: white !important;
  color: #000 !important;
}

/* Hide the "all" warning icon and show the "non-reserved" warning icon when reserved are hidden */
body.hide-reserved-allocations .timesheet-cell .overbooked-warning-all {
  display: none !important;
}

body.hide-reserved-allocations .timesheet-cell.cell-overbooked-non-reserved .overbooked-warning-non-reserved {
  display: inline !important;
}

/* If overbooked with non-reserved allocations, keep red background */
body.hide-reserved-allocations .timesheet-cell.cell-overbooked-non-reserved {
  background-color: rgba(220, 53, 69, 0.1) !important;
  color: #6c757d !important;
}

body.hide-reserved-allocations .timesheet-cell.cell-overbooked-non-reserved.cell-filled {
  background-color: rgba(220, 53, 69, 0.1) !important;
  color: #6c757d !important;
  font-weight: bold;
}

body.hide-reserved-allocations .timesheet-cell.cell-overbooked-non-reserved.cell-partial {
  background-color: rgba(220, 53, 69, 0.1) !important;
  color: #6c757d !important;
}

