@import url("https://fonts.google.com/specimen/Roboto?query=roboto");

.calendar {
  width: 100%;
  border-radius: 12px;
  padding: 15px;
  background-color: #f9f9f9;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.calendar-header {
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #333;
}

.calendar-header button {
  background: none;
  border: none;
  font-size: 18px;
  color: #007bff;
  cursor: pointer;
  transition: color 0.3s ease;
}

.calendar-header button:hover {
  color: #0056b3;
}

.calendar-body {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  transition: all 0.5s ease-in-out;
}

.calendar-body.fade-out {
  opacity: 0;
  transform: translateX(-20px);
}

.calendar-body.fade-in {
  opacity: 1;
  transform: translateX(0);
}

.calendar-row {
  display: flex;
  width: 100%;
  transition: all 0.5s ease-in-out;
}

.day-cell {
  flex:1;
  padding: 10px;
  border: 1px solid #ddd;
  min-height: 80px;
  position: relative;
  background-color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  overflow: hidden; /* Initially hide overflow */
  transition: background-color 0.3s ease;
  text-align: center;
}

.day-cell:hover {
  background-color: #f1faff;
}

.date-number {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 5px;
  color: #333;
}

.event {
  background-color: #007bff;
  color: #fff;
  padding: 2px 5px;
  margin-top: 5px;
  border-radius: 4px;
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  position: relative;
  transition: all 0.3s ease-in-out;
}

.day-cell:hover {
  overflow: visible; /* Show overflow on hover */
}

.event:hover {
  background-color: #0056b3;
  cursor: pointer;
}

.event:hover::after {
  content: attr(data-content); /* Full content displayed on hover */
  position: absolute;
  left: 0;
  top: 100%;
  white-space: normal;
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 5px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 1000;
  max-width: 200px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transform: translateX(-50%);
  left: 50%; /* Center the tooltip */
  top: auto;
  bottom: 100%; /* Position above the event */
}

.empty-cell {
  background-color: #f0f0f0;
}

/* Responsive layout adjustments */
@media (max-width: 768px) {
  .calendar-header {
      font-size: 20px;
  }

  .day-cell {
      min-height: 60px;
      padding: 5px;
  }

  .date-number {
      font-size: 12px;
  }

  .event {
      font-size: 10px;
      padding: 1px 3px;
  }

  .event:hover::after {
      font-size: 10px;
  }
}

@media (max-width: 480px) {
  .calendar-header {
      font-size: 18px;
  }

  .day-cell {
      min-height: 50px;
      padding: 3px;
  }

  .date-number {
      font-size: 10px;
  }

  .event {
      font-size: 8px;
      padding: 1px 2px;
  }

  .event:hover::after {
      font-size: 8px;
  }
}
