/* Calendar Page Styles */

#calendar-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* View Toggle Buttons */
.calendar-controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.view-btn {
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  outline: none;
}

.view-btn.active {
  background-color: #2a63ec !important;
  color: white !important;
}

.view-btn:not(.active) {
  background-color: #f5f5f5 !important;
  color: #333 !important;
}

.view-btn:not(.active):hover {
  background-color: #e0e0e0 !important;
}

/* Navigation Buttons */
.calendar-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

#prev-btn,
#next-btn {
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  outline: none;
}

#prev-btn:hover,
#next-btn:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

#current-period {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
}

/* Monthly View */
.calendar-month {
  width: 100%;
  border-collapse: collapse;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.calendar-month thead {
  background-color: #2a63ec;
  color: white;
}

.calendar-month thead th {
  padding: 15px;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.calendar-month thead th:last-child {
  border-right: none;
}

.calendar-month tbody td {
  padding: 0;
  height: 100px;
  vertical-align: top;
  border: 1px solid #e0e0e0;
  position: relative;
  background-color: #fff;
}

.calendar-month tbody td.other-month {
  background-color: #f9f9f9;
  color: #999;
}

.calendar-month tbody td.today {
  background-color: #fff9e6;
}

.date-number {
  display: block;
  padding: 8px;
  font-weight: 600;
  color: #333;
  font-size: 0.95rem;
}

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

.calendar-events {
  padding: 0 5px 5px 5px;
  max-height: 70px;
  overflow-y: auto;
}

.calendar-event {
  font-size: 0.75rem;
  padding: 3px 6px;
  margin: 2px 0;
  border-radius: 3px;
  color: white;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s;
}

.calendar-event:hover {
  opacity: 0.8;
}

.event-tech {
  background-color: #2a63ec;
}

.event-scams {
  background-color: #f39c12;
}

.event-social {
  background-color: #27ae60;
}

/* Weekly View */
.calendar-week {
  width: 100%;
  border-collapse: collapse;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.calendar-week thead {
  background-color: #2a63ec;
  color: white;
}

.calendar-week thead th {
  padding: 15px;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.calendar-week thead th:first-child {
  width: 80px;
}

.calendar-week tbody td {
  padding: 12px;
  border: 1px solid #e0e0e0;
  vertical-align: top;
  min-height: 80px;
}

.calendar-week tbody td:first-child {
  background-color: #f5f5f5;
  font-weight: 600;
  text-align: center;
  color: #666;
}

.calendar-week .today-col {
  background-color: #fff9e6;
}

.week-day-header {
  font-weight: 600;
  color: #333;
  margin-bottom: 5px;
}

.week-event {
  font-size: 0.85rem;
  padding: 6px 10px;
  margin: 5px 0;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  transition: opacity 0.2s;
}

.week-event:hover {
  opacity: 0.8;
}

/* Yearly View */
.calendar-year {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  width: 100%;
}

.year-month {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 15px;
  transition: transform 0.2s;
}

.year-month:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.year-month-name {
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #2a63ec;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid #2a63ec;
}

.year-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.year-day-header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #666;
  padding: 5px 0;
}

.year-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s;
}

.year-day:hover:not(.other-month):not(.has-event) {
  background-color: #f0f0f0;
}

.year-day.other-month {
  color: #ccc;
}

.year-day.today {
  background-color: #fff9e6;
  font-weight: 700;
}

.year-day.has-event {
  background-color: #2a63ec;
  color: white;
  font-weight: 600;
}

.year-day.has-event:hover {
  opacity: 0.9;
}

.year-event-indicator {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: white;
}

/* Responsive Design */
@media (max-width: 939px) {
  .calendar-navigation {
    flex-direction: column;
    gap: 10px;
  }

  #current-period {
    font-size: 1.2rem;
  }

  .calendar-month tbody td {
    height: 80px;
    font-size: 0.85rem;
  }

  .date-number {
    font-size: 0.85rem;
    padding: 5px;
  }

  .calendar-event {
    font-size: 0.7rem;
    padding: 2px 4px;
  }

  .calendar-year {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

@media (max-width: 575px) {
  #calendar-container {
    padding: 10px;
  }

  .calendar-controls {
    flex-direction: column;
  }

  .view-btn {
    width: 100%;
    max-width: 300px;
  }

  .calendar-month tbody td {
    height: 60px;
    padding: 2px;
  }

  .date-number {
    font-size: 0.75rem;
    padding: 3px;
  }

  .calendar-event {
    font-size: 0.65rem;
    padding: 1px 3px;
  }

  .calendar-week tbody td {
    padding: 8px;
    font-size: 0.8rem;
  }

  .week-event {
    font-size: 0.75rem;
    padding: 4px 6px;
  }

  .calendar-year {
    grid-template-columns: 1fr;
  }

  .calendar-legend {
    font-size: 0.85rem;
  }

  .legend-color {
    width: 16px !important;
    height: 16px !important;
  }
}

/* Loading State */
.calendar-loading {
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 1.1rem;
}

/* Event Tooltip */
.event-tooltip {
  position: absolute;
  background: #333;
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  z-index: 1000;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
}

.event-tooltip.show {
  opacity: 1;
}

/* Class Details Modal */
.calendar-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  overflow-y: auto;
  padding: 20px;
}

.calendar-modal.show {
  display: block;
}

.calendar-modal-content {
  background-color: white;
  margin: 50px auto;
  padding: 0;
  width: 90%;
  max-width: 700px;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.calendar-modal-header {
  padding: 25px 30px;
  border-bottom: 2px solid #2a63ec;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calendar-modal-header h2 {
  margin: 0;
  font-size: 1.8rem;
  color: #2c3e50;
  font-weight: 700;
}

.calendar-modal-close {
  font-size: 2.5rem;
  color: #95a5a6;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.calendar-modal-close:hover {
  color: #2c3e50;
}

.calendar-modal-body {
  padding: 30px;
}

#modal-class-details {
  font-size: 1rem;
  line-height: 1.8;
}

.detail-row {
  margin-bottom: 15px;
  padding: 12px;
  background-color: #f9f9f9;
  border-radius: 5px;
  border-left: 4px solid #2a63ec;
}

.detail-row strong {
  color: #2a63ec;
  font-weight: 600;
  margin-right: 8px;
}

.calendar-modal-footer {
  padding: 20px 30px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  background-color: #f9f9f9;
}

.calendar-modal-footer button {
  transition: all 0.3s;
}

.calendar-modal-footer button:hover {
  transform: translateY(-2px);
}

.calendar-modal-footer button:active {
  transform: translateY(0);
}

@media (max-width: 575px) {
  .calendar-modal-content {
    width: 95%;
    margin: 20px auto;
  }

  .calendar-modal-header {
    padding: 20px;
  }

  .calendar-modal-header h2 {
    font-size: 1.4rem;
  }

  .calendar-modal-body {
    padding: 20px;
  }

  .calendar-modal-footer {
    padding: 15px 20px;
    flex-direction: column;
  }

  .calendar-modal-footer button {
    width: 100%;
  }
}
