/* =========================================
   1. 基礎設定 (Base & Reset)
   ========================================= */
body, html {
    margin: 0; padding: 0;
    font-family: 'Noto Sans TC', sans-serif;
    /* 預設背景色，各頁面可由自己的 <style> 覆蓋 */
    background-color: #f8f9fa; 
    color: #333;
    /* 預設捲動行為 */
    scroll-behavior: smooth;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; padding: 0; margin: 0; }
iframe { border: none; display: block; width: 100%; height: 100%; }


/* =========================================
   2. 導覽列與選單 (Navbar & Drawer)
   ========================================= */
.navbar {
    position: sticky; top: 0; left: 0; width: 100%;
    background: rgba(220, 236, 219, 0.95);
    backdrop-filter: blur(10px);
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 20px; box-sizing: border-box;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.nav-logo img { height: 40px; display: block; }
@media (max-width: 768px) { .nav-logo img { height: 35px; } } /* 不一樣的 */

.menu-toggle { font-size: 24px; cursor: pointer; color: #2F5D48; padding: 5px; }

/* 抽屜選單容器 */
.menu-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1050;
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.menu-backdrop.active { opacity: 1; pointer-events: auto; }

.drawer-menu {
    position: fixed; top: 0; right: -350px; width: 350px; height: 100vh;
    background: #2F5D48; z-index: 1100;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: right 0.3s ease; box-shadow: -5px 0 15px rgba(0,0,0,0.2);
}
.drawer-menu.active { right: 0; }

.close-btn { position: absolute; top: 20px; right: 20px; color: white; font-size: 30px; cursor: pointer; }

.menu-link {
    color: white; font-size: 22px; font-weight: 700; margin: 20px 0;
    text-decoration: none; position: relative;
}
.menu-link::after {
    content: ''; position: absolute; width: 0; height: 2px; bottom: -5px; left: 50%;
    background: #C07858; transition: 0.3s; transform: translateX(-50%);
}
.menu-link:hover::after { width: 100%; }

@media (max-width: 768px) { .drawer-menu { width: 85%; right: -85%; } }

/* =========================================
   3. App 模式骨架 (App Layout)
   適用於: Booking, Schedule, ClassCheck, PrivateCheck
   ========================================= */
/* 鎖定高度，讓 Iframe 自適應 */
body.app-mode {
    height: 100vh;
    overflow: hidden;
    background-color: #dcecdb; /* 統一綠底 */
    display: flex;
    flex-direction: column;
}

/* App 模式下的導覽列微調 (不用 sticky) */
body.app-mode .navbar {
    position: relative; 
    flex: 0 0 auto;
    border-bottom: 1px solid #c5d6c6;
    padding: 10px 15px;
}

/* Iframe 滿版容器 */
.app-frame-container, .iframe-container {
    flex: 1 1 auto; width: 100%; position: relative; 
    overflow: hidden; background: white;
}

/* =========================================
   4. 共用元件: Tabs & Info Box (說明框)
   ========================================= */
/* Tabs 頁籤 */
.tabs-container {
    background: #dcecdb; flex: 0 0 auto;
    display: flex; justify-content: center; padding: 10px 0 0 0;
}
.tab-btn {
    text-decoration: none; padding: 8px 20px;
    font-size: 14px; font-weight: 700; color: #555;
    background: rgba(255,255,255,0.4);
    border-top-left-radius: 10px; border-top-right-radius: 10px;
    margin: 0 2px; transition: 0.2s; position: relative; top: 1px;
    border: 1px solid transparent;
}
.tab-btn.active {
    background: white; color: #2F5D48;
    border-color: #c5d6c6; border-bottom-color: white; z-index: 2;
}
.tab-btn:hover { background: rgba(255,255,255,0.7); color: #2F5D48; }

/* 控制列 (標題與說明開關) */
.controls-bar {
    background-color: #fff; flex: 0 0 auto;
    padding: 8px 10px; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #c5d6c6; position: relative; z-index: 1;
}
.page-title { font-size: 16px; font-weight: 900; color: #2F5D48; padding-left: 5px; }

/* 說明開關按鈕 */
.btn-style-outline {
    background: transparent; border: 1px solid #1F4E5F; color: #1F4E5F;
    padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: bold;
    cursor: pointer; display: flex; align-items: center; gap: 5px;
}
.btn-style-outline.active {
    border-color: #8E3535; color: #8E3535; background-color: rgba(142, 53, 53, 0.05);
}

/* 說明框容器 */
.info-wrapper {
    max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out;
    width: 100%; flex: 0 0 auto; 
    background: white; /* 預設白色 */
}
.info-wrapper.open { max-height: 2000px; border-bottom: 1px dashed #2F5D48; }

/* 內容排版 */
.content-inner { padding: 10px; text-align: center; }

/* Quick Tips 清單 */
.quick-tips {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 15px;
    font-size: 13px; color: #333; line-height: 1.6;
    background: #f9f9f9; padding: 10px; border-radius: 8px;
    max-width: 800px; margin: 0 auto; border: 1px dashed #c5d6c6; text-align: left;
}
.tip-box { flex: 1; min-width: 200px; }
.tip-title { font-weight: 900; color: #2F5D48; display: block; margin-bottom: 5px; border-bottom: 2px solid #c5d6c6; }
.tip-list li { padding-left: 14px; position: relative; margin-bottom: 3px; }
.tip-list li::before { content: '•'; position: absolute; left: 0; color: #1F4E5F; font-weight: bold; }
.highlight-label { font-weight: 700; color: #1F4E5F; }

@media (max-width: 767px) {
    .quick-tips { flex-direction: column; gap: 10px; }
    .info-wrapper.open { max-height: 80vh; overflow-y: auto; }
}

/* 🟢 例外處理: 綠色背景主題 (給 Schedule 頁面用) */
.info-wrapper.theme-green { background: #dcecdb; }
.info-wrapper.theme-green .quick-tips { background: rgba(255,255,255,0.5); }
.controls-bar.theme-green { background: #dcecdb; }

/* 老師與管理員專用標題列 (改用深藍色區分)*/
.header-teacher { 
    background: #1F4E5F; 
    color: white; 
    padding: 8px; 
    text-align: center; 
    font-weight: bold; 
    font-size: 16px; 
    flex: 0 0 auto; 
}

/* 2026 新增功能 */

/* =========================================
   全站公告系統樣式 (Project 13 Frontend - V2)
   ========================================= */

/* --- 1. 遮罩與彈窗本體 --- */
.promo-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); z-index: 9995;
  display: flex; justify-content: center; align-items: center;
  opacity: 0; visibility: hidden; transition: opacity 0.3s;
}
.promo-overlay.show { opacity: 1; visibility: visible; }

.promo-card {
  background: white; width: 90%; max-width: 450px;
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3); position: relative;
  display: flex; flex-direction: column; /* 讓標題與內容垂直排列 */
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* --- ★ 新增：頂部固定大標題 --- */
.promo-header-title {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  padding: 15px 0 10px 0;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 0;
  background: #fff;
}

/* --- 2. 輪播結構 --- */
.promo-slider { position: relative; width: 100%; overflow: hidden; }
.promo-slides-wrapper { display: flex; transition: transform 0.5s ease; }
.promo-slide { min-width: 100%; box-sizing: border-box; display: flex; flex-direction: column; }

/* 圖片與文字內容 */
.promo-img-box { width: 100%; height: auto; overflow: hidden; background: #f9f9f9; text-align: center;}
.promo-img-box img { width: 100%; height: auto; max-height: 250px; object-fit: cover; display: block; margin: 0 auto; cursor: zoom-in; }

/* ★ 修改：增加左右 Padding (45px) 避開箭頭 */
.promo-text-box { 
  padding: 20px 45px; /* 左右留 45px 給箭頭，避免擋字 */
  text-align: center; 
}

.promo-title { font-size: 18px; font-weight: bold; color: #2F5D48; margin-bottom: 8px; }
.promo-desc { font-size: 14px; color: #555; line-height: 1.6; margin-bottom: 20px; white-space: pre-line; text-align: left; }

/* 按鈕群組 */
.promo-actions { display: flex; gap: 10px; justify-content: center; width: 100%; }
.btn-later, .btn-accept {
  flex: 1; /* 只有一顆按鈕時會自動填滿 */
  padding: 10px; border-radius: 8px; border: none;
  font-size: 14px; cursor: pointer; font-weight: bold;
  text-decoration: none; display: inline-block; text-align: center;
  box-sizing: border-box;
}
.btn-later { background: #f0f0f0; color: #666; }
.btn-accept { background: #2F5D48; color: white; }
.btn-later:hover { background: #e0e0e0; }
.btn-accept:hover { background: #234a38; }

/* --- 3. 輪播控制元件 --- */
.promo-arrow {
  position: absolute; 
  top: 50%; /* 垂直置中 */
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.8); color: #2F5D48;
  border: 1px solid #eee; /* 加個細邊框更清楚 */
  border-radius: 50%; width: 32px; height: 32px;
  font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1); z-index: 5; transition: 0.2s;
}
.promo-arrow:hover { background: #2F5D48; color: white; border-color: #2F5D48; }
/* ★ 修改：箭頭貼齊邊緣 */
.promo-prev { left: 5px; }
.promo-next { right: 5px; }

.promo-dots { display: flex; justify-content: center; gap: 8px; margin-top: 5px; margin-bottom: 15px; }
.promo-dot { width: 8px; height: 8px; background: #ddd; border-radius: 50%; cursor: pointer; transition: 0.3s; }
.promo-dot.active { background: #2F5D48; transform: scale(1.2); }

/* =========================================
   鈴鐺按鈕 (Bell) - 最終修正版 (V5)
   ========================================= */

.promo-minimized-btn {
  /* --- 共用基礎設定 --- */
  width: 32px; height: 32px;
  /* --- 視覺輕量化 --- */
  background: rgba(255, 255, 255, 0.5); /* 平常是半透明的，不搶眼 */
  color: #555; /* 深灰色鈴鐺 */
  border: none; /* ★ 拿掉邊框 */
  box-shadow: none; /* ★ 拿掉陰影 */
  border-radius: 50%;

  display: flex; /* 讓鈴鐺圖案置中 */
  justify-content: center; 
  align-items: center;
  
  font-size: 18px; cursor: pointer;
  z-index: 99999; /* 確保在最上層 */
  
  /* 動畫 */
  transform: scale(0);
  transition: all 0.2s ease-out;
}

/* 顯示時的狀態 */
.promo-minimized-btn.show {
  transform: scale(1);
}

/* ★ 懸停效果：滑鼠移過去才變明顯 */
.promo-minimized-btn:hover {
  background: #ffffff; /* 變回實心白 */
  color: #2F5D48; /* 鈴鐺變主色綠 */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); /* 浮起來的陰影 */
  transform: scale(1.1);
}

/* =========================================
   ★ 情境 A：首頁 (Hero Section) 特別處理 ★
   因為首頁漢堡是 absolute，鈴鐺也必須是 absolute
   ========================================= */
.hero-section .promo-minimized-btn {
  position: absolute;
  top: 24px;   /* 跟漢堡選單一樣高 */
  right: 65px; /* 漢堡是 right:20px，我們往左推 50px (20+40+10) */
  margin-right: 0; /* 首頁不需要 margin，是用座標定位的 */
}

/* =========================================
   ★ 情境 B：其他內頁 (Navbar) ★
   內頁是用 Flex 排版，鈴鐺要乖乖排隊
   ========================================= */
.navbar .promo-minimized-btn {
  position: relative; /* 跟隨排版 */
  margin-left: auto;
  margin-right: 10px; /* 跟漢堡保持距離 */
  top: auto;
  right: auto;
}

/* --- 手機版 RWD 微調 --- */
@media (max-width: 480px) {
  /* 首頁手機版調整 */
  .hero-section .promo-minimized-btn {
    width: 32px; height: 32px; font-size: 16px;
    top: 24px;
    right: 55px; /* 手機版漢堡可能比較大或位置不同，這裡微調 */
  }
  
  /* 內頁手機版調整 */
  .navbar .promo-minimized-btn {
    width: 32px; height: 32px; font-size: 16px;
    margin-right: 5px;
  }
}

/* --- 5. 燈箱效果 --- */
.promo-lightbox {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.9); z-index: 10000;
  display: flex; justify-content: center; align-items: center;
  opacity: 0; visibility: hidden; transition: opacity 0.3s; cursor: zoom-out;
}
.promo-lightbox.active { opacity: 1; visibility: visible; }
.promo-lightbox img {
  max-width: 95%; max-height: 95%;
  border-radius: 4px; box-shadow: 0 0 20px rgba(255,255,255,0.1);
  transform: scale(0.9); transition: transform 0.3s;
}
.promo-lightbox.active img { transform: scale(1); }
.lightbox-hint { position: absolute; bottom: 20px; color: #ccc; font-size: 14px; pointer-events: none; }