/* =========================================
   Calendar (consolidated)
   Source: moved from componentshub.css + hub.css
   ========================================= */

/* Utilities used by the calendar */
.u-mt-24 { margin-top: 24px; }
.u-mb-24 { margin-bottom: 24px; }
.u-gap-8 { gap: 8px; }
.u-flex-left { display: flex; justify-content: flex-start; }

/* Optional: allow sections without border (kept) */
.cal-section.no-border { border: 0; }

/* Calendar visual styles (from componentshub.css) */
.cal-wrap { text-align: left; max-width: 100%; margin: 0; }
.cal-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding-bottom: 6px; border-bottom: 1px solid #b08a48; }
.cal-dayhead { font-weight: 600; margin: 6px 0 4px; }
.cal-date-big { font-size: 20px; font-weight: 600; line-height: 1.15; margin-bottom: 4px; }
.cal-week { color: #6c757d; font-size: 13px; font-weight: 400; }
.cal-tabs { display: inline-flex; gap: 8px; }
.cal-tab {
  border: 1px solid #b08a48;
  background: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}
.cal-tab-active { border-color: #b08a48; box-shadow: 0 0 0 2px rgba(176,138,72,0.15) inset; }

.cal-main { margin-top: 24px; }
.cal-section {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 20px;
  max-width: 100%;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.cal-section-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-section-title { font-weight: 500; font-size: 13px; }
.cal-section-help { color: #b08a48; font-size: 12px; }
.cal-actions { margin-top: 8px; }

.cal-btn {
  background: #fff;
  color: #000;
  border: 1px solid #b08a48;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.cal-btn.ghost { background: #fff; }
.cal-btn:hover { border-color: #b08a48; }

/* Let provider buttons wrap within the rail */
#calendarRightRail .cal-provider-switch {
  flex-wrap: wrap;
}

/* Avoid cramped wraps and normalize button sizing/alignment */
#calendarRightRail .cal-provider-switch .cal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-height: 32px;
  white-space: nowrap;
}


.cal-note-editor {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
  box-sizing: border-box;
  margin-bottom: 10px;

}
.cal-note-editor textarea,
.cal-note-editor input {
  width: 100%;
  font-size: 13px;
  font-weight: 400;
  border: 1px solid #b08a48;
  border-radius: 6px;
  padding: 8px;
  background: #fff;
  box-sizing: border-box;
}
.cal-note-editor textarea {
  resize: vertical;
}
/* Selected state for provider buttons */
.cal-btn--primary {
  box-shadow: 0 0 0 2px rgba(176,138,72,0.15) inset;
  border-color: #b08a48;
}

.cal-empty { color: #6c757d; font-style: italic; padding: 24px 0; }

/* Month View Grid Classes */
.cal-month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-month-cell { min-height: 120px; border: 1px solid #e9ecef; border-radius: 8px; padding: 8px; cursor: pointer; background-color: #fff; display: flex; flex-direction: column; transition: border-color 0.2s; }
.cal-month-cell:hover { border-color: #b08a48; }
.cal-month-cell.muted { opacity: 0.5; background-color: #f9f9f9; }
.cal-month-cell.today { border: 2px solid #b08a48; }
.cal-month-date { font-weight: 600; font-size: 1.1rem; margin-bottom: 4px; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; background-color: #b08a48; }

/* Right-column mini calendar (from componentshub.css) */
.cal-side { background: #fff; border: 1px solid #b08a48; border-radius: 8px; padding: 12px; height: fit-content; margin-bottom: 16px; }
.cal-side-head { display: grid; grid-template-columns: 32px 1fr 32px; align-items: center; margin-bottom: 8px; }
.cal-side-title { text-align: center; font-weight: 500; font-size: 13px; }
.cal-nav { background: #fff; border: 1px solid #b08a48; border-radius: 6px; cursor: pointer; height: 32px; }
.cal-weekdays { display: grid !important; grid-template-columns: repeat(7,1fr) !important; font-size: 12px; color: #6c757d; margin-bottom: 4px; text-align: center; gap: var(--space-10) !important; }
.cal-grid { display: grid !important; grid-template-columns: repeat(7,1fr) !important; gap: var(--space-10) !important; }
.cal-day-cell { border: 1px solid transparent; background: #fff; border-radius: 6px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 6px; transition: all 0.2s; position: relative; }
.cal-day-cell:hover { background: #f8f9fa; border-color: #e9ecef; }
.cal-day-cell.muted { opacity: .45; }
.cal-day-cell.today { font-weight: bold; color: #b08a48; }
.cal-day-cell.selected { background: #b08a48; color: #fff; border-color: #b08a48; }
.cal-day-cell.has-events::after { content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background-color: #b08a48; }
.cal-day-cell.selected.has-events::after { background-color: #fff; }
.cal-today-row { margin-top: 10px; display: flex; justify-content: center; }

/* Events list (from componentshub.css) */
.cal-list-date { font-weight: 600; margin-top: 10px; }
.cal-event {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(176,138,72,.35);
}

.cal-event + .cal-event { margin-top: 6px; }
.cal-event:last-child { border-bottom: 0; }
.cal-event__text { font-size: 13px; }
.cal-event__actions { display: inline-flex; align-items: center; gap: 8px; }

.cal-icon-btn {
  background: #fff;
  border: 1px solid #b08a48;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
}
.cal-icon-btn:hover { border-color: #b08a48; }
.cal-icon-btn--danger { border-color: #b04848; }

/* ===== Ultra-compact mode for right-rail (from hub.css) ===== */
#calendarRightRail.cal-side--compact {
  padding: 8px;
  border-radius: 8px;
  height: auto;
}
.cal-side--compact .cal-side-head {
  margin-bottom: 2px;
  display: grid;
  grid-template-columns: 24px 1fr 24px;
  align-items: center;
}
.cal-side--compact .cal-side-title { font-size: 11px; font-weight: 600; }
.cal-side--compact .cal-nav { height: 24px; border-radius: 6px; }
.cal-side--compact .cal-weekdays {
  grid-template-columns: repeat(7, 1fr) !important;
  gap: 1px !important;
  font-size: 10px;
  margin-bottom: 2px;
  text-align: center;
}
.cal-side--compact .cal-grid {
  grid-template-columns: repeat(7, 1fr) !important;
  gap: 1px !important;
}
.cal-side--compact .cal-day-cell {
  height: 22px;
  min-height: 22px;
  padding: 0;
  font-size: 11px;
  line-height: 1;
}
.cal-side--compact .cal-today-row { margin-top: 4px; }
