.calendar-container {
  max-width: 100%;
  margin: 0 auto;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  overflow-x: hidden; /* Prevent horizontal scroll */
  box-sizing: border-box;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding: 20px;
  background-color: #ADD8E6;
  border-radius: 5px;
  box-sizing: border-box;
}

.month-navigation {
  display: flex;
  gap: 20px;
  align-items: center;
}

.month-navigation button {
  background-color: #ADD8E6;
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 5px;
  font-size: 18px;
  transition: background-color 0.3s;
}

.month-navigation button:hover {
  background-color: #87CEEB;
}

.current-month {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  min-width: 200px;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background-color: #ddd;
  border: 2px solid #ddd;
  width: 100%;
  box-sizing: border-box;
}

.calendar-day-header {
  background-color: #ADD8E6;
  padding: 15px;
  text-align: center;
  font-weight: bold;
  color: #333;
  border: 1px solid #fff;
  font-size: 14px;
  box-sizing: border-box;
}

.calendar-day-header .short-name {
  display: none;
}

.calendar-day {
  background-color: white;
  min-height: 120px;
  padding: 8px;
  border: 1px solid #fff;
  position: relative;
  box-sizing: border-box;
  overflow: hidden; /* Prevent content overflow */
}

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

.calendar-day.today {
  background-color: #fffacd;
}

.day-number {
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 5px;
  color: #333;
}

.other-month .day-number {
  color: #999;
}

.event {
  background-color: #ADD8E6;
  padding: 4px 6px;
  margin: 2px 0;
  border-radius: 3px;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.2s;
  border-left: 3px solid #4169E1;
  box-sizing: border-box;
}

.event:hover {
  background-color: #87CEEB;
}

.event-time {
  font-weight: bold;
  color: #333;
}

.event-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.event-modal.active {
  display: flex;
}

.event-modal-content {
  background: white;
  padding: 30px;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  box-sizing: border-box;
}

.event-modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 30px;
  cursor: pointer;
  color: #666;
}

.event-modal-close:hover {
  color: #000;
}

.event-modal h2 {
  color: #333;
  margin-top: 0;
  border-bottom: 2px solid #ADD8E6;
  padding-bottom: 10px;
}

.event-modal-time {
  font-size: 18px;
  color: #666;
  margin-bottom: 15px;
}

.event-modal-description {
  line-height: 1.6;
  color: #333;
}

/* Tablet adjustments */
@media screen and (max-width: 1240px) {
  .calendar-container {
    padding: 15px;
  }

  .calendar-header {
    padding: 15px;
  }

  .month-navigation button {
    font-size: 16px;
    padding: 8px 15px;
  }

  .current-month {
    font-size: 20px;
  }

  .calendar-grid {
    gap: 1px;
  }
  
  .calendar-day {
    min-height: 90px;
    padding: 5px;
  }
  
  .calendar-day-header {
    padding: 10px 4px;
    font-size: 12px;
  }
  
  .event {
    font-size: 11px;
    padding: 3px 4px;
  }
  
  .day-number {
    font-size: 14px;
  }
}

/* Mobile improvements */
@media screen and (max-width: 768px) {
  .calendar-container {
    padding: 10px;
    width: 100%;
  }

  .calendar-header {
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    margin-bottom: 15px;
    width: 100%;
  }

  .month-navigation {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .month-navigation button {
    font-size: 14px;
    padding: 8px 12px;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .current-month {
    font-size: 18px;
    min-width: auto;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .calendar-day-header {
    padding: 6px 2px;
    font-size: 11px;
  }

  .calendar-day-header .full-name {
    display: none;
  }

  .calendar-day-header .short-name {
    display: inline;
  }

  .calendar-grid {
    gap: 1px;
    width: 100%;
  }

  .calendar-day {
    min-height: 70px;
    padding: 3px;
  }

  .day-number {
    font-size: 13px;
    margin-bottom: 2px;
  }

  .event {
    font-size: 10px;
    padding: 2px 3px;
    margin: 1px 0;
    border-left-width: 2px;
  }

  .event-time {
    font-size: 9px;
  }

  .event-title {
    font-size: 10px;
  }

  .event-modal-content {
    padding: 20px;
    width: 95%;
  }

  .event-modal h2 {
    font-size: 18px;
  }

  .event-modal-time {
    font-size: 14px;
  }

  .event-modal-description {
    font-size: 14px;
  }
}

/* Extra small mobile devices */
@media screen and (max-width: 480px) {
  .calendar-container {
    padding: 5px;
  }

  .calendar-header {
    padding: 10px;
  }

  .month-navigation button {
    font-size: 12px;
    padding: 6px 10px;
  }

  .current-month {
    font-size: 16px;
  }

  .calendar-day-header {
    padding: 4px 1px;
    font-size: 10px;
  }

  .calendar-day {
    min-height: 60px;
    padding: 2px;
  }

  .day-number {
    font-size: 12px;
    margin-bottom: 1px;
  }

  .event {
    font-size: 9px;
    padding: 1px 2px;
  }

  .event-time {
    font-size: 8px;
  }

  .event-title {
    font-size: 9px;
  }
}

/* Very small screens - show fewer event details */
@media screen and (max-width: 380px) {
  .calendar-day {
    min-height: 55px;
  }

  .event-time {
    display: none;
  }

  .event {
    padding: 2px;
    font-size: 8px;
  }
}