/* ===================================================
   NTUMESA 全域變數設定：機械系質感配色（深藍 + 金屬銀灰）
   =================================================== */
:root {
  --primary-color: #0d3b66;       /* 系會主色：深海軍藍 */
  --primary-hover: #092642;
  --accent-color: #f4d35e;        /* 強調色：暖亮金黃 */
  --bg-color: #f8fafc;            /* 頁面淺灰背景 */
  --card-bg: #ffffff;             /* 卡片白底 */
  --text-primary: #1e293b;        /* 主文字顏色 */
  --text-secondary: #64748b;      /* 次要文字顏色 */
  --border-color: #e2e8f0;        /* 邊框線顏色 */
  --radius: 10px;                 /* 圓角弧度 */
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===================================================
   透明懸浮導覽列 (Overlay Header)
   =================================================== */
header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
  padding: 1.2rem 0;
}

.nav-wrap {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* 左側 Logo 區域 */
.site-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

.site-logo img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  padding: 2px;
  flex-shrink: 0;
}

.site-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  white-space: nowrap !important;
}

/* 右側導覽群組 */
.nav-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  align-items: center;
  margin: 0;
  padding: 0;
  white-space: nowrap !important;
}

.nav-links li {
  white-space: nowrap !important;
}

.nav-links a {
  text-decoration: none;
  color: #ffffff;
  font-weight: 600;
  font-size: 0.95rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  transition: opacity 0.2s;
  white-space: nowrap !important;
}

.nav-links a:hover {
  opacity: 0.8;
}

/* 藍色膠囊藥丸按鈕 (Pill Button) */
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #0070f3;
  color: #ffffff;
  padding: 0.45rem 1.1rem;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0, 112, 243, 0.3);
  transition: transform 0.15s, background 0.2s;
  white-space: nowrap !important;
  flex-shrink: 0;
}

.pill-btn:hover {
  background: #005bb5;
  transform: translateY(-1px);
}

/* 漢堡選單按鈕 (三條線) */
.hamburger-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  padding: 0;
  margin-left: 0.25rem;
  flex-shrink: 0;
}

.hamburger-btn span {
  display: block;
  height: 2.5px;
  width: 100%;
  background-color: #ffffff;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: all 0.3s;
}

/* 頁面主要容器 */
main {
  flex: 1;
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* ===================================================
   全螢幕滿版幻燈片輪播 (Hero Slider)
   =================================================== */
.slider-container {
  position: relative;
  width: 100vw;
  height: 85vh;
  min-height: 550px;
  overflow: hidden;
  background-color: #0f172a;
}

.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.slide.active {
  opacity: 1;
  z-index: 2;
}

.slide-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

/* 向下滾動小箭頭指示器 */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  color: #ffffff;
  font-size: 1.5rem;
  animation: bounce 2s infinite;
  cursor: pointer;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translate(-50%, 0); }
  40% { transform: translate(-50%, -10px); }
  60% { transform: translate(-50%, -5px); }
}

/* 幻燈片底部圓點指示器 */
.slider-dots {
  position: absolute;
  bottom: 2.5rem;
  right: 2.5rem;
  z-index: 10;
  display: flex;
  gap: 0.6rem;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.3s;
}

.dot.active {
  background: #ffffff;
  width: 26px;
  border-radius: 4px;
}

/* ===================================================
   側邊抽屜式選單 (Drawer / Modal)
   =================================================== */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.drawer-overlay.open {
  display: block;
  opacity: 1;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: -360px;
  width: 340px;
  height: 100%;
  background: #ffffff;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  padding: 2.5rem 1.75rem;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.drawer-overlay.open .drawer-panel {
  right: 0;
}

.drawer-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 1.8rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
}

.drawer-category {
  margin-top: 2rem;
}

.drawer-category h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 0.75rem;
  letter-spacing: 0.5px;
}

.drawer-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.drawer-list a {
  display: block;
  padding: 0.7rem 1rem;
  color: #1e293b;
  text-decoration: none;
  font-weight: 500;
  border-radius: 8px;
  background: #f8fafc;
  transition: all 0.2s;
}

.drawer-list a:hover {
  background: #e0f2fe;
  color: #0284c7;
}

/* ===================================================
   最新活動公告樣式
   =================================================== */
.announcement-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.announcement-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.15s ease;
}

.announcement-card:hover {
  transform: translateX(4px);
}

.announcement-info {
  flex: 1;
}

.announcement-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.announcement-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 20px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 600;
  margin-left: 0.5rem;
}

/* ===================================================
   成員團隊卡片樣式
   =================================================== */
.members-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3rem 2rem;
  max-width: 1050px;
  margin: 0 auto;
}

@media (max-width: 992px) {
  .members-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem 1.5rem;
  }
}

@media (max-width: 520px) {
  .members-grid {
    grid-template-columns: 1fr;
  }
}

.member-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  background: transparent;
  border: none;
  transition: transform 0.2s ease;
}

.member-item:hover {
  transform: translateY(-4px);
}

.member-avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  margin-bottom: 1.25rem;
  transition: box-shadow 0.2s ease;
}

.member-item:hover .member-avatar {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
}

.member-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.35rem;
}

.member-role {
  font-size: 1rem;
  font-weight: 500;
  color: #64748b;
  letter-spacing: 0.5px;
}

/* ===================================================
   成員聯絡資訊彈出視窗 (Contact Modal)
   =================================================== */
.contact-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.contact-modal-overlay.open {
  display: flex;
}

.contact-modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  padding: 2.25rem 2rem;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.2);
  animation: modalScaleUp 0.2s ease-out;
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.contact-modal-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
}

.contact-modal-close:hover {
  color: #334155;
}

.contact-modal-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 1rem auto;
  border: 1px solid #e2e8f0;
}

.contact-info-list {
  margin-top: 1.5rem;
  text-align: left;
  background: #f8fafc;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  font-size: 0.95rem;
  color: #334155;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.contact-info-list a {
  color: #0284c7;
  text-decoration: none;
  word-break: break-all;
}

.contact-info-list a:hover {
  text-decoration: underline;
}

/* ===================================================
   水平滑動活動卡片 (Horizontal Scroll Activities)
   =================================================== */
.activities-section {
  max-width: 1200px;
  margin: 4rem auto;
  padding: 0 1.5rem;
}

.activities-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.75rem;
}

.activities-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: 0.5px;
}

.activities-subtitle {
  font-size: 0.95rem;
  color: #64748b;
  margin-top: 0.25rem;
}

.activities-scroll-container {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  padding: 0.5rem 0.25rem 1.5rem 0.25rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.activities-scroll-container::-webkit-scrollbar {
  height: 8px;
}

.activities-scroll-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.activities-scroll-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.activities-scroll-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.activity-card {
  flex: 0 0 320px;
  scroll-snap-align: start;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.activity-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.activity-card-img-wrap {
  width: 100%;
  height: 180px;
  overflow: hidden;
  background-color: #f1f5f9;
  position: relative;
}

.activity-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.activity-card:hover .activity-card-img {
  transform: scale(1.05);
}

.activity-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
}

.activity-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.activity-date {
  font-size: 0.85rem;
  color: #0284c7;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.activity-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.activity-desc {
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 1.25rem;
  flex: 1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.activity-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.6rem 1rem;
  background-color: #0284c7;
  color: #ffffff;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.activity-btn:hover {
  background-color: #0369a1;
}

/* ===================================================
   活動日曆區塊 (修復：嚴格對齊 7 等分與等距間隙)
   =================================================== */
.calendar-section {
  width: 100%;
  max-width: 1000px;
  margin: 3.5rem auto;
  padding: 0 1rem;
  box-sizing: border-box;
}

.calendar-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.calendar-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: 2px;
  margin-bottom: 0.25rem;
}

.calendar-subtitle {
  font-size: 0.95rem;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.calendar-nav-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.cal-nav-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #334155;
  cursor: pointer;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  transition: all 0.2s;
  user-select: none;
}

.cal-nav-btn:hover {
  background-color: #f1f5f9;
  color: #0284c7;
}

.cal-month-display {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
  min-width: 140px;
  text-align: center;
}

/* 日曆外層包覆層（防止手機螢幕破版，支援水平滑動） */
.calendar-responsive-grid-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.cal-table-wrap {
  min-width: 680px;
  width: 100%;
}

/* 星期欄：使用與下方完全相同的 repeat(7, 1fr) 與 gap: 8px */
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 8px;
  width: 100%;
}

.cal-weekday {
  text-align: center;
  padding: 0.65rem 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

/* 日期網格：保證嚴格對齊 */
.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  width: 100%;
}

.cal-day-cell {
  background: #ffffff;
  border-radius: 10px;
  min-height: 95px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  border: 1px solid #e2e8f0;
  transition: all 0.15s ease;
  cursor: pointer;
  box-sizing: border-box;
}

.cal-day-cell:hover {
  border-color: #0284c7;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.08);
}

.cal-day-cell.other-month {
  background: #f8fafc;
  opacity: 0.45;
  cursor: default;
}

.cal-day-cell.today .cal-day-num {
  background: #0284c7;
  color: #ffffff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cal-day-num {
  font-size: 0.9rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 4px;
}

.cal-event-chips {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.cal-event-chip {
  font-size: 0.72rem;
  padding: 3px 6px;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 3px solid #0284c7;
  cursor: pointer;
  transition: all 0.15s ease;
  display: block;
}

.cal-event-chip:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}

.cal-event-chip.multi-day {
  background: #fef3c7;
  color: #92400e;
  border-left-color: #f59e0b;
}

/* 當天活動詳細面板 */
.cal-details-card {
  margin-top: 1.5rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.cal-details-card.active {
  display: block;
}

.cal-details-header {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cal-details-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ===================================================
   資料庫橫幅區塊 (NTUME Database Banner)
   =================================================== */
.db-banner-section {
  max-width: 1100px;
  margin: 3.5rem auto;
  padding: 0 1.5rem;
}

.db-banner-card {
  background-color: #dbeafe;
  border-radius: 28px;
  padding: 3.5rem 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(191, 219, 254, 0.35);
}

.db-banner-content {
  max-width: 500px;
}

.db-banner-title {
  font-size: 2rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 0.4rem;
  letter-spacing: -0.5px;
}

.db-banner-subtitle {
  font-size: 1.15rem;
  color: #334155;
  font-weight: 600;
  margin-bottom: 2.2rem;
}

.db-banner-btn {
  display: inline-block;
  padding: 0.75rem 2.2rem;
  border: 1.5px solid #475569;
  border-radius: 9999px;
  color: #1e293b;
  background: transparent;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.db-banner-btn:hover {
  background-color: #ffffff;
  border-color: #0284c7;
  color: #0284c7;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
}

.db-banner-img-wrap {
  flex-shrink: 0;
  margin-left: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .db-banner-card {
    flex-direction: column-reverse;
    text-align: center;
    padding: 2.5rem 1.5rem;
    gap: 2rem;
  }
  .db-banner-img-wrap {
    margin-left: 0;
  }
  .db-banner-subtitle {
    margin-bottom: 1.8rem;
  }
}

footer {
  text-align: center;
  padding: 2rem;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===================================================
   全站導覽列小螢幕/手機防折字與破版修復
   =================================================== */

/* 1. 寬度不足 (<= 960px) 時：隱藏桌機版文字連結，讓漢堡選單接手 */
@media (max-width: 960px) {
  .nav-wrap {
    padding: 0 1.25rem !important;
  }

  .nav-links {
    display: none !important;
  }

  .nav-right {
    gap: 0.75rem !important;
  }

  .site-title {
    font-size: 1.1rem !important;
  }

  .pill-btn {
    padding: 0.38rem 0.85rem !important;
    font-size: 0.85rem !important;
  }
}

/* 2. 手機螢幕 (<= 640px) */
@media (max-width: 640px) {
  .nav-wrap {
    padding: 0 1rem !important;
  }

  .site-title {
    font-size: 1rem !important;
  }

  .site-logo img {
    width: 30px !important;
    height: 30px !important;
  }

  .pill-btn {
    padding: 0.32rem 0.7rem !important;
    font-size: 0.8rem !important;
  }
}

/* 3. 超窄手機 (<= 400px，如 iPhone SE) */
@media (max-width: 400px) {
  .site-title {
    font-size: 0.9rem !important;
  }

  .pill-btn {
    padding: 0.28rem 0.55rem !important;
    font-size: 0.75rem !important;
  }
}
