/* --- 全局變數與設定 --- */
:root {
  --primary-blue: #0f4c81; /* 主色：中正社大藍 */
  --accent-blue: #166ba2; /* 輔助藍：按鈕與強調 */
  --bg-light: #f4f8fb; /* 淺藍背景 */
  --border-color: #dbe4ea; /* 邊框色 */
  --holiday-red: #e74c3c; /* 假日紅 */
  --holiday-bg: #fdedec; /* 假日背景淡紅 */
  --citizen-green: #27ae60; /* 公民週綠 */
  --citizen-bg: #eafaf1; /* 公民週背景淡綠 */
  --text-dark: #333;
  --text-gray: #666;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Noto Sans TC", sans-serif;
  color: var(--text-dark);
  background-color: #fff;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
  transition: 0.3s;
}
ul {
  list-style: none;
}

nav{
    /* Logo 區域 */
.brand-logo {
  height: 50px; /* Logo 高度設定 */
  width: auto;
  display: block;
}

/* 右側按鈕區域 */
.btn-signup {
  background-color: #0d2c5e; /* 深藍色主色 */
  color: #ffffff;
  padding: 10px 25px;
  border-radius: 50px; /* 膠囊狀圓角 */
  text-decoration: none;
  font-weight: bold;
  font-size: 15px;
  transition: all 0.3s ease;
  display: inline-block;
}

.btn-signup:hover {
  background-color: #1a4f9c; /* 滑鼠移過去變亮一點 */
  transform: translateY(-2px); /* 微微浮起 */
  box-shadow: 0 4px 10px rgba(13, 44, 94, 0.3);
}

    @media (max-width: 768px) {

      .brand{
        margin-left: 50px;
      }

      .nav-right{
        display: none;
      }
    }
}

/* --- 主要內容區 (Main) --- */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 30px auto;
  padding: 0 20px;
}

.page-header {
  text-align: center;
  margin-bottom: 30px;
  padding-top: 10vh;
}
.page-header h1 {
  color: var(--primary-blue);
  font-size: 2rem;
  margin-bottom: 15px;
}

/* 圖例 Legend */
.legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
  font-size: 0.95rem;
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.l-blue {
  background-color: var(--accent-blue);
}
.l-green {
  background-color: var(--citizen-green);
}
.l-red {
  background-color: var(--holiday-red);
}
.l-box-red {
  width: 16px;
  height: 16px;
  background-color: var(--holiday-bg);
  border: 1px solid #fadbd8;
  border-radius: 4px;
}

/* 月份切換按鈕 (Tabs) */
.month-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 8px 25px;
  border: 1px solid var(--primary-blue);
  background: transparent;
  color: var(--primary-blue);
  border-radius: 30px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s;
}
.tab-btn:hover,
.tab-btn.active {
  background-color: var(--primary-blue);
  color: #fff;
  box-shadow: 0 4px 10px rgba(15, 76, 129, 0.3);
}

/* 雙欄佈局容器 */
.schedule-container {
  display: none; /* 預設隱藏，透過 JS 切換 */
  grid-template-columns: 0.9fr 1.2fr; /* 左寬右窄 */
  gap: 40px;
  animation: fadeIn 0.4s ease;
}
.schedule-container.active {
  display: grid;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 左側：月曆 (Calendar) */
.calendar-wrapper {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.03);
}
.calendar-title {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-blue);
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: bold;
  color: var(--text-gray);
  margin-bottom: 10px;
}
.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day {
  aspect-ratio: 1/1;
  border: 1px solid #f0f0f0;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  padding: 2px;
  position: relative;
  font-weight: 700;
  font-size: 1rem;
  color: #444;
  background-color: #fff;
  transition: all 0.2s;
}

@media (max-width: 768px) {
  .day{
    aspect-ratio: 0;
  }

  .calendar-wrapper{
    width: 90vw;
  }

  .events-wrapper{
    width: 90vw;
  }
}

.day:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}
.day.empty {
  border: none;
  background: none;
  pointer-events: none;
}

/* 特殊日期樣式 */
.day.holiday-mode {
  background-color: var(--holiday-bg);
  color: var(--holiday-red);
  border-color: #fadbd8;
}
.day.citizen-mode {
  background-color: var(--citizen-bg);
  border-color: #d5f5e3;
}
.day.weekend {
  color: #999;
}
.day.holiday-mode.weekend {
  color: var(--holiday-red);
}

/* 週次標籤 (W1, W2...) */
.week-tag {
  font-size: 0.6rem;
  background-color: var(--primary-blue);
  color: #fff;
  padding: 1px 4px;
  border-radius: 4px;
  align-self: flex-start;
  margin-bottom: auto;
}
.week-tag.makeup {
  background-color: #555;
} /* 補課週顏色 */

/* 日期下方的色點 */
.event-dots {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-top: auto;
  padding-bottom: 4px;
}
.dot.blue {
  background-color: var(--accent-blue);
}
.dot.green {
  background-color: var(--citizen-green);
}
.dot.red {
  background-color: var(--holiday-red);
}

/* 右側：清單 (List) */
.events-wrapper {
  width: 100%;
  background: #fff;
  border-radius: 12px;
  padding: 10px;
}
.events-title {
  font-size: 1.3rem;
  color: var(--primary-blue);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.event-list {
  overflow: auto;
  height: 70vh;
  border-left: 2px solid #eee;
  margin-left: 8px;
  padding-left: 35px;
}

.event-item {
  position: relative;
  margin-bottom: 25px;
}
.event-item::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #ddd;
}

/* 清單項目顏色分類 */
.event-item.type-admin::before {
  background-color: var(--accent-blue);
}
.event-item.type-citizen::before {
  background-color: var(--citizen-green);
}
.event-item.type-holiday::before {
  background-color: var(--holiday-red);
}

.event-date {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 5px;
  display: block;
}
.type-admin .event-date {
  color: var(--accent-blue);
}
.type-citizen .event-date {
  color: var(--citizen-green);
}
.type-holiday .event-date {
  color: var(--holiday-red);
}

.event-content {
  background: var(--bg-light);
  padding: 15px;
  border-radius: 8px;
}
.type-holiday .event-content {
  background: var(--holiday-bg);
}
.type-citizen .event-content {
  background: var(--citizen-bg);
}

.event-content h4 {
  margin-bottom: 5px;
  font-size: 1.05rem;
  color: #333;
}
.event-content p {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.5;
  margin-bottom: 5px;
}
.event-content p:last-child {
  margin-bottom: 0;
}
.highlight {
  font-weight: bold;
  color: var(--primary-blue);
}

/* --- 新增/修改的互動樣式 --- */

/* 讓日期格子變成可點擊的樣子 */
.day {
    cursor: pointer;
    transition: all 0.2s;
}

/* 滑鼠移過去的效果 */
.day:hover {
    border-color: var(--accent-blue);
    background-color: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* 被選中的日期 (Active State) */
.day.selected {
    background-color: var(--primary-blue);
    color: #fff;
    border-color: var(--primary-blue);
    box-shadow: 0 4px 12px rgba(15, 76, 129, 0.4);
    transform: scale(1.05);
    z-index: 2;
}

/* 被選中時，裡面的週次標籤和圓點要變色以適應深色背景 */
.day.selected .week-tag {
    background-color: rgba(255,255,255,0.3);
    color: #fff;
}
.day.selected .day-number {
    color: #fff;
}
/* 讓空格子不能點 */
.day.empty {
    pointer-events: none;
    cursor: default;
}

/* 右側清單的動畫優化 */
.events-wrapper {
    transition: opacity 0.3s;
}
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 顯示目前選取的日期標題 */
.current-selected-date {
    font-size: 0.9rem;
    color: var(--accent-blue);
    font-weight: 700;
    margin-left: 10px;
    background: #eef4f9;
    padding: 2px 8px;
    border-radius: 4px;
}

#footer{
    background-color: #1f2d40;
    color: #fff;
    padding: 2rem 0;
    /* text-align: center; */

    .footer-link{
        padding: 1rem 0;
        display: flex;
        /* flex-direction: column; */
        gap: 1rem;
    }

    a{
        color: #fff;
        text-decoration: none;
        font-size: 1.2rem;
    }

    a:hover{
        text-decoration: underline;
    }

    
    @media (max-width : 768px) {
        
        .footer-link{
            padding: 1rem 0;
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }
        
    }
}

/* 手機響應式 */
@media (max-width: 768px) {
  header {
    padding: 15px 20px;
    flex-wrap: wrap;
  }
  .nav-links {
    display: none;
  }
  .schedule-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .legend {
    gap: 10px;
    font-size: 0.8rem;
  }
  .footer-info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }
  .footer-links {
    flex-wrap: wrap;
  }
}