/* ===== CSS Variables ===== */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --secondary: #10b981;
  --accent: #f59e0b;
  --dark: #1e293b;
  --dark-light: #334155;
  --light: #f8fafc;
  --gray: #64748b;
  --gray-light: #e2e8f0;
  --white: #ffffff;
  --gradient: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans TC', sans-serif;
  line-height: 1.6;
  color: var(--dark);
  background: var(--light);
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}

/* ===== Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.section {
  padding: 80px 0;
}

.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--dark);
}

.section-subtitle {
  text-align: center;
  color: var(--gray);
  font-size: 1.1rem;
  margin-bottom: 3rem;
}

/* ===== Header & Navigation ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  box-shadow: var(--shadow);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  font-size: 1.8rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: var(--dark);
  font-weight: 500;
  transition: color 0.3s;
  position: relative;
}

.nav-links a:hover {
  color: var(--primary);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s;
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-links .disabled {
  color: var(--gray);
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.7;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--dark);
}

/* ===== Hero Section ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  background: var(--gradient);
  padding-top: 80px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.hero-text {
  color: var(--white);
}

.hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

.hero-title span {
  color: var(--accent);
}

.hero-description {
  font-size: 1.2rem;
  opacity: 0.9;
  margin-bottom: 2rem;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
}

.hero-visual {
  display: flex;
  justify-content: center;
}

.hero-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  transform: rotate(3deg);
}

.hero-card-title {
  color: var(--dark);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.hero-card pre {
  background: var(--dark);
  color: #a5f3fc;
  padding: 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  overflow-x: auto;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  border: none;
}

.btn-primary {
  background: var(--white);
  color: var(--primary);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: transparent;
  color: var(--white);
  border: 2px solid var(--white);
}

.btn-secondary:hover {
  background: var(--white);
  color: var(--primary);
}

.btn-accent {
  background: var(--primary);
  color: var(--white);
}

.btn-accent:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

/* ===== Feature Cards ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.feature-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  transition: all 0.3s;
  border: 1px solid var(--gray-light);
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.feature-icon {
  width: 60px;
  height: 60px;
  background: var(--gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.feature-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--dark);
}

.feature-card p {
  color: var(--gray);
  font-size: 0.95rem;
}

.feature-card .btn {
  margin-top: 1.5rem;
  width: 100%;
  justify-content: center;
}

/* ===== Course Section ===== */
.course-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.course-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow: var(--shadow);
  transition: all 0.3s;
  border: 1px solid var(--gray-light);
}

.course-item:hover {
  transform: translateX(10px);
  border-color: var(--primary);
}

.course-number {
  width: 50px;
  height: 50px;
  background: var(--gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.course-content {
  flex: 1;
}

.course-content h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
  color: var(--dark);
}

.course-content p {
  color: var(--gray);
  font-size: 0.9rem;
}

.course-arrow {
  color: var(--gray);
  font-size: 1.5rem;
  transition: transform 0.3s;
}

.course-item:hover .course-arrow {
  transform: translateX(5px);
  color: var(--primary);
}

/* ===== Learning Path ===== */
.path-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.path-step {
  text-align: center;
  position: relative;
}

.path-icon {
  width: 80px;
  height: 80px;
  background: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1rem;
  box-shadow: var(--shadow);
  border: 3px solid var(--primary-light);
  transition: all 0.3s;
}

.path-step:hover .path-icon {
  border-color: var(--primary);
  transform: scale(1.1);
}

.path-step h4 {
  color: var(--dark);
  margin-bottom: 0.25rem;
}

.path-step p {
  color: var(--gray);
  font-size: 0.85rem;
}

.path-arrow {
  font-size: 2rem;
  color: var(--primary-light);
}

/* ===== Stats ===== */
.stats {
  background: var(--dark);
  padding: 60px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  text-align: center;
}

.stat-item h3 {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary-light);
  margin-bottom: 0.5rem;
}

.stat-item p {
  color: var(--gray-light);
}

/* ===== Footer ===== */
.footer {
  background: var(--dark);
  color: var(--gray-light);
  padding: 60px 0 30px;
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-brand .logo {
  color: var(--white);
  margin-bottom: 1rem;
}

.footer-brand p {
  font-size: 0.9rem;
  line-height: 1.8;
}

.footer-links h4 {
  color: var(--white);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.footer-links ul li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: var(--gray-light);
  font-size: 0.9rem;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: var(--primary-light);
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--dark-light);
  font-size: 0.9rem;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-title {
    font-size: 2.5rem;
  }

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

  .hero-visual {
    display: none;
  }

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

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

  .footer-content {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
    box-shadow: var(--shadow);
  }

  .nav-links.active {
    display: flex;
  }

  .mobile-menu-btn {
    display: block;
  }

  .hero-title {
    font-size: 2rem;
  }

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

  .section-title {
    font-size: 2rem;
  }

  .path-container {
    flex-direction: column;
  }

  .path-arrow {
    transform: rotate(90deg);
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

/* ===== Page Specific Styles ===== */

/* Course Page */
.page-header {
  background: var(--gradient);
  padding: 120px 0 60px;
  color: var(--white);
  text-align: center;
}

.page-header h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.page-header p {
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

.breadcrumb {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  opacity: 0.8;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* Content Layout */
.content-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  padding: 40px 0;
}

.sidebar {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.sidebar-nav {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.sidebar-nav h3 {
  font-size: 1rem;
  color: var(--gray);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav ul li {
  margin-bottom: 0.5rem;
}

.sidebar-nav a {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--dark);
  transition: all 0.3s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.main-content {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.main-content h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  color: var(--dark);
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 0.5rem;
}

.main-content h3 {
  font-size: 1.25rem;
  margin: 2rem 0 1rem;
  color: var(--dark);
}

.main-content p {
  margin-bottom: 1rem;
  color: var(--dark-light);
}

.main-content ul {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.main-content ul li {
  list-style: disc;
  margin-bottom: 0.5rem;
  color: var(--dark-light);
}

.main-content pre {
  background: var(--dark);
  color: #a5f3fc;
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.main-content code {
  font-family: 'Fira Code', 'Consolas', monospace;
}

.main-content blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  color: var(--gray);
  font-style: italic;
}

.main-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.main-content th,
.main-content td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-light);
}

.main-content th {
  background: var(--light);
  font-weight: 600;
  color: var(--dark);
}

.main-content tr:hover {
  background: var(--light);
}

/* Cards Page */
.cards-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

.card-deck {
  margin-bottom: 3rem;
}

.card-deck h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.flashcard {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
}

.flashcard:hover {
  box-shadow: var(--shadow-lg);
}

.flashcard-front {
  padding: 1.5rem;
  font-weight: 600;
  color: var(--dark);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flashcard-back {
  padding: 0 1.5rem;
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s;
  color: var(--dark-light);
  border-top: 1px solid var(--gray-light);
}

.flashcard.active .flashcard-back {
  max-height: 500px;
  padding: 1.5rem;
}

.flashcard-toggle {
  font-size: 1.5rem;
  color: var(--primary);
  transition: transform 0.3s;
}

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

/* Practice Page */
.practice-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px;
}

.practice-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.practice-card h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--dark);
}

.practice-card textarea {
  width: 100%;
  min-height: 150px;
  padding: 1rem;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.3s;
}

.practice-card textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.practice-card .hint {
  background: var(--light);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--gray);
}

.practice-card .btn {
  margin-top: 1rem;
}

/* Resources Page */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.resource-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s;
  border: 1px solid var(--gray-light);
  width: 100%;
  cursor: pointer;
}

.resource-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
}

.resource-icon {
  width: 50px;
  height: 50px;
  background: var(--gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.resource-info h4 {
  font-size: 1rem;
  color: var(--dark);
  margin-bottom: 0.25rem;
}

.resource-info p {
  font-size: 0.85rem;
  color: var(--gray);
}

@media (max-width: 768px) {
  .content-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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