:root {
  --theme-color: #367588;
  --accent-color: #4a9fb4;
  --background-color: #ffffff;
  --section-background: #f9f9f9;
  --text-color: #333;
  --card-background: #fff;
  --card-shadow: rgba(0, 0, 0, 0.05);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
}

header {
  background-color: var(--theme-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
}

.header-title {
  font-size: 1.8rem;
  font-weight: bold;
}

nav a {
  color: #fff;
  text-decoration: none;
  margin-left: 1.2rem;
  font-size: 14px;
  font-weight: 600;
}

nav a:hover {
  text-decoration: underline;
}

.hamburger-container {
  display: none;
}

main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
  padding-bottom: 80px;
}

h1 {
  text-align: center;
  font-size: 2.2rem;
  margin-bottom: 2rem;
  color: var(--theme-color);
}

section {
  background-color: var(--card-background);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px var(--card-shadow);
  transition: box-shadow 0.3s ease;
}

section:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

section h2 {
  color: var(--accent-color);
  font-size: 1.5rem;
  margin-top: 0;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 0.4rem;
}

section p {
  line-height: 1.7;
  margin-bottom: 1rem;
}

ol,
ul {
  padding-left: 1.5rem;
  margin-top: 0.5rem;
}

li {
  margin-bottom: 0.8rem;
}

footer {
  background-color: var(--section-background);
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.95rem;
  color: #777;
  border-top: 1px solid #ddd;
}

.toc {
  background-color: var(--section-background);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
}

.toc h2 {
  margin-top: 0;
  font-size: 1.3rem;
  color: var(--theme-color);
}

.toc a {
  display: block;
  color: var(--accent-color);
  text-decoration: none;
  margin: 0.4rem 0;
}

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

.template-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 2rem 0 1rem 0;
}

.template-header h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--theme-color);
  flex-shrink: 0;
}

.nav-btn {
  background: var(--theme-color);
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  padding: 0.4em 1.2em;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 3px rgba(25, 118, 210, 0.07);
  display: flex;
  align-items: center;
  gap: 0.25em;
  text-decoration: none;
}

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

/* Template Grid */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 60px;
  padding: 20px;
}

.template-card {
  text-decoration: none;
  color: inherit;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  text-align: center;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease;
}

.template-card img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.template-card h3 {
  font-size: 1.05rem;
  margin: 8px 0;
}

.template-card:hover {
  transform: scale(1.05);
}

.template-detail {
  text-align: center;
  padding: 20px;
}

.template-preview {
  max-width: 90%;
  height: auto;
  margin: 20px auto;
  display: block;
}

.back-btn {
  display: inline-block;
  margin: 10px;
  text-decoration: none;
  color: #333;
  font-weight: bold;
}

/* Modern Pagination Button */
.pagination {
  text-align: center;
  margin: 40px 0 20px 0;
}

.pagination .next-btn {
  display: inline-block;
  background: linear-gradient(90deg, #367588, #4a9fb4);
  color: white;
  padding: 10px 28px;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.pagination .next-btn:hover {
  background: linear-gradient(90deg, #4a9fb4, #367588);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}


.pagination .next-btn:active {
  transform: scale(0.96);
}

/* Previous Button Style */
.pagination .prev-btn {
  display: inline-block;
  background: linear-gradient(90deg, #367588, #4a9fb4);
  color: white;
  padding: 10px 28px;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  margin-right: 10px;
  /* space between buttons */
}

.pagination .prev-btn:hover {
  background: linear-gradient(90deg, #4a9fb4, #367588);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.pagination .prev-btn:active {
  transform: scale(0.96);
}



@media (max-width: 600px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .header-title {
    width: 90%;
    font-size: 16px;
    margin-bottom: 8px;
    margin-left: 25px;
  }

  .header-nav {
    display: none;
  }

  .hamburger-container {
    display: block;
  }

  /* Hide checkbox */
  .drawer-toggle {
    display: none;
  }

  /* Hamburger Button */
  .hamburger {
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 25px;
    height: 25px;
    cursor: pointer;
    z-index: 1001;
  }

  .hamburger span {
    display: block;
    height: 3px;
    width: 100%;
    background: #FFFFFF;
    margin: 5px 0;
    transition: 0.4s;
  }

  /* Drawer - hidden off screen initially */
  .drawer {
    position: fixed;
    top: 0;
    left: -250px;
    /* Start hidden */
    width: 250px;
    background-color: #333;
    padding-top: 3rem;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.5);
    transition: left 0.3s ease;
    z-index: 1000;
  }

  .drawer ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .drawer ul li {
    border-bottom: 1px solid #444;
  }

  .drawer ul li a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 1rem;
    transition: background 0.3s;
  }

  .drawer ul li a:hover {
    background: #444;
  }

  /* Show drawer when checkbox is checked */
  .drawer-toggle:checked+.hamburger+.drawer {
    left: 0;
  }

  /* Animate Hamburger to "X" */
  .drawer-toggle:checked+.hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .drawer-toggle:checked+.hamburger span:nth-child(2) {
    opacity: 0;
  }

  .drawer-toggle:checked+.hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
  }

  .template-header {
    flex-direction: column;
    gap: 0.75rem;
  }
}