/* ==========================================
   flex-message.css — LINE Flex Message 渲染樣式
   仿照 LINE 官方 Flex Message 佈局規範
   ========================================== */

/* ── Carousel 容器 ── */
.flex-carousel {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.2) transparent;
  max-width: 290px;
}
.flex-carousel::-webkit-scrollbar { height: 4px; }
.flex-carousel::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 2px; }

/* ── Bubble 卡片 ── */
.flex-bubble {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--flex-shadow);
  min-width: 180px;
  max-width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s;
}
.flex-bubble:hover { transform: translateY(-2px); }

/* 大尺寸 bubble（分類主頁用） */
.flex-bubble.size-lg {
  min-width: 220px;
  max-width: 240px;
}

/* ── Hero 圖片區 ── */
.flex-hero {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  position: relative;
  overflow: hidden;
}

.flex-hero.hero-green { background: linear-gradient(135deg, #06C755, #04A849); }
.flex-hero.hero-purple { background: linear-gradient(135deg, #9B59B6, #6C3483); }
.flex-hero.hero-blue { background: linear-gradient(135deg, #3498DB, #1A5276); }
.flex-hero.hero-orange { background: linear-gradient(135deg, #E67E22, #A04000); }
.flex-hero.hero-pink { background: linear-gradient(135deg, #E91E8C, #C0177A); }
.flex-hero.hero-teal { background: linear-gradient(135deg, #1ABC9C, #0E8A79); }
.flex-hero.hero-gray { background: linear-gradient(135deg, #95A5A6, #6C7A7D); }
.flex-hero.hero-yellow { background: linear-gradient(135deg, #F1C40F, #B7950B); }

/* ── Body ── */
.flex-body {
  padding: 14px 14px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flex-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.4;
}

.flex-subtitle {
  font-size: 12px;
  color: #666;
  line-height: 1.4;
}

.flex-text {
  font-size: 12px;
  color: #444;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 詳情頁全文顯示（不截斷）*/
.flex-text.full-text {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}

/* ── 標籤列 ── */
.flex-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.flex-tag {
  background: #F0FFF4;
  border: 1px solid #B2DFDB;
  color: #1B8A6B;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
}

/* ── Footer 按鈕區 ── */
.flex-footer {
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flex-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-family: 'Noto Sans TC', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-align: center;
}
.flex-btn:active { transform: scale(0.97); }

.flex-btn.primary {
  background: var(--line-green);
  color: white;
}
.flex-btn.primary:hover { opacity: 0.9; }

.flex-btn.secondary {
  background: #F0F0F0;
  color: #333;
}
.flex-btn.secondary:hover { background: #E0E0E0; }

.flex-btn.outline {
  background: white;
  border: 1.5px solid var(--line-green);
  color: var(--line-green);
}
.flex-btn.outline:hover { background: #F0FFF4; }

/* ── 分隔線 ── */
.flex-separator {
  height: 1px;
  background: #EEE;
  margin: 6px 0;
}

/* ==========================================
   特殊類型：分類大卡
   ========================================== */
.category-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--flex-shadow);
  min-width: 140px;
  max-width: 155px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.category-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.category-card-hero {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

.category-card-body {
  padding: 10px 12px 12px;
}

.category-card-name {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.category-card-count {
  font-size: 11px;
  color: #999;
}

/* ==========================================
   Special：Episode List Item
   ========================================== */
.flex-list {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--flex-shadow);
  width: 280px;
}

.flex-list-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid #EEE;
}

.flex-list-title {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
}

.flex-list-subtitle {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.flex-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #F5F5F5;
  cursor: pointer;
  transition: background 0.15s;
}
.flex-list-item:hover { background: #F9F9F9; }
.flex-list-item:last-child { border-bottom: none; }

.yt-source-badge {
  background-color: var(--danger);
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  display: inline-block;
  vertical-align: middle;
}
.fb-source-badge {
  background-color: #1877F2;
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  display: inline-block;
  vertical-align: middle;
}

.flex-list-ep {
  background: var(--line-green);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.flex-list-item-title {
  font-size: 12px;
  color: #333;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.flex-list-arrow {
  color: #CCC;
  font-size: 16px;
  flex-shrink: 0;
}

/* ── 底部導覽按鈕（Flex Footer in List） ── */
.flex-list-footer {
  padding: 10px 16px;
  display: flex;
  gap: 8px;
}

/* ==========================================
   搜索結果卡 
   ========================================== */
.search-result-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--flex-shadow);
  width: 200px;
  flex-shrink: 0;
}

.search-result-header {
  padding: 12px 14px 8px;
  border-bottom: 1px solid #EEE;
}

.search-result-ep {
  display: inline-block;
  background: #EEF7FF;
  color: #2196F3;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
}

.search-result-title {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-body {
  padding: 10px 14px;
}

.search-result-summary {
  font-size: 11px;
  color: #666;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-score {
  font-size: 10px;
  color: #aaa;
  margin-top: 6px;
}

.search-result-footer {
  padding: 0 14px 12px;
}

/* AI 回答泡泡 */
.ai-answer-bubble {
  background: white;
  border-radius: 4px 18px 18px 18px;
  padding: 12px 16px;
  max-width: 250px;
  font-size: 13px;
  line-height: 1.6;
  color: #1a1a1a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.ai-answer-label {
  font-size: 10px;
  color: var(--line-green);
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* 子分類選單 */
.subcategory-menu {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--flex-shadow);
  width: 270px;
}

.subcategory-menu-header {
  padding: 14px 16px;
  border-bottom: 1px solid #EEE;
}

.subcategory-menu-title {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
}

.subcategory-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #F5F5F5;
  cursor: pointer;
  transition: background 0.15s;
}
.subcategory-item:hover { background: #F9F9F9; }
.subcategory-item:last-child { border-bottom: none; }

.subcategory-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.subcategory-icon { font-size: 20px; }

.subcategory-name { font-size: 13px; font-weight: 600; color: #1a1a1a; }
.subcategory-count { font-size: 11px; color: #999; margin-top: 1px; }

.subcategory-arrow { color: #CCC; font-size: 16px; }

/* ==========================================
   YouTube 相關樣式
   ========================================== */

/* 詳細頁 - 主 YouTube 按鈕 */
.flex-btn.yt-btn {
  background: #FF0000;
  color: white;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 4px;
}
.flex-btn.yt-btn:hover { background: #CC0000; }

/* 詳細頁 - Facebook 連結按鈕 */
.flex-btn.fb-btn {
  background: #1877F2;
  color: white;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 4px;
}
.flex-btn.fb-btn:hover { background: #145DBF; }

/* 搜索卡 - 小型 YouTube 按鈕 */
.flex-btn.yt-btn-sm {
  background: #FFF0F0;
  border: 1.5px solid #FF4444;
  color: #CC0000;
  font-weight: 600;
  font-size: 12px;
  padding: 7px;
}
.flex-btn.yt-btn-sm:hover { background: #FFE0E0; }

/* 列表項目內的 YouTube 小徽章 */
.yt-badge {
  display: inline-block;
  background: #FF0000;
  color: white;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
  font-weight: 700;
}

/* 搜索結果 Header 的 YT 徽章 */
.yt-badge-sm {
  background-color: var(--danger);
  color: white;
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 700;
}
.fb-badge-sm {
  background-color: #1877F2;
  color: white;
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 700;
}

/* 詳細頁 - 來源標示列 */
.ep-source-label {
  margin-bottom: 6px;
}

.yt-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #FFF0F0;
  border: 1px solid #FF4444;
  color: #CC0000;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}
