:root {
  --bg-color: #f7f9fc;
  --card-bg: #ffffff;
  --primary: #4a6fa5;
  --primary-hover: #3b5a86;
  --secondary: #6e84a3;
  --text-dark: #1a202c;
  --text-muted: #718096;
  --border: #edf2f7;
  --highlight: #fffaf0;
  --highlight-border: #fbd38d;
  --radius: 16px;
  --font-base: 'Inter', 'Noto Sans TC', sans-serif;
}

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

body {
  font-family: var(--font-base);
  background-color: var(--bg-color);
  color: var(--text-dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background-color: var(--bg-color);
  box-shadow: 0 0 20px rgba(0,0,0,0.05); /* 讓桌面版顯示有邊界感 */
  padding: 16px;
}

/* Typography */
h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; color: #2d3748; }
h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }
.subtitle { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 1rem; }
.text-sm { font-size: 0.85rem; }
.body-text { font-size: 0.95rem; color: #4a5568; margin-bottom: 1rem; }

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
}
.card.highlight {
  background: var(--highlight);
  border: 1px solid var(--highlight-border);
}

/* Tags */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1rem;
}
.tag {
  background: #edf2f7;
  color: #4a5568;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* User Info Layout */
.instructor-preview, .instructor-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.avatar-small { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.avatar-large { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.instructor-info .name { font-weight: 600; display: block; font-size: 0.95rem; }
.instructor-info .title { font-size: 0.8rem; color: var(--text-muted); }

/* Rating line */
.rating-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.star-icon { color: #ecc94b; }
.score { font-weight: 700; }
.count { font-size: 0.85rem; color: var(--text-muted); }

/* Video Section */
.video-section { padding: 12px; }
.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
}
.video-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
  transition: opacity 0.3s;
}
.video-wrapper:hover .video-poster { opacity: 0.6; }
.play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  background: rgba(255,255,255,0.9);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding-left: 4px; /* visually center play icon */
}
.hidden-video {
  display: none;
  width: 100%;
  height: 100%;
}
.lock-hint {
  text-align: center;
  margin-top: 8px;
  color: var(--text-muted);
}

/* Tabs */
.sticky-tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(247, 249, 252, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  gap: 8px;
  padding: 12px 0;
  margin-bottom: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  flex: 1;
  min-width: 70px;
  background: none;
  border: none;
  padding: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
}
.tab-btn.active {
  color: var(--primary);
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0px;
  left: 10%;
  width: 80%;
  height: 3px;
  background: var(--primary);
  border-radius: 3px;
}

/* Tab contents */
.tab-contents { position: relative; }
.tab-pane { display: none; margin-bottom: 20px; }
.tab-pane.active { display: block; animation: fadeIn 0.4s ease; }

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

/* Features List */
.feature-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: #fff;
  border-radius: var(--radius);
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  border: 1px solid var(--border);
}
.feature-icon { font-size: 24px; }
.feature-text h3 { font-size: 1.05rem; margin-bottom: 4px; color: #2d3748; }
.feature-text p { font-size: 0.9rem; color: var(--text-muted); }

/* Locked Overlay */
.locked-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none; /* Let clicks pass unless it's the button */
  z-index: 5;
}
.blur-effect {
  position: absolute;
  top: 0; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to bottom, rgba(247,249,252,0) 0%, rgba(247,249,252,0.95) 70%, #f7f9fc 100%);
  pointer-events: auto;
}
.overlay-content {
  position: relative;
  z-index: 6;
  text-align: center;
  padding: 30px 20px;
  pointer-events: auto;
}
.overlay-content p {
  color: #4a5568;
  font-weight: 600;
  margin-bottom: 12px;
}
/* Parent layout needs strict relative pos */
#course-info, #instructor-info, #faq-info, #review-info {
  position: relative;
  overflow: hidden; /* clipping the overlay */
}

/* Buttons */
.btn {
  border: none;
  border-radius: 50px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  display: inline-block;
  text-align: center;
}
.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(74, 111, 165, 0.3);
}
.btn-primary:active { transform: scale(0.98); background: var(--primary-hover); }
.btn-secondary {
  background: white;
  color: var(--primary);
  border: 1px solid var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.btn-large { padding: 16px 24px; font-size: 1.05rem; }

/* Sticky Bottom */
.sticky-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  z-index: 100;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.03);
}
.bottom-padding { height: 100px; }

@media (min-width: 480px) {
  .sticky-bottom-bar {
    width: 480px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 20px 20px 0 0;
  }
}

/* Accordion */
.accordion-item {
  background: #fff;
  border-radius: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.accordion-header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  cursor: pointer;
  color: #2d3748;
}
.accordion-body {
  padding: 0 16px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  color: var(--text-muted);
  font-size: 0.95rem;
  background: #fafbfc;
}
.accordion-item.open .accordion-body {
  padding: 0 16px 16px 16px;
  max-height: 200px;
}
.icon-plus::after { content: '+'; font-size: 1.2rem; }
.accordion-item.open .icon-plus::after { content: '-'; }

/* Reviews */
.review-item {
  background: #fff;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.review-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;}
.review-user { display: flex; align-items: center; gap: 8px; }
.review-user img { width: 32px; height: 32px; border-radius: 50%; }
.review-user span { font-weight: 500; font-size: 0.9rem; }
.review-date { font-size: 0.8rem; color: #a0aec0; }
.review-rating { color: #ecc94b; font-size: 0.85rem; padding: 4px 0;}
.review-content { font-size: 0.9rem; color: #4a5568; }
.review-summary { text-align: center; margin-bottom: 20px; }

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(45, 55, 72, 0.95);
  color: #fff;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Article & Locked Images */
.article-content {
  margin-bottom: 24px;
}
.article-content h2 {
  font-size: 1.25rem;
  color: var(--primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.article-content p {
  font-size: 1rem;
  line-height: 1.8;
  color: #2d3748;
  margin-bottom: 16px;
}
.article-content p:last-child {
  margin-bottom: 0;
}
.locked-images-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.locked-image {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.locked-images-container.is-locked .locked-image {
  filter: blur(8px);
  opacity: 0.6;
  pointer-events: none;
}
.locked-images-container.is-locked .locked-image:nth-of-type(1) { filter: blur(5px); opacity: 0.8;}
.locked-images-container.is-locked .locked-image:nth-of-type(2) { filter: blur(10px); opacity: 0.6;}
.locked-images-container.is-locked .locked-image:nth-of-type(3) { filter: blur(15px); opacity: 0.4;}
.locked-images-container.is-locked .locked-image:nth-of-type(n+4) { display: none; }

.event-image {
  width: 100%;
  border-radius: 8px;
  margin-top: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
