/**
 * n8n Course Landing Page - Component Styles
 * Specific styling for each section component
 */

/* ===== COURSE MODULE COMPONENTS ===== */

.course-module {
  background: var(--background-card);
  border: 1px solid rgba(234, 75, 113, 0.2);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--duration-normal);
  position: relative;
}

.course-module::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--gradient-border);
}

.course-module:hover {
  border-color: rgba(234, 75, 113, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.module-header {
  display: flex;
  align-items: center;
  padding: var(--space-6);
  cursor: pointer;
  transition: background-color var(--duration-normal);
}

.module-header:hover {
  background: rgba(234, 75, 113, 0.05);
}

.module-node {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--node-inactive);
  margin-right: var(--space-4);
  transition: all var(--duration-normal);
  position: relative;
}

.module-node::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--n8n-pink);
  opacity: 0;
  transition: opacity var(--duration-normal);
}

.course-module:hover .module-node {
  background: var(--node-active);
  animation: nodePulse var(--pulse-speed) var(--ease-in-out) infinite;
}

.course-module:hover .module-node::before {
  opacity: 1;
}

.module-header h3 {
  flex: 1;
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.module-toggle {
  font-size: var(--text-2xl);
  color: var(--n8n-pink);
  transition: transform var(--duration-normal);
  line-height: 1;
}

.module-toggle.active {
  transform: rotate(45deg);
}

.module-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration-slow) var(--ease-out);
  background: rgba(234, 75, 113, 0.02);
}

.module-content.active {
  max-height: 300px;
}

.module-content ul {
  padding: 0 var(--space-6) var(--space-6);
  list-style: none;
}

.module-content li {
  padding: var(--space-2) 0;
  color: var(--text-secondary);
  position: relative;
  padding-left: var(--space-6);
}

.module-content li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--n8n-pink);
  font-weight: var(--font-bold);
}

/* ===== INSTRUCTOR CARD ===== */

.instructor-card {
  background: var(--background-card);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  position: relative;
  border: 1px solid rgba(234, 75, 113, 0.2);
  transition: all var(--duration-normal);
}

.instructor-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--gradient-border);
  mask: linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--duration-normal);
}

.instructor-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-glow);
}

.instructor-card:hover::before {
  opacity: 1;
}

.instructor-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto var(--space-6);
  position: relative;
  overflow: hidden;
}

.instructor-photo::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--gradient-border);
  z-index: -1;
}

.photo-placeholder {
  width: 100%;
  height: 100%;
  background: var(--background-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-bold);
  color: var(--text-primary);
  border-radius: 50%;
}

.instructor-info h4 {
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

.instructor-info p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.instructor-badges {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  margin-top: var(--space-4);
}

.badge {
  background: rgba(234, 75, 113, 0.1);
  color: var(--n8n-pink);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border: 1px solid rgba(234, 75, 113, 0.3);
}

/* ===== SERVICE CARDS ===== */

.service-card {
  background: var(--background-card);
  border: 1px solid rgba(255, 140, 66, 0.2);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  position: relative;
  overflow: hidden;
  transition: all var(--duration-normal);
  text-align: center;
}

.service-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--gradient-orange);
  mask: linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--duration-normal);
}

.service-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px var(--glow-orange);
  border-color: rgba(255, 140, 66, 0.4);
}

.service-card:hover::before {
  opacity: 1;
}

.service-card:hover .service-icon {
  animation: nodePulse 1.5s infinite;
  transform: scale(1.1);
}

.service-icon {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-4);
  transition: transform var(--duration-normal);
  display: block;
}

.service-card h3 {
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  font-size: var(--text-xl);
}

.service-card p {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* ===== TESTIMONIAL CARDS ===== */

.testimonial-card {
  height: 300px; /* 統一高度 */
  background: var(--background-card);
  border-radius: var(--radius-xl);
  overflow-y: auto;
  transition: all var(--duration-normal);
  animation: cardReveal var(--duration-slow) var(--ease-out) both;
  position: relative;
  border: 1px solid rgba(234, 75, 113, 0.2);
}

.testimonial-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

/* Override Threads embed styling for dark theme */
.testimonial-card .text-post-media {
  background: var(--background-card) !important;
  border: 1px solid rgba(234, 75, 113, 0.2) !important;
  border-radius: var(--radius-xl) !important;
  /* 移除 height 和 flex 讓 embed 正常渲染 */
}

/* 嵌入載入狀態樣式 */
.embed-container {
  height: 100%;
  width: 100%;
  position: relative;
}

.embed-loading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: var(--space-8);
  background: var(--background-card);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(234, 75, 113, 0.2);
  color: var(--text-secondary);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(234, 75, 113, 0.2);
  border-top: 3px solid var(--n8n-pink);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--space-4);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.embed-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: var(--space-8);
  background: var(--background-card);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--text-secondary);
  text-align: center;
}

.embed-error .error-icon {
  font-size: 2em;
  margin-bottom: var(--space-4);
}

.embed-error p {
  margin: 0 0 var(--space-4) 0;
  color: var(--text-primary);
}

/* 滾動條樣式 */
.testimonial-card .text-post-media::-webkit-scrollbar {
  width: 6px;
}

.testimonial-card .text-post-media::-webkit-scrollbar-track {
  background: var(--background-secondary);
}

.testimonial-card .text-post-media::-webkit-scrollbar-thumb {
  background: var(--n8n-pink);
  border-radius: 3px;
}

.testimonial-card .text-post-media::-webkit-scrollbar-thumb:hover {
  background: var(--n8n-secondary);
}

/* ===== CAROUSEL CONTROLS ===== */

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  margin-top: var(--space-8);
  position: relative;
}

/* 科技感按鈕設計 */
.carousel-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--background-card);
  border: 2px solid transparent;
  color: var(--text-primary);
  font-size: var(--text-xl);
  font-weight: bold;
  cursor: pointer;
  transition: all var(--duration-normal);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* 按鈕漸層邊框 */
.carousel-btn::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: var(--gradient-border);
  z-index: -1;
  opacity: 0;
  transition: opacity var(--duration-normal);
}

.carousel-btn:hover::before {
  opacity: 1;
}

.carousel-btn:hover {
  background: var(--n8n-pink);
  transform: scale(1.1);
  box-shadow: 0 0 20px var(--glow-primary);
}

.carousel-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.carousel-btn:disabled:hover::before {
  opacity: 0;
}

/* 改良版 dots - 進度條風格 */
.carousel-dots {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: var(--background-secondary);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  border: 1px solid rgba(234, 75, 113, 0.2);
}

.carousel-dot {
  width: 32px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--node-inactive);
  cursor: pointer;
  transition: all var(--duration-normal);
  position: relative;
  overflow: hidden;
}

.carousel-dot::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0%;
  height: 100%;
  background: var(--gradient-cta);
  border-radius: inherit;
  transition: width var(--duration-slow) var(--ease-out);
}

.carousel-dot.active {
  background: var(--n8n-pink);
  box-shadow: 0 0 10px var(--glow-primary);
}

.carousel-dot.active::after {
  width: 100%;
}

/* 輪播進度指示器 */
.carousel-progress {
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: var(--background-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.carousel-progress::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: var(--carousel-progress-width, 0%);
  height: 100%;
  background: var(--gradient-cta);
  border-radius: inherit;
  transition: width var(--duration-normal) var(--ease-out);
}

/* ===== FORM VALIDATION STATES ===== */

.form-group.error .form-input {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
}

.form-group.success .form-input {
  border-color: var(--n8n-secondary);
  box-shadow: 0 0 0 3px var(--glow-secondary);
}

.error-message {
  color: #ef4444;
  font-size: var(--text-sm);
  margin-top: var(--space-1);
  display: none;
}

.form-group.error .error-message {
  display: block;
  animation: slideInLeft 0.3s var(--ease-out);
}

/* ===== LOADING STATES ===== */

.button-loader {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  margin-left: var(--space-2);
  animation: spin 1s linear infinite;
  display: none;
}

.submit-button.loading .button-loader {
  display: inline-block;
}

.submit-button.loading {
  pointer-events: none;
  opacity: 0.7;
}

/* ===== FLOW VISUALIZATION ===== */

.flow-node {
  fill: var(--node-inactive);
  transition: all var(--duration-normal);
}

.flow-node.active {
  fill: var(--node-active);
  filter: drop-shadow(0 0 10px var(--glow-secondary));
}

.flow-line {
  stroke: var(--flow-line);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 10, 5;
  opacity: 0.6;
}

.flow-line.animated {
  animation: flowLine var(--flow-speed) var(--ease-in-out) infinite;
}

/* Data flow particles */
.data-particle {
  fill: var(--n8n-pink);
  opacity: 0;
  animation: dataFlow 3s var(--ease-in-out) infinite;
}

/* ===== SCROLL INDICATORS ===== */

.section-indicator {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60px;
  background: rgba(234, 75, 113, 0.2);
  border-radius: var(--radius-full);
  opacity: 0;
  transition: opacity var(--duration-normal);
}

.section-indicator::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: var(--n8n-pink);
  border-radius: inherit;
  transition: height var(--duration-slower) var(--ease-out);
}

.section.in-view .section-indicator {
  opacity: 1;
}

.section.in-view .section-indicator::before {
  height: 100%;
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */

/* Focus styles */
.btn:focus,
.form-input:focus,
.carousel-btn:focus {
  outline: 2px solid var(--n8n-pink);
  outline-offset: 2px;
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
  .service-card,
  .course-module,
  .instructor-card {
    border-width: 2px;
    border-color: var(--n8n-pink);
  }

  .module-node {
    border: 2px solid var(--n8n-pink);
  }
}

/* Print styles */
@media print {
  .hero-automation-bg,
  .carousel-controls,
  .cta-button {
    display: none;
  }

  .section {
    page-break-inside: avoid;
  }
}

/* ===== RESPONSIVE TESTIMONIAL CARDS ===== */

/* 大螢幕 - 保持 300px 高度 */
@media (min-width: 1400px) {
  .testimonial-card {
    height: 320px; /* 稍微增加一點高度 */
  }
}

/* 桌面和平板 - 標準高度 */
@media (max-width: 1024px) {
  .testimonial-card {
    height: 280px; /* 稍微縮小 */
  }
}

/* 手機樣式 - 考慮螢幕空間和觸控體驗 */
@media (max-width: 768px) {
  .testimonial-card {
    height: 350px; /* 手機上增加高度，讓內容更好閱讀 */
    font-size: 14px; /* 稍微縮小字體 */
  }

  /* 手機上的滾動條調整 */
  .testimonial-card::-webkit-scrollbar {
    width: 4px; /* 更細的滾動條 */
  }

  /* 手機上的 Threads 嵌入調整 */
  .testimonial-card .text-post-media {
    font-size: 13px !important;
  }
}

/* 小手機樣式 */
@media (max-width: 480px) {
  .testimonial-card {
    height: 320px; /* 小螢幕稍微降低高度 */
    margin-bottom: var(--space-2); /* 增加卡片間距 */
  }
}