/* Page layout */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  background: #f4f5f7;
  color: #222;
}

.calendar-page {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.calendar-page h1 {
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Calendar container */
.calendar-container {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  padding: 1rem 1.5rem 1.5rem;
}

/* Header (month + nav) */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.calendar-month-label {
  font-size: 1.3rem;
  font-weight: 600;
}

.calendar-nav-btn {
  border: none;
  background: #e4e7ec;
  padding: 0.4rem 0.7rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.15s ease, transform 0.1s ease;
}

.calendar-nav-btn:hover {
  background: #d0d4dd;
  transform: translateY(-1px);
}

/* Weekdays row */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 1px solid #e4e7ec;
  padding-bottom: 0.4rem;
  color: #555;
}

/* Calendar days grid */
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
  margin-top: 0.4rem;
  /* Force all rows to be same height */
  grid-auto-rows: 130px;
}

.calendar-day {
  height: 130px;              /* fixed height for alignment */
  border-radius: 10px;
  border: 1px solid #e4e7ec;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  background: #fafbff;
  position: relative;
  overflow-y: auto;           /* scroll inside cell if too many appts */
}

.calendar-day.other-month {
  background: #f5f5f5;
  color: #9a9a9a;
}

/* Date number */
.calendar-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.calendar-day-number {
  font-weight: 600;
}

.calendar-day-today {
  background: #e3f2fd;
  border-color: #90caf9;
}

/* Appointment chip inside day */
.appointment-item {
  background: #e3f2fd;
  border-left: 4px solid #1565c0;
  border-radius: 6px;
  padding: 0.25rem 0.35rem;
  margin-top: 0.25rem;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-item:hover {
  background: #d2e7fb;
}

.appointment-time {
  font-weight: 600;
  margin-right: 0.25rem;
}

.appointment-reason {
  color: #444;
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-overlay.hidden {
  display: none;
}

/* Modal box */
.modal {
  background: #ffffff;
  border-radius: 12px;
  max-width: 420px;
  width: 90%;
  padding: 1rem 1.2rem 1.1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

/* Modal header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.modal-header h2 {
  font-size: 1.1rem;
  margin: 0;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

/* Modal body */
.modal-body p {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}

/* Modal footer */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.8rem;
}

.btn {
  border: none;
  background: #1565c0;
  color: #ffffff;
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.08s ease;
}

.btn:hover {
  background: #0f4da0;
  transform: translateY(-1px);
}

/* Small screen tweaks */
@media (max-width: 768px) {
  .calendar-day {
    min-height: 90px;
  }

  .appointment-item {
    white-space: normal;
  }
}

/* Override Bootstrap's .modal for our custom overlay */
.modal-overlay .modal {
  display: block;        /* ensure our inner box is visible */
  position: relative;    /* keep our box centered as defined earlier */
}
