/* ==========================================================
   1. Page Banner (通用於內頁頂部形象圖)
   ========================================================== */

.page-banner {
  width: 100%;
  position: relative;
  /* Navbar 避讓邏輯 */
  margin-top: var(--nav-height-mobile, 45px);
  display: block;
}

/* Tablet */
@media (min-width: 768px) {
  .page-banner {
    margin-top: var(--nav-height-tablet, 55px);
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .page-banner {
    margin-top: var(--nav-height-desktop, 79px);
  }
}

.page-banner img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* ==========================================================
   2. 全域容器 (RWD Width Control)
   依據 variables.css 定義的寬度
   ========================================================== */
.x720-container {
  /* 核心：讀取 CSS 變數 */
  width: var(--container-fluid-width, 90%);

  /* 置中 */
  margin-left: auto;
  margin-right: auto;

  /* 避免貼邊 */
  padding-left: 15px;
  padding-right: 15px;
}

.section-teaching {
  padding-top: 1rem;
  padding-bottom: 4rem;
}

/* ==========================================================
   1. 標題與 Tabs
   ========================================================== */
.teaching-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.teaching-tabs {
  display: flex;
  gap: 10px;
  background: #f1f5f9;
  padding: 6px;
  border-radius: 999px;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 8px 20px;
  border-radius: 999px;
  font-weight: 600;
  color: #64748b;
  transition: all 0.3s ease;
}

.tab-btn.active {
  background: #fff;
  color: var(--primary-color, #000);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ==========================================================
   2. 篩選列與 Checkbox Chips
   ========================================================== */
.teaching-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  background: #fff;
  padding: 15px;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
}

.search-box {
  position: relative;
  flex: 1 1 250px;
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
}

.search-box input {
  padding-left: 40px;
  border-radius: 12px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* 隱藏原生 Checkbox，用 span 來當按鈕 */
.filter-chip input[type="checkbox"] {
  display: none;
}

.filter-chip span {
  display: inline-block;
  padding: 6px 14px;
  background: var(--secondary-color-2, #eaf4f8);
  color: var(--secondary-color-1, #2f3e46);
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  user-select: none;
}

.filter-chip input[type="checkbox"]:checked + span {
  background: var(--primary-color);
  color: #fff;
  font-weight: 500;
}

.action-group .btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* ==========================================================
   3. 卡片設計 (Card)
   ========================================================== */
.teaching-card {
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  cursor: pointer;
}

.teaching-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.teaching-card .cover {
  height: 160px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px; /* 給 Emoji 用的 */
  position: relative;
  overflow: hidden;
}

.teaching-card .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.teaching-card:hover .cover img {
  transform: scale(1.05);
}

.card-body-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-title {
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 8px;
  color: var(--color-header, #000);
}

.card-meta {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 12px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 15px;
}

.card-tags .tag {
  font-size: 0.75rem;
  background: #f1f5f9;
  color: #475569;
  padding: 3px 8px;
  border-radius: 6px;
}

.card-footer-btn {
  margin-top: auto;
  font-size: 0.9rem;
  color: var(--primary-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ==========================================================
   4. 右側抽屜 (Drawer) & Overlay
   ========================================================== */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 1040; /* 在 Bootstrap Modal 之下，但高於 Navbar */
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.drawer-overlay.show {
  opacity: 1;
  visibility: visible;
}

.teaching-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(600px, 100vw);
  background: #fff;
  z-index: 1050;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
}

.teaching-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: #f8fafc;
}

.drawer-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--secondary-color-1);
}

.drawer-meta {
  font-size: 0.85rem;
  color: #64748b;
}

.drawer-close {
  background: #e2e8f0;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  cursor: pointer;
  transition: background 0.2s;
}

.drawer-close:hover {
  background: #cbd5e1;
}

.drawer-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

/* Drawer 內部內容排版 */
.drawer-section {
  margin-bottom: 24px;
}

.drawer-section-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--secondary-color-1);
}

.drawer-section-title::before {
  content: "";
  display: block;
  width: 6px;
  height: 18px;
  background: var(--primary-color);
  border-radius: 4px;
}

.drawer-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.drawer-info-item {
  background: #f8fafc;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 0.95rem;
}

.drawer-media img {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid #e2e8f0;
}

.drawer-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  text-decoration: none;
  color: var(--secondary-color-1);
  transition: border-color 0.2s;
  margin: 0 8px 8px 0;
}

.drawer-file:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

@media (max-width: 576px) {
  .drawer-info-grid {
    grid-template-columns: 1fr;
  }
}
