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

:root {
  --primary-color: #0066cc;
  --secondary-color: #ff6b6b;
  --accent-color: #ffd93d;
  --dark-color: #1a1a1a;
  --light-color: #f5f5f5;
  --text-color: #333;
  --border-radius: 12px;
  --transition: all 0.3s ease;
}

body.light {
  --primary-color: #0066cc;
  --secondary-color: #ff6b6b;
  --accent-color: #ffd93d;
  --dark-color: #1a1a1a;
  --light-color: #f5f5f5;
  --text-color: #333;
  background-color: #fafafa;
}

body.dark {
  --primary-color: #3d5a99;
  --secondary-color: #f08a5d;
  --accent-color: #f9d56e;
  --dark-color: #121212;
  --light-color: #222;
  --text-color: #e8e8e8;
  background-color: #111;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--light-color);
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

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

/* Navigation */
.navbar {
  background: linear-gradient(135deg, var(--primary-color), #0052a3);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-switcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.25);
  margin-right: 10px;
}

.theme-switcher:hover,
.theme-switcher:focus {
  background: rgba(255, 255, 255, 0.25);
}

body.dark .theme-switcher {
  background: rgba(255, 255, 255, 0.08);
  color: #ffd93d;
}

body.dark .navbar {
  background: linear-gradient(135deg, var(--primary-color), #2c3a56);
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.4);
}

body.dark .hero {
  background: linear-gradient(135deg, var(--primary-color), #0f1630);
}

body.dark .contents-section {
  background-color: #11131a;
}

body.dark .about-section {
  background: linear-gradient(135deg, #141823, #1a1f30);
}

body.dark .chapter,
body.dark .about-card,
body.dark .topic-content {
  background: #151824;
  border-color: #2a2f40;
}

body.dark .chapter-content {
  background: #171c2e;
}

body.dark .chapter-header {
  background: linear-gradient(135deg, #1d2438, #1b2132);
}

body.dark .chapter-header:hover {
  background: linear-gradient(135deg, #1b2132, #232a41);
}

body.dark .topics-list li {
  border-color: #2b3349;
}

body.dark .topics-list a {
  color: #a8d3ff;
}

body.dark .topics-list a:hover {
  color: #ffd36f;
}

body.dark .about-card {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
}

body.dark .about-card:hover {
  background: #1f273d;
}

body.dark .footer {
  background: #0e1220;
  color: #d1d8ec;
}

body.dark .content-page {
  background: transparent;
}

.nav-link {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

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

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-link {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-link:hover {
  color: var(--accent-color);
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent-color);
  transition: var(--transition);
}

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

.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background-color: white;
  margin: 5px 0;
  transition: var(--transition);
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary-color), #0052a3);
  color: white;
  padding: 100px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-content {
  z-index: 2;
  position: relative;
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 20px;
  animation: slideInDown 0.8s ease;
}

.hero p {
  font-size: 1.5rem;
  margin-bottom: 30px;
  animation: slideInUp 0.8s ease;
  opacity: 0.9;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.cta-button {
  background-color: var(--accent-color);
  color: var(--dark-color);
  border: none;
  padding: 15px 40px;
  font-size: 1.1rem;
  font-weight: bold;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  background-color: #ffb700;
}

.hero-background {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 1;
  overflow: hidden;
}

.shape {
  position: absolute;
  opacity: 0.1;
}

.shape-1 {
  width: 300px;
  height: 300px;
  background-color: white;
  border-radius: 50%;
  top: -50px;
  right: -50px;
  animation: float 6s ease-in-out infinite;
}

.shape-2 {
  width: 150px;
  height: 150px;
  background-color: white;
  border-radius: 50%;
  bottom: 50px;
  left: 50px;
  animation: float 8s ease-in-out infinite;
}

.shape-3 {
  width: 250px;
  height: 250px;
  background-color: white;
  bottom: -100px;
  right: 10%;
  border-radius: 50%;
  animation: float 7s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-30px);
  }
}

/* Contents Section */
.contents-section {
  padding: 20px 20px;
  background-color: white;
}

.contents-section h2 {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 50px;
  color: var(--primary-color);
  position: relative;
  padding-bottom: 20px;
}

.contents-section h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 2px;
}

.table-of-contents {
  display: grid;
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
}

.chapter {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chapter:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.chapter-header {
  background: linear-gradient(135deg, #f5f5f5, #efefef);
  padding: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: var(--transition);
  user-select: none;
}

.chapter-header:hover {
  background: linear-gradient(135deg, #efefef, #e5e5e5);
}

.chapter-number {
  background: linear-gradient(135deg, var(--primary-color), #0052a3);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: bold;
  flex-shrink: 0;
}

.chapter-header h3 {
  flex: 1;
  color: var(--text-color);
  font-size: 1.3rem;
  margin: 0;
}

.toggle-icon {
  color: var(--primary-color);
  font-size: 1.2rem;
  transition: var(--transition);
  flex-shrink: 0;
}

.chapter.open .toggle-icon {
  transform: rotate(180deg);
}

.chapter-content {
  padding: 20px;
  background: #fafafa;
  max-height: 1000px;
  overflow: hidden;
  animation: expandDown 0.3s ease;
}

@keyframes expandDown {
  from {
    max-height: 0;
    opacity: 0;
  }
  to {
    max-height: 1000px;
    opacity: 1;
  }
}

.topics-list {
  list-style: none;
  padding: 0;
}

.topics-list li {
  padding: 12px 0;
  border-bottom: 1px solid #e0e0e0;
  transition: var(--transition);
}

.topics-list li:last-child {
  border-bottom: none;
}

.topics-list a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  display: inline-block;
}

.topics-list a:hover {
  color: var(--secondary-color);
  transform: translateX(5px);
}

/* About Section */
.about-section {
  padding: 80px 20px;
  background: linear-gradient(135deg, #f5f5f5, #efefef);
}

.about-section h2 {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 50px;
  color: var(--primary-color);
  position: relative;
  padding-bottom: 20px;
}

.about-section h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 2px;
}

.about-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  max-width: 1100px;
  margin: 0 auto;
}

.about-card {
  background: white;
  padding: 30px;
  border-radius: var(--border-radius);
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: var(--transition);
  border-top: 4px solid var(--primary-color);
}

.about-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.about-card h3 {
  color: var(--primary-color);
  margin-bottom: 10px;
  font-size: 1.3rem;
}

.about-card p {
  color: #666;
  line-height: 1.8;
}

/* Footer */
.footer {
  background: var(--dark-color);
  color: white;
  text-align: center;
  padding: 30px 20px;
  margin-top: 60px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .nav-menu {
    display: none;
  }

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

  .hero p {
    font-size: 1.2rem;
  }

  .hero {
    min-height: 400px;
    padding: 60px 20px;
  }

  .contents-section h2,
  .about-section h2 {
    font-size: 2rem;
  }

  .chapter-header {
    padding: 15px;
  }

  .chapter-number {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
  }

  .chapter-header h3 {
    font-size: 1.1rem;
  }

  .cta-button {
    padding: 12px 30px;
    font-size: 1rem;
  }

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

  .contents-section,
  .about-section {
    padding: 50px 20px;
  }
}

@media (max-width: 480px) {
  .nav-logo {
    font-size: 1.4rem;
  }

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

  .hero p {
    font-size: 1rem;
  }

  .hero {
    min-height: 300px;
    padding: 40px 20px;
  }

  .contents-section h2,
  .about-section h2 {
    font-size: 1.5rem;
  }

  .chapter-header {
    flex-wrap: wrap;
  }

  .topics-list a {
    font-size: 0.9rem;
  }
}

/* Subject cards and page navigation */
.subjects-section {
  padding: 80px 20px;
  background: #f7fbff;
}

.subjects-section h2,
.section-title {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 40px;
  color: var(--primary-color);
  position: relative;
}

.subjects-section h2::after,
.section-title::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 2px;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.subject-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 30px;
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.subject-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.12);
}

.subject-icon {
  font-size: 3rem;
}

.subject-card h3 {
  margin: 0;
  color: var(--dark-color);
}

.subject-card p {
  color: #5f6370;
  line-height: 1.8;
}

.subject-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 25px 0 35px;
}

.subject-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  background: var(--primary-color);
  color: white;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  transition:
    background 0.25s ease,
    transform 0.25s ease;
}

.subject-link:hover {
  background: #004a92;
  transform: translateY(-2px);
}

.subject-summary {
  padding: 60px 20px;
  background: #fafbff;
  border-top: 1px solid rgba(0, 102, 204, 0.08);
}

.subject-summary p {
  max-width: 900px;
  margin: 0 auto 35px;
  color: #505766;
  line-height: 1.8;
  text-align: center;
}

body.dark .subject-card,
body.dark .subject-summary,
body.dark .subjects-section {
  background: #11131a;
}

body.dark .subject-card {
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.28);
}

body.dark .subject-link {
  background: #5a7dbd;
}

body.dark .subject-link:hover {
  background: #3d5a99;
}

/* Responsive subject grid */
@media (max-width: 768px) {
  .subject-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .subject-card {
    padding: 48px;
  }
}

@media (max-width: 480px) {
  .subject-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .subject-card {
    padding: 24px;
  }

  .subject-icon {
    font-size: 2.5rem;
  }

  .subjects-section h2 {
    font-size: 2rem;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #0052a3;
}
