/*  Removed conflicting navbar CSS, relying on styles.css */
.navbar {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  width: 100%;
}
.nav-right {
  display: flex;
  gap: 1.5rem;
}
a {
  text-decoration: none;
}

/* 🌒 DARK MODE GLOBAL TEXT FIXES */
/*  Changed 'dark-theme' to 'dark' to match script.js and other pages */
body.dark {
  background-color: #121212;
  color: #f5f5f5;
  background: url(images/bgdark.png) no-repeat center center fixed;
  background-size: cover;
  background-position: center;
}

/* ✅ Heading fix */
body.dark .templates-main h1 {
  background: linear-gradient(
    to right,
    #67e8f9,
    #3b82f6
  ); /* bright neon cyan-blue */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 10px rgba(56, 189, 248, 0.4);
}

/* ✅ Template card titles */
body.dark .template-card h2 {
  color: #e0f2fe;
  text-shadow: 0 0 4px rgba(147, 197, 253, 0.5);
}


/* ✅ Navbar items */
body.dark .navbar,
body.dark .nav-links a,
body.dark .site-name {
  background-color: #1a1a1a;
  color: #ffffff;
}

body.dark .nav-links a:hover {
  color: #90caf9;
}

/* 🧼 Remove margins to prevent light-space bleed */
body,
html {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

/* 💡 Smooth transitions */
.templates-main h1,
.template-card h2,

.navbar,
.nav-links a {
  transition: color 0.3s ease, background-color 0.3s ease;
}

/* ✨ Make text inside template cards fully visible */
body.dark .template-card h2,
body.dark .template-card {
  color: #ffffff;
}



/* 🔧 Template card container */
body.dark .template-card {
  background-color: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(59, 130, 246, 0.15);
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.25), 0 0 12px rgba(56, 189, 248, 0.3);
  color: #ffffff;
  animation: darkNeonPulse 4s ease-in-out infinite;
}

/* 🖋 Titles inside cards */
body.dark .template-card h2 {
  color: #ffffff;
}


/* Base preview style */
.template-preview {
  height: 90px;
  border-radius: 10px;
  margin-bottom: 12px;
  background-color: #f0f0f0;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  box-sizing: border-box;
}

/* Dark mode support */
/*  Changed 'dark-theme' to 'dark' */
body.dark .template-preview {
  background-color: #2a2a2a;
  box-shadow: 0 2px 6px rgb(255 255 255 / 0.1);
}

/* Feature Cards Preview */
.feature-preview {
  background-color: #4f8cff;
  padding: 12px;
  gap: 10px;
}

.feature-preview .mini-card {
  background-color: white;
  flex: 1;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #555;
  font-weight: 600;
}

/* Hero Section Preview */
.hero-preview {
  background-color: #4f8cff;
  flex-direction: column;
  padding: 14px;
  gap: 8px;
}

.hero-preview .hero-image {
  background-color: white;
  border-radius: 8px;
  width: 100%;
  height: 50px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.hero-preview .hero-text-line {
  background-color: white;
  border-radius: 5px;
  height: 8px;
  width: 80%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.hero-preview .hero-text-line.short {
  width: 50%;
}

/* Social Share Preview */
.social-share-preview {
  background-color: #4f8cff;
  gap: 15px;
  font-size: 28px;
  color: white;
}

.social-share-preview .social-icon-preview {
  transition: transform 0.2s ease-in-out;
}

.social-share-preview:hover .social-icon-preview {
  transform: scale(1.1);
}

/* Navbar Preview */
.navbar-preview {
  background-color: #4f8cff;
  flex-direction: column;
  justify-content: center;
  padding: 12px;
  gap: 8px;
}

.navbar-line {
  height: 10px;
  border-radius: 5px;
  background-color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.navbar-line.logo {
  width: 40%;
}

.navbar-line.link {
  width: 70%;
}

.navbar-line.link.short {
  width: 50%;
}

/* ADDED: Animated Toggles Preview CSS */
.toggles-preview {
  background-color: #4f8cff;
  gap: 20px;
}

.mini-toggle {
  width: 50px;
  height: 25px;
  background-color: #ccc;
  border-radius: 25px;
  position: relative;
  padding: 3px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.mini-handle {
  width: 19px;
  height: 19px;
  background-color: white;
  border-radius: 50%;
  position: absolute;
  transition: transform 0.3s ease;
}

.mini-toggle.off .mini-handle {
  transform: translateX(0);
}

.mini-toggle.on {
  background-color: #25d366; /* A nice 'on' color */
}

.mini-toggle.on .mini-handle {
  transform: translateX(25px);
}

/*Display Properties Preview */
.display-preview {
  background-color: #4f8cff;
  height: 90px;
  border-radius: 10px;
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.display-box {
  border-radius: 4px;
  display: inline-block;
}

.display-box.box1 {
  width: 24px;
  height: 24px;
  background-color: #bbdefb;
}

.display-box.box2 {
  width: 24px;
  height: 32px;
  background-color: #90caf9;
}

.display-box.box3 {
  width: 24px;
  height: 28px;
  background-color: #64b5f6;
}

/* 🌙 Dark Theme Support */
body.dark .display-preview {
  background-color: #2a2a2a;
  box-shadow: 0 2px 6px rgba(255, 255, 255, 0.1);
}

/* Make the link a flex container to align items */
.logo-link {
  display: flex; /* Aligns logo and text horizontally */
  align-items: center; /* Centers them vertically */
  gap: 10px; /* Adds space between logo and text */
  text-decoration: none; /* Removes underline */
  color: inherit; /* Inherits text color (if needed) */
}

/* Ensure the logo image stays aligned */
.logo-link img.logo {
  height: 40px; /* Adjust as needed */
  width: auto; /* Maintains aspect ratio */
}

/* Style the text (optional) */
.site-name {
  font-size: 1.2rem; /* Adjust size */
  font-weight: bold; /* Optional: Bold text */
  pointer-events: none; /* Ensures clicks pass to parent <a> */
}

/* Hover effect (optional) */
.logo-link:hover {
  opacity: 0.8;
  cursor: pointer;
}

/* NEW: CSS Snippet Generator Preview */
.generator-preview {
  background-color: #4f8cff;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.generator-box {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.generator-box.box-shadow-preview {
  background-color: white;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.generator-box.gradient-preview {
  background: linear-gradient(45deg, #ff6b6b, #4f8cff);
}

.generator-box.border-radius-preview {
  background-color: white;
  border-radius: 50%;
}

body.dark .generator-box.box-shadow-preview {
  background-color: #333;
  box-shadow: 0 4px 10px rgba(255, 255, 255, 0.1);
}

body.dark .generator-box.border-radius-preview {
  background-color: #333;
}

/* NEW: Search and Filter Styles */
.search-filter-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 0 1rem;
}

.search-container {
  position: relative;
  width: 100%;
  max-width: 500px;
}

#search-bar {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 3rem;
  border-radius: 50px;
  border: 2px solid #4f8cff;
  font-size: 1rem;
  background: linear-gradient(to right, #e0f7fa, #e3f2fd);
  box-shadow: 0 4px 12px rgba(79, 140, 255, 0.2);
  transition: all 0.3s ease;
}

#search-bar:focus {
  outline: none;
  box-shadow: 0 4px 16px rgba(79, 140, 255, 0.4);
  border-color: #1976d2;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #4f8cff;
}

.filter-container {
  position: relative;
}

.filter-btn {
  background: linear-gradient(to right, #4f8cff, #1976d2);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(79, 140, 255, 0.3);
  transition: all 0.3s ease;
}

.filter-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 140, 255, 0.4);
}

.category-filters {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 1rem;
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: max-content;
  max-width: 300px;
  z-index: 100;
  margin-top: 0.5rem;
}

.category-filters.show {
  display: flex;
}

.category-btn {
  background: #e3f2fd;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.category-btn:hover,
.category-btn.active {
  background: #4f8cff;
  color: white;
}

/* Dark mode for search and filter */
body.dark .category-filters {
  background: #2a2a2a;
}

body.dark .category-btn {
  background: #3a3a3a;
  color: #f5f5f5;
}

body.dark .category-btn:hover,
body.dark .category-btn.active {
  background: #4f8cff;
}

body.dark #search-bar {
  background: linear-gradient(to right, #1a237e, #0d47a1);
  color: white;
  border-color: #64b5f6;
}

body.dark .search-icon {
  color: #64b5f6;
}

/* Template Grid */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  padding: 0 1rem 3rem;
  max-width: 1400px;
  margin: 0 auto;
}

.template-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}

.template-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(79, 140, 255, 0.3);
}

body.dark .template-card {
  background: rgba(30, 41, 59, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark .template-card:hover {
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.4);
}

.template-card h2 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  color: #1a237e;
}

.template-btn {
  background: linear-gradient(to right, #4f8cff, #1976d2);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: all 0.3s ease;
}

.template-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 140, 255, 0.3);
}

/* No results message */
.no-results {
  display: none;
  text-align: center;
  color: #111;
  font-weight: bold;
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
}

body.dark .no-results {
  color: #fff;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .templates-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
  }
  
  .search-filter-container {
    gap: 0.75rem;
  }
  
  #search-bar {
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    font-size: 0.9rem;
  }
  
  .search-icon {
    left: 0.8rem;
  }
  
  .filter-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
  
  .category-filters {
    max-width: 250px;
  }
  
  .category-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .templates-grid {
    grid-template-columns: 1fr;
  }
  
  .category-filters {
    flex-direction: column;
    width: 200px;
  }
}