:root {
  --primary-color: #493137;
  --highlight-red: #d00;
  --bg-color: #f9f9f9;
  --border-color: #ddd;
}

.calendar-container {
  width: 100%;
  background: white;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

/* 頂部控制區 */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--primary-color);
  color: white;
  padding: 12px 20px;
}

.calendar-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.btn-nav {
  background: transparent;
  border: 1px solid white;
  color: white;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 4px;
  transition: 0.3s;
}

.btn-nav:hover {
  background: white;
  color: var(--primary-color);
}

/* 星期幾的標頭 */
.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background-color: #eee;
  border-bottom: 1px solid var(--border-color);
}

.weekdays div {
  padding: 10px;
  text-align: center;
  font-weight: bold;
  color: #555;
}

.text-red {
  color: var(--highlight-red) !important;
}

/* 日期網格 */
.days-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(100px, 1fr));
  background-color: var(--border-color);
  gap: 1px;
}

@media screen and (max-width: 768px) {
  .days-grid {
    grid-template-columns: repeat(7, minmax(50px, 1fr));
  }
}

.day-cell {
  background-color: white;
  min-height: 118px;
  padding: 8px;
  position: relative;
  transition: 0.2s;
}

.day-cell:hover {
  background-color: #fffdf0;
}

.day-number {
  font-weight: bold;
  color: #333;
  margin-bottom: 5px;
  display: block;
}

.day-cell.other-month {
  background-color: #fcfcfc;
  color: #ccc;
}

.day-cell.other-month .day-number {
  color: #ccc;
}

.day-cell.today {
  background-color: #fff0f0;
}

.day-cell.today .day-number {
  color: var(--primary-color);
  text-decoration: underline;
}

/* --- [修改重點] 活動連結基礎樣式 --- */
.event-link {
  display: block;
  font-size: 0.85rem;
  padding: 4px 6px;
  margin-top: 4px;
  border-radius: 3px;
  text-decoration: none;
  border-left-width: 4px;
  /* 加寬左邊框 */
  border-left-style: solid;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: 0.2s;
}

/* --- [修改重點] 各種分類顏色設定 (可自由新增) --- */

/* 1. 藍色分類 (例如: 學院活動) */
.evt-blue {
  border-left-color: #0056b3;
  color: #004494;
  background-color: #e6f2ff;
}

.evt-blue:hover {
  background-color: #0056b3;
  color: white;
}

/* 2. 綠色分類 (例如: 生醫所) */
.evt-green {
  border-left-color: #28a745;
  color: #1e7e34;
  background-color: #e6ffed;
}

.evt-green:hover {
  background-color: #28a745;
  color: white;
}

/* 3. 橘色分類 (例如: 癌症生物所) */
.evt-orange {
  border-left-color: #fd7e14;
  color: #b85c0e;
  background-color: #fff5eb;
}

.evt-orange:hover {
  background-color: #fd7e14;
  color: white;
}

/* 4. 紅色分類 (例如: 重要節日/校級活動) */
.evt-red {
  border-left-color: #dc3545;
  color: #a71d2a;
  background-color: #ffeef0;
}

.evt-red:hover {
  background-color: #dc3545;
  color: white;
}

/* 5. 灰色 (預設或其他) */
.evt-gray {
  border-left-color: #6c757d;
  color: #495057;
  background-color: #f8f9fa;
}

.evt-gray:hover {
  background-color: #6c757d;
  color: white;
}

/* --- 底部 Legend (圖例) 樣式 --- */
.legend-container {
  width: 900px;
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.legend-item {
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  color: #555;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}