/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  height: var(--header-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.month-nav {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.month-nav button {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.month-nav button:hover {
  background: var(--card);
}

.month-label {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  min-width: 160px;
  text-align: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.view-toggle {
  display: flex;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.view-toggle button {
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.15s;
  color: var(--text-light);
}

.view-toggle button.active {
  background: white;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.btn-icon:hover {
  background: var(--card);
}

/* Z-index layers:
   0-99:   Content (cards, cells)
   100:    Header (sticky)
   1000:   Modals + modal overlay
   1001:   Settings drawer
   2000:   Toasts
*/

/* Calendar Grid */
.calendar-container {
  padding: var(--space-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  position: relative;
}

.calendar-container .calendar-grid {
  scroll-snap-align: start;
}

.calendar-grid {
  display: grid;
  gap: 1px;
  background: var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-width: fit-content;
}

/* Day headers row */
.day-headers {
  display: contents;
}

.day-header {
  background: var(--card);
  padding: var(--space-sm) var(--space-md);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-light);
}

.day-header .date-num {
  display: block;
  font-family: var(--font-heading);
  font-size: 13px;
  color: var(--text);
  margin-top: 2px;
  font-weight: 400;
}

/* Today (monthly): bold day name + a filled date pill on its own line,
   so it stands out rather than looking greyed out */
.day-header.today {
  color: var(--text);
}

.day-header.today .date-num {
  display: table;
  margin: 2px auto 0;
  background: var(--accent);
  color: white;
  font-weight: 700;
  border-radius: 10px;
  padding: 0 6px;
  white-space: nowrap;
}

/* Content type row labels */
.row-label {
  background: var(--card);
  padding: var(--space-sm) var(--space-md);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-width: 100px;
  writing-mode: horizontal-tb;
}

.row-label .icon {
  font-size: 14px;
}

/* Corner cell */
.corner-cell {
  background: var(--card);
}

/* Calendar cells */
.calendar-cell {
  background: white;
  padding: var(--space-sm);
  min-height: 80px;
  min-width: var(--cell-min-width);
  transition: background 0.15s;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.calendar-cell:hover {
  background: #FEFCFB;
}

.calendar-cell.rest-day {
  background: var(--rest-day);
}

.calendar-cell.rest-day:hover {
  background: #EBE5E1;
}

.calendar-cell.drag-over {
  background: rgba(139, 158, 139, 0.08);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

.calendar-cell .add-btn {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 14px;
  color: var(--text-light);
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-cell:hover .add-btn {
  opacity: 1;
}

.calendar-cell .add-btn:hover {
  background: var(--card);
  color: var(--accent);
}

/* Week separator in monthly view */
.week-separator {
  grid-column: 1 / -1;
  height: 0;
}

/* Monthly view: compact grid */
.view-monthly .calendar-grid {
  grid-template-columns: 100px repeat(7, minmax(var(--cell-min-width), 1fr));
}

.view-monthly .calendar-cell {
  min-height: 70px;
}

/* Weekly view: vertical layout (days as rows, types as columns) */
.view-weekly .calendar-grid {
  min-width: 0;
}

.view-weekly .calendar-cell {
  min-height: 80px;
  min-width: 0;
}

/* Column headers for content types */
.col-header {
  background: var(--card);
  padding: var(--space-sm) var(--space-md);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
}

.col-header .icon {
  font-size: 14px;
}

/* Day row labels */
.day-label {
  background: var(--card);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.day-label .day-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-light);
}

.day-label .date-num {
  font-family: var(--font-heading);
  font-size: 13px;
  color: var(--text);
  font-weight: 400;
  margin-top: 1px;
}

/* Today (weekly): the whole label is filled in, since the column is too
   narrow for a pill */
.day-label.today {
  background: var(--accent);
}

.day-label.today .day-name,
.day-label.today .date-num {
  color: white;
  font-weight: 700;
}

/* Month transition label */
.month-transition {
  grid-column: 1 / -1;
  background: var(--bg);
  padding: var(--space-xs) var(--space-md);
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-light);
}

.empty-state h3 {
  margin-bottom: var(--space-sm);
  color: var(--text);
}
