/* Main calendar page layout */
.calendar-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px 0;
  height: calc(100vh - 80px);
}

/* Month navigation at the top */
.calendar-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  margin-bottom: 8px;
}

.calendar-head h2 {
  min-width: 200px;
  text-align: center;
  margin: 0;
}

/* Main content area with calendar and sidebar */
.calendar-content {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
  flex: 1;
  min-height: 0;
}

/* Calendar grid styling */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  width: 100%;
  height: fit-content;
}

.calendar-grid .day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  min-height: 140px;
  display: grid;
  gap: 8px;
  align-content: start;
  transition: all 0.2s ease;
}

.calendar-grid .day:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(5, 80, 255, 0.1);
}

.calendar-grid .day.today {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 0 8px 2px var(--primary);
}

.calendar-grid .day.today .date,
.calendar-grid .day.today .item,
.calendar-grid .day.today .note {
  color: white;
}

.calendar-grid .day.today .note {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.calendar-grid .day.today .item:hover {
  background: rgba(255, 255, 255, 0.2);
}

.calendar-grid .day .date {
  font-weight: 700;
  font-size: 16px;
}

.calendar-grid .items {
  display: grid;
  gap: 6px;
}

.calendar-grid .item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  transition: background-color 0.2s ease;
  border-radius: 6px;
}

.calendar-grid .item:hover {
  background: color-mix(in hsl, var(--primary) 15%, var(--surface));
  padding: 4px 6px;
  margin: -4px -6px;
}

.calendar-grid .item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Sidebar styling */
.calendar-side {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  height: fit-content;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  position: sticky;
  top: 100px;
}

.calendar-side h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
}

.deadline-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.calendar-side .deadline-list li {
  padding: 12px;
  border-radius: 8px;
  transition: background-color 0.2s ease;
  border: 1px solid transparent;
}

.calendar-side .deadline-list li:hover {
  background: color-mix(in hsl, var(--primary) 8%, var(--surface));
  border-color: var(--border);
}

/* Responsive design */
@media (max-width: 1200px) {
  .calendar-content {
    grid-template-columns: 1fr 300px;
    gap: 20px;
  }
}

@media (max-width: 1000px) {
  .calendar-content {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .calendar-side {
    position: static;
    max-height: 400px;
  }
}

@media (max-width: 768px) {
  .calendar-page {
    padding: 16px 0;
    gap: 16px;
  }
  
  .calendar-head {
    padding: 8px 0;
    margin-bottom: 4px;
  }
  
  .calendar-grid .day {
    min-height: 100px;
    padding: 8px;
  }
  
  .calendar-side {
    padding: 16px;
  }
}

/* Wider container specifically for calendar page */
.calendar-page.container {
  max-width: 1280px;
}

/* Weekday header styling */
.calendar-grid .day.head {
  background: transparent;
  border: none;
  min-height: auto;
  padding: 8px 0;
  text-align: center;
  font-weight: 600;
  opacity: 0.8;
}

/* Note styles */
.calendar-grid .day .notes {
  display: grid;
  gap: 4px;
  margin-top: 4px;
}

.note {
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  background-color: var(--note-default-bg);
  border: 1px solid var(--note-default-border);
  color: var(--text-primary);
}

.note[data-color="red"] {
  background-color: var(--note-red-bg);
  border-color: var(--note-red-border);
}
.note[data-color="blue"] {
  background-color: var(--note-blue-bg);
  border-color: var(--note-blue-border);
}
.note[data-color="green"] {
  background-color: var(--note-green-bg);
  border-color: var(--note-green-border);
}
.note[data-color="yellow"] {
  background-color: var(--note-yellow-bg);
  border-color: var(--note-yellow-border);
}


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

.modal:not([hidden]) {
  display: flex;
}

.modal-content {
  background: var(--surface);
  padding: 24px;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  position: relative;
  display: grid;
  gap: 16px;
  transition: background-color 0.3s ease;
}

.modal-content[data-color="red"] { background-color: color-mix(in hsl, var(--note-red-bg) 50%, var(--surface)); }
.modal-content[data-color="blue"] { background-color: color-mix(in hsl, var(--note-blue-bg) 50%, var(--surface)); }
.modal-content[data-color="green"] { background-color: color-mix(in hsl, var(--note-green-bg) 50%, var(--surface)); }
.modal-content[data-color="yellow"] { background-color: color-mix(in hsl, var(--note-yellow-bg) 50%, var(--surface)); }

.close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-content h3 {
  margin: 0;
}

#noteText {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--text-primary);
  font-family: inherit;
}

.note-colors {
  display: flex;
  gap: 8px;
}

.color-option {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.color-option.active {
  border-color: var(--primary);
}

.color-option[data-color="default"] { background-color: var(--note-default-bg); }
.color-option[data-color="red"] { background-color: var(--note-red-bg); }
.color-option[data-color="blue"] { background-color: var(--note-blue-bg); }
.color-option[data-color="green"] { background-color: var(--note-green-bg); }
.color-option[data-color="yellow"] { background-color: var(--note-yellow-bg); }

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-buttons button {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: var(--bd-font-family);
  font-weight: 600;
}

#saveNoteBtn {
  background: var(--primary);
  color: white;
}
