/* =========================================================
   CALENDAR HEADER
   ========================================================= */
.calendar-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  min-height: 56px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-light, #d0d0d0);
}

.calendar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-controls button,
.calendar-view-toggle button {
  height: 34px;
  min-width: 34px;
  padding: 6px 12px;
  font-size: 14px;
  white-space: nowrap;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-view-toggle {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.calendar-view-active {
  background: var(--btn-bg);
  color: var(--btn-text);
}

/* =========================================================
   CALENDAR BODY
   ========================================================= */
#calendarBody {
  overflow: auto;
}

/* =========================================================
   SHARED GRID BORDER STYLE (MONTH / WEEK / DAY)
   ========================================================= */
.calendar-month-table,
.calendar-week-table,
.calendar-day-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border: 1px solid #999;
  /* unified outer border */
}

.calendar-month-table th,
.calendar-month-table td,
.calendar-week-table th,
.calendar-week-table td,
.calendar-day-table th,
.calendar-day-table td {
  border: 1px solid #999;
  /* unified grid lines */
}

/* Shared header style */
.calendar-month-table thead th,
.calendar-week-table thead th,
.calendar-day-table thead th {
  background: #f7f7f7;
  font-weight: 600;
  border-bottom: 2px solid #888;
  /* unified header line */
}

/* =========================================================
   MONTH VIEW — EVEN ROW HEIGHTS
   ========================================================= */
.calendar-month-table thead th {
  text-align: center;
  padding: 2px 4px;
  font-size: 13px;
  line-height: 1;
  height: 22px;
}

.calendar-month-table tbody tr td {
  height: calc((100vh - 200px) / 5);
  vertical-align: top;
  padding: 6px;
}

.calendar-month-table td.empty {
  background: transparent;
}

/* =========================================================
   WEEK VIEW — 24 HOURS
   ========================================================= */
.week-time {
  width: 55px;
  min-width: 55px;
  max-width: 55px;
  text-align: right;
  padding-right: 6px;
  font-size: 13px;
  color: #555;
  white-space: nowrap;
}

/* =========================================================
   DAY VIEW — 24 HOURS + NARROW TIME COLUMN
   ========================================================= */
.calendar-day-time {
  width: 55px;
  min-width: 55px;
  max-width: 55px;
  text-align: right;
  padding-right: 6px;
  font-size: 13px;
  color: #555;
  white-space: nowrap;
}

/* =========================================================
   DAY NUMBER + TODAY HIGHLIGHT
   ========================================================= */
.calendar-day-number {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.calendar-today {
  outline: 2px solid var(--btn-bg);
  outline-offset: -2px;
  border-radius: 6px;
}

.calendar-today .calendar-day-number {
  font-weight: bold;
}

/* =========================================================
   EVENT BLOCKS
   ========================================================= */
.calendar-event {
  display: block;
  margin: 2px 0;
  line-height: 1.2;
  font-size: 13px;
  padding-left: 0;
  color: inherit;
}

.calendar-event-PENDING {
  color: #B8860B !important;
}

.calendar-event-IN_PROGRESS {
  color: #1E3A8A !important;
}

.calendar-event-ON_HOLD {
  color: #CC5500 !important;
}

.calendar-event-COMPLETED {
  color: #0F9D58 !important;
}

/* =========================================================
   HOVER BEHAVIOUR
   ========================================================= */
.calendar-month-table tbody tr:hover {
  background: transparent !important;
}

.calendar-month-table td:hover {
  background: #f5f5f5;
}

[data-theme="dark"] .calendar-month-table td:hover {
  background: #2d3748;
}

.calendar-controls a,
.calendar-view-toggle a {
  text-decoration: none;
}

.calendar-controls a:hover,
.calendar-view-toggle a:hover {
  text-decoration: none;
}

.category-option {
  display: flex;
  align-items: center;
  gap: 6px;
}

.category-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.category-select option[data-color] {
  color: #000;
  /* text colour */
}

.category-select option[data-color]::before {
  content: "■ ";
  color: attr(data-color color);
}