/**
 * n8n Course Landing Page - Main Styles
 * Layout, typography, and base components
 */

/* ===== RESET & BASE ===== */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-primary);
  background: var(--background-primary);
  color: var(--text-primary);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ===== TYPOGRAPHY ===== */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-4);
}

h1 {
  font-size: var(--text-5xl);
  font-weight: var(--font-bold);
}

h2 {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
}

h3 {
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
}

h4 {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
}

p {
  margin-bottom: var(--space-4);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* Gradient text effect */
.gradient-text {
  background: linear-gradient(135deg, #EA4B71, #e74266, #f55a82);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

/* ===== LAYOUT SYSTEM ===== */

.container {
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.section {
  padding: var(--space-24) 0;
  position: relative;
}

.section-title {
  text-align: center;
  margin-bottom: var(--space-16);
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--gradient-orange);
  border-radius: var(--radius-full);
}

/* ===== GRID SYSTEM ===== */

.grid {
  display: grid;
  gap: var(--grid-gap);
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ===== FLEXBOX UTILITIES ===== */

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ===== HERO SECTION ===== */

/* ===== HERO SECTION ===== */

.hero-section {
  min-height: 30vh;
  position: relative;
  display: flex;
  align-items: center;
  background: var(--background-primary);
  padding: var(--space-24) 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
  align-items: center;
  min-height: 25vh;
}

.hero-content {
  padding: var(--space-8) 0;
  text-align: left;
}

.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-image-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 140, 66, 0.1);
  transform: translateY(0) scale(1);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 140, 66, 0.2);
  animation: heroImageFloat 6s ease-in-out infinite;
}

@keyframes heroImageFloat {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-10px) scale(1.01);
  }
}

.hero-image-container:hover {
  transform: translateY(-20px) scale(1.05);
  box-shadow:
    0 40px 80px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 140, 66, 0.3),
    0 0 60px rgba(255, 140, 66, 0.2);
  animation-play-state: paused;
}

.hero-banner-image {
  width: 100%;
  height: auto;
  display: block;
  filter: brightness(1.1) contrast(1.05);
}

.hero-image-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 140, 66, 0.1), rgba(255, 179, 71, 0.05));
  border-radius: inherit;
  opacity: 0;
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.hero-image-container:hover .hero-image-glow {
  opacity: 1;
  background: linear-gradient(135deg, rgba(255, 140, 66, 0.15), rgba(255, 179, 71, 0.1));
}

.hero-decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  opacity: 0.02;
}

.flow-diagram {
  width: 100%;
  height: 100%;
  position: absolute;
}

/* Hero content styles */

/* Mobile responsiveness */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-12);
    text-align: center;
  }

  .hero-content {
    text-align: center;
    order: 2;
  }

  .hero-visual {
    order: 1;
  }

  .hero-image-container {
    max-width: 500px;
    animation: none;
    transform: translateY(0) scale(1);
  }

  .hero-image-container:hover {
    transform: translateY(-8px) scale(1.03);
  }
}

.hero-title {
  font-size: clamp(var(--text-4xl), 5vw, var(--text-6xl));
  margin-bottom: var(--space-6);
  color: var(--text-primary);
  font-weight: var(--font-bold);
  line-height: 1.1;
  animation: heroTitleReveal 1s var(--ease-out) forwards;
}

.hero-subtitle {
  font-size: var(--text-xl);
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
  line-height: var(--leading-relaxed);
  font-weight: var(--font-normal);
  animation: cardReveal 1s var(--ease-out) 0.3s both;
}

/* ===== BUTTONS ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--button-padding-y) var(--button-padding-x);
  font-size: var(--button-font-size);
  font-weight: var(--button-font-weight);
  text-decoration: none;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.cta-button {
  background: linear-gradient(135deg, #EA4B71, #e74266, #f55a82);
  color: white;
  padding: var(--space-5) var(--space-12);
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  border: none;
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
  animation: cardReveal 1s var(--ease-out) 0.6s both;
  cursor: pointer;
  transition: all var(--duration-normal);
  box-shadow: 0 8px 25px 0 rgba(234, 75, 113, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.cta-button::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: var(--gradient-border);
  z-index: -1;
  opacity: 0;
  transition: opacity var(--duration-normal);
}

.cta-button:hover::before {
  opacity: 1;
}

.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px 0 rgba(234, 75, 113, 0.4);
  background: linear-gradient(135deg, #e74266, #f55a82, #EA4B71);
}

.button-flow-icon {
  margin-left: var(--space-2);
  transition: transform var(--duration-normal);
}

.cta-button:hover .button-flow-icon {
  transform: translateX(var(--space-1));
}

/* ===== COURSE SECTION ===== */

.course-section {
  padding: var(--space-24) 0;
  background: var(--background-secondary);
  position: relative;
}

.course-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-12);
  margin-top: var(--space-16);
}

.course-outline-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* ===== UGC SECTION ===== */

.ugc-section {
  padding: var(--space-32) 0;
  background: var(--background-primary);
}

.ugc-grid-container {
  position: relative;
  margin-top: var(--space-20);
  margin-bottom: var(--space-8);
  border-radius: var(--radius-xl);
  background: var(--background-secondary);
  border: 1px solid rgba(234, 75, 113, 0.2);
  padding: var(--space-8);
}


.ugc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 個一列 */
  gap: var(--space-6);
  width: 100%;
}

@media (max-width: 1024px) {
  .ugc-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 個一列 */
  }
}

@media (max-width: 768px) {
  .ugc-grid {
    grid-template-columns: 1fr; /* 1 個一列 */
    gap: var(--space-4);
  }
  .ugc-grid-container {
    border-radius: var(--radius-lg); /* 手機上稍微減少圓角 */
    margin-top: var(--space-18);
    margin-bottom: var(--space-6);
    padding: var(--space-6);
  }

}

/* 小手機額外調整 */
@media (max-width: 480px) {
  .ugc-grid-container {
    margin-top: var(--space-16); /* 保持適當上邊距 */
    margin-bottom: var(--space-6);
    padding: var(--space-4);
  }

  .ugc-grid {
    gap: var(--space-3);
  }
}

/* ===== SERVICES SECTION ===== */

.services-section {
  padding: var(--space-24) 0;
  background: var(--background-secondary);
  position: relative;
}

.services-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--gradient-orange);
  z-index: 1;
}


.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-8);
  margin-top: var(--space-16);
}

/* ===== FORM SECTION ===== */

.form-section {
  padding: var(--space-24) 0;
  background: var(--background-primary);
  position: relative;
}

.form-container {
  background: var(--background-card);
  border-radius: var(--radius-3xl);
  padding: var(--space-16);
  position: relative;
  max-width: 600px;
  margin: 0 auto;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(234, 75, 113, 0.1);
}

.form-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--gradient-border);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

.form-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: var(--space-12);
  font-size: var(--text-lg);
}

.form-section .section-title {
  color: var(--text-primary);
  font-weight: var(--font-bold);
  font-size: var(--text-3xl);
}

/* ===== FORM STYLES ===== */

.registration-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* ===== MODERN FLOATING LABEL FORM ===== */

.form-row {
  display: none; /* Hidden for mobile-first design */
}

.form-group {
  position: relative;
  margin-bottom: var(--space-6);
}

.form-group.floating-label {
  margin-bottom: var(--space-8);
}

.form-label {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--background-secondary);
  padding: 0 var(--space-2);
  z-index: 2;
}

.form-input {
  width: 100%;
  background: var(--background-secondary);
  border: 2px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-4);
  font-size: var(--text-base);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1;
  -webkit-appearance: none;
  box-sizing: border-box;
}

.form-input:focus,
.form-input:not(:placeholder-shown) {
  outline: none;
  border-color: var(--n8n-pink);
  background: var(--background-secondary);
  box-shadow: 0 0 0 3px var(--glow-primary);
}

.form-input:focus + .form-label,
.form-input:not(:placeholder-shown) + .form-label,
.form-input:valid + .form-label {
  top: 0;
  transform: translateY(-50%);
  font-size: var(--text-sm);
  color: white;
  font-weight: var(--font-medium);
}

.form-underline {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #EA4B71, #e74266);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input:focus ~ .form-underline {
  width: 100%;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .form-input {
    padding: var(--space-4);
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .form-label {
    left: var(--space-4);
    font-size: var(--text-base);
  }

  .form-input:focus + .form-label,
  .form-input:not(:placeholder-shown) + .form-label,
  .form-input:valid + .form-label {
    font-size: var(--text-sm);
  }
}

/* Select styling */
.select-group {
  position: relative;
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: var(--space-12) !important;
}

.select-arrow {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #64748b;
  transition: transform 0.3s ease;
  z-index: 2;
}

.form-select:focus ~ .select-arrow {
  transform: translateY(-50%) rotate(180deg);
  color: var(--n8n-pink);
}

/* Textarea styling */
.textarea-group .form-label {
  top: var(--space-5);
  transform: none;
}

.form-textarea {
  min-height: 60px;
  resize: none;
  overflow: hidden;
  transition: height 0.2s ease;
  line-height: 1.5;
}

.form-textarea:focus ~ .form-label,
.form-textarea:not(:placeholder-shown) ~ .form-label,
.form-textarea:valid ~ .form-label {
  top: 0;
  transform: translateY(-50%);
}

/* Character counter */
.character-counter {
  position: absolute;
  bottom: -var(--space-6);
  right: 0;
  font-size: var(--text-xs);
  color: #64748b;
  font-family: 'JetBrains Mono', monospace;
}

.character-counter .current {
  color: var(--text-secondary);
  font-weight: var(--font-medium);
}

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

.form-group.error .form-label {
  color: #ef4444;
}

.form-group.error .form-underline {
  background: #ef4444;
  width: 100%;
}

/* Success states */
.form-group.success .form-input {
  border-color: #EA4B71;
  box-shadow: 0 0 0 3px rgba(234, 75, 113, 0.1);
}

.form-group.success .form-label {
  color: white;
}

.error-message {
  position: absolute;
  bottom: -var(--space-5);
  left: 0;
  color: #ef4444;
  font-size: var(--text-xs);
  opacity: 0;
  transform: translateY(-5px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.form-group.error .error-message {
  opacity: 1;
  transform: translateY(0);
}

/* Email suggestions */
.email-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--background-card);
  border: 1px solid rgba(234, 75, 113, 0.2);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: var(--shadow-lg);
}

.email-suggestion {
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.email-suggestion:hover,
.email-suggestion.selected {
  background: rgba(234, 75, 113, 0.1);
  color: var(--text-primary);
}

.submit-button {
  background: var(--gradient-cta);
  border: none;
  color: white;
  padding: var(--space-5) var(--space-10);
  border-radius: var(--radius-xl);
  font-weight: var(--font-semibold);
  font-size: var(--text-lg);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--duration-normal);
  margin-top: var(--space-8);
  width: 100%;
  box-shadow: var(--shadow-glow);
}

.submit-button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.submit-button:hover::after {
  width: 300px;
  height: 300px;
}

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

/* ===== SUCCESS OVERLAY ===== */

.success-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  backdrop-filter: blur(5px);
}

.success-animation {
  text-align: center;
  color: white;
  animation: successScale 0.5s var(--ease-bounce);
}

.checkmark {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-4);
}

.checkmark-circle {
  stroke: #EA4B71;
  stroke-width: 2;
  stroke-dasharray: 157;
  animation: successCircle 1s var(--ease-out) 0.3s both;
}

.checkmark-check {
  stroke: #EA4B71;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 50;
  animation: checkmarkDraw 0.5s var(--ease-out) 0.8s both;
}

.hidden {
  display: none;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet */
@media (max-width: 1024px) {
  .container {
    padding: 0 var(--space-4);
  }

  .course-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-title {
    font-size: var(--text-4xl);
  }

  .section {
    padding: var(--space-20) 0;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: var(--text-3xl);
  }

  .hero-subtitle {
    font-size: var(--text-lg);
  }

  .cta-button {
    padding: var(--space-3) var(--space-8);
    font-size: var(--text-base);
  }

  .form-container {
    padding: var(--space-8);
  }

  .section {
    padding: var(--space-16) 0;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-3);
  }

  .hero-content {
    padding: var(--space-4);
  }

  .form-container {
    padding: var(--space-6);
    margin: 0 var(--space-4);
  }
}