/* --- NEW: Import a clean font from Google Fonts --- */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap");

/* --- NEW: Animated Gradient Background --- */
@keyframes gradientAnimation {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

body {
  font-family: "Poppins", sans-serif;
  color: #f0f0f0; /* Light text color for dark background */
  background: linear-gradient(-45deg, #0f0c29, #302b63, #24243e, #1c3d52);
  background-size: 400% 400%;
  animation: gradientAnimation 15s ease infinite;
  margin: 0;
  padding: 30px;
  min-height: 100vh;
}

/* --- UPDATED: Header with Gradient Text --- */
header {
  text-align: center;
  margin-bottom: 60px;
}

header h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 15px;
  /* Creating the gradient text effect */
  background: linear-gradient(90deg, #3498db, #9b59b6, #e91e63);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

header p {
  font-size: 1.1rem;
  color: #bdc3c7; /* Lighter grey for subtitles */
  max-width: 600px;
  margin: 0 auto;
}

/* --- Card container grid --- */
#card-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 35px;
  max-width: 1400px;
  margin: 0 auto;
}

/* --- NEW: "Glassmorphism" Card Style --- */
.template-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  box-shadow: 16px 16px 30px rgba(0, 0, 0, 0.4),
              -16px -16px 30px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  text-decoration: none;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  border: none;
  position: relative;
}

.template-card:hover {
  transform: translateY(-5px);
  box-shadow: 20px 20px 35px rgba(0, 0, 0, 0.5),
              -20px -20px 35px rgba(255, 255, 255, 0.08);
}

/* --- Card image styling --- */
.template-card img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  filter: brightness(0.95);
  transition: filter 0.3s ease;
}

.template-card:hover img {
  filter: brightness(1.05);
}

/* --- Card title styling --- */
.template-card h3 {
  margin: 0;
  padding: 25px 20px;
  font-size: 1.15em;
  font-weight: 600;
  text-align: center;
  flex-grow: 1;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  justify-content: center;
}

/* Contribution steps button */
.contro-info {
  padding: 12px 20px;
  border-radius: 12px;
  margin-bottom: 6px;
  background: #ca93f7;
  font-size: medium;
  font-family: "Poppins", Arial, sans-serif;
  font-weight: 600;
  border: none;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 
    6px 6px 12px rgba(0, 0, 0, 0.2),
    -4px -4px 12px rgba(255, 255, 255, 0.1);
}

.contro-info:hover {
  transform: translateY(-2px);
  background: #d4a4ff;
  box-shadow: 
    8px 8px 16px rgba(0, 0, 0, 0.25),
    -6px -6px 16px rgba(255, 255, 255, 0.15);
}

.contro-info:active {
  transform: translateY(1px);
  box-shadow: 
    inset 4px 4px 8px rgba(0, 0, 0, 0.2),
    inset -4px -4px 8px rgba(255, 255, 255, 0.1);
}

.popup {
  display: none; /* hidden by default */
  position: fixed;
  z-index: 10;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup-content {
  background-color: rgb(85, 34, 91);
  padding: 2.5rem;
  border-radius: 15px;
  width: 90%;
  max-width: 700px;
  text-align: left;
  line-height: 1.6;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.3),
    0 0 60px rgba(0, 0, 0, 0.2);
  transform: translateY(0);
  transition: transform 0.3s ease-out;
  margin: 0;
  position: relative;
}

.popup-content::-webkit-scrollbar {
  width: 8px;
}

.popup-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.popup-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.popup-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

.popup-content h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
}

.close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  font-size: 1.5rem;
  font-weight: bold;
  color: #ffffff;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
}

.close-btn:hover {
  color: red;
}

code {
  background: #000000;
  padding: 2px 4px;
  border-radius: 4px;
  font-family: monospace;
}



#scrollToTopBtn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 30px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: #9b59b6;
    color: white; /* The SVG stroke will inherit this color */
    cursor: pointer;
    padding: 12px; /* Adjusted padding for the icon */
    border-radius: 10px;
    /* font-size: 20px;  <-- REMOVE THIS LINE */
    transition: background-color 0.3s, transform 0.3s;
    line-height: 0; /* Helps vertically align the SVG */
}

#scrollToTopBtn:hover {
  background-color: #ca93f7;
  transform: scale(1.1);
}

/* Import font */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap");

/* --- 1. DEFINE COLOR VARIABLES FOR THEMES --- */
:root {
    --bg-gradient: linear-gradient(-45deg, #0f0c29, #302b63, #24243e, #1c3d52);
    --text-primary: #f0f0f0;
    --text-secondary: #bdc3c7;
    --header-gradient: linear-gradient(90deg, #3498db, #9b59b6, #e91e63);
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-border: rgba(255, 255, 255, 0.2);
    --card-hover-border: #3498db;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --popup-bg: rgb(85, 34, 91);
    --code-bg: #000000;
    --accent-color: #ca93f7;
    --scroll-btn-bg: #9b59b6;
    --scroll-btn-hover-bg: #ca93f7;
}

body.light-mode {
    --bg-gradient: linear-gradient(to top, #e6e9f0 0%, #eef1f5 100%);
    --text-primary: #2c3e50;
    --text-secondary: #5f6c7b;
    --header-gradient: linear-gradient(90deg, #2980b9, #8e44ad, #c0392b);
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(0, 0, 0, 0.1);
    --card-hover-border: #8e44ad;
    --card-shadow: 0 8px 20px 0 rgba(0, 0, 0, 0.1);
    --popup-bg: #ffffff;
    --code-bg: #eef1f5;
    --accent-color: #9b59b6;
    --scroll-btn-bg: #8e44ad;
    --scroll-btn-hover-bg: #9b59b6;
}

/* --- 2. GENERAL STYLES USING VARIABLES --- */
body {
    font-family: "Poppins", sans-serif;
    color: var(--text-primary);
    background: var(--bg-gradient);
    background-size: 400% 400%;
    animation: gradientAnimation 15s ease infinite;
    margin: 0;
    padding: 30px;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

header {
    text-align: center;
    margin-bottom: 60px;
    position: relative; /* Needed for theme switch positioning */
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 15px;
    background: var(--header-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Card Styles */
#card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 35px;
    max-width: 1400px;
    margin: 0 auto;
}

.template-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border 0.3s ease;
}

.template-card:hover {
    transform: translateY(-10px);
    border: 1px solid var(--card-hover-border);
}

.template-card img {
    border-bottom: 1px solid var(--card-border);
    /* ... other image styles ... */
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
}

.template-card h3 {
    /* ... other h3 styles ... */
    margin: 0; padding: 20px; font-size: 1.15em; font-weight: 600; text-align: center; flex-grow: 1; display: flex; align-items: center; justify-content: center;
}

/* Pop-up and other components */
.contro-info {
    background-color: var(--accent-color);
    color: white; /* Text on accent buttons should be consistent */
    /* ... other button styles ... */
    padding: 8px; border-radius: 0.5rem; margin-bottom: 6px; font-size: medium; font-family: Arial, Helvetica, sans-serif; font-weight: bold; border: none;
}

.popup-content {
    background-color: var(--popup-bg);
    color: var(--text-primary); /* Text color inside popup must also change */
    /* ... other popup styles ... */
    margin: 5% auto; padding: 2rem; border-radius: 10px; width: 80%; max-width: 700px; text-align: left; line-height: 1.6;
}

code {
    background: var(--code-bg);
    color: var(--text-secondary);
    /* ... other code styles ... */
    padding: 2px 4px; border-radius: 4px; font-family: monospace;
}

/* Scroll to Top Button */
#scrollToTopBtn {
    background-color: var(--scroll-btn-bg);
    /* ... other button styles ... */
    display: none; position: fixed; bottom: 20px; right: 30px; z-index: 99; border: none; outline: none; color: white; cursor: pointer; padding: 12px; border-radius: 10px; transition: background-color 0.3s, transform 0.3s; line-height: 0;
}

#scrollToTopBtn:hover {
    background-color: var(--scroll-btn-hover-bg);
    transform: scale(1.1);
}

/* --- 3. NEW: THEME SWITCH STYLES --- */
.theme-switch-wrapper {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
}

.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
    padding: 3px;
    border-radius: 17px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.1));
    box-shadow: 
        5px 5px 10px rgba(0, 0, 0, 0.2),
        -5px -5px 10px rgba(255, 255, 255, 0.1);
}

.theme-switch input {
    display: none;
}

.slider {
    background: #302b63;
    bottom: 3px;
    cursor: pointer;
    left: 3px;
    right: 3px;
    top: 3px;
    position: absolute;
    transition: .4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 15px;
}

.slider:before {
    background: linear-gradient(145deg, #ffffff, #e6e6e6);
    bottom: 4px;
    content: "";
    height: 24px;
    left: 4px;
    position: absolute;
    transition: .4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 24px;
    border-radius: 50%;
    box-shadow: 
        2px 2px 5px rgba(0, 0, 0, 0.2),
        -2px -2px 5px rgba(255, 255, 255, 0.5);
}

.slider:hover:before {
    box-shadow: 
        3px 3px 8px rgba(0, 0, 0, 0.3),
        -3px -3px 8px rgba(255, 255, 255, 0.6);
}

input:checked + .slider {
    background: #2980b9;
}

input:checked + .slider:before {
    transform: translateX(26px);
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}