:root {
  --primary-color: #0078d4;
  --secondary-color: #2b88d8;
  --bg-color: #f3f2f1;
  --card-bg: rgba(255, 255, 255, 0.7);
  --text-color: #323130;
  --nav-bg: rgba(255, 255, 255, 0.8);
  --glass-border: 1px solid rgba(255, 255, 255, 0.3);
  --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
  --transition: all 0.3s ease;
}

[data-theme="dark"] {
  --primary-color: #4da8da;
  --secondary-color: #6bb9f0;
  --bg-color: #111111;
  --card-bg: rgba(30, 30, 30, 0.7);
  --text-color: #f3f2f1;
  --nav-bg: rgba(17, 17, 17, 0.8);
  --glass-border: 1px solid rgba(255, 255, 255, 0.1);
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Preloader */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s;
}
#preloader img {
  width: 100px;
  animation: pulse 1.5s infinite alternate;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.1); opacity: 1; }
}

/* Navbar */
nav {
  position: sticky;
  top: 0;
  width: 100%;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-bottom: var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 5%;
  z-index: 1000;
  box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}
.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-color);
}
.logo-container img {
  width: 40px;
}
.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}
.nav-links a {
  text-decoration: none;
  color: var(--text-color);
  font-weight: 500;
  position: relative;
  transition: var(--transition);
}
.nav-links a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -5px;
  left: 0;
  background-color: var(--primary-color);
  transition: var(--transition);
}
.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}
.theme-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-color);
}

/* Main Container */
main {
  flex: 1;
  padding: 2rem 5%;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  background: var(--primary-color);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: var(--transition);
  border: none;
  cursor: pointer;
}
.btn:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,120,212,0.3);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 4rem 0;
}
.hero h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  background: linear-gradient(45deg, var(--primary-color), #8e2de2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto 2rem;
  color: var(--text-color);
  opacity: 0.8;
}

/* Search Bar */
.search-container {
  max-width: 500px;
  margin: 0 auto 3rem;
  position: relative;
}
.search-input {
  width: 100%;
  padding: 1rem 1.5rem;
  border-radius: 30px;
  border: 1px solid var(--primary-color);
  background: var(--card-bg);
  backdrop-filter: blur(5px);
  color: var(--text-color);
  font-size: 1rem;
  outline: none;
  box-shadow: var(--shadow);
}
.search-input:focus {
  border-color: var(--secondary-color);
}

/* Category Filter Buttons */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 3rem;
}
.filter-btn {
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  border: 1px solid var(--primary-color);
  background: transparent;
  color: var(--text-color);
  cursor: pointer;
  transition: var(--transition);
}
.filter-btn:hover, .filter-btn.active {
  background: var(--primary-color);
  color: #fff;
}

/* Grid Layout for Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

/* Cards */
.card {
  height: 100%;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: var(--glass-border);
  border-radius: 15px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}
.card-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 1rem;
}
.card-icon {
  font-size: 2rem;
}
.card-title {
  font-size: 1.2rem;
  font-weight: 600;
}
.card-desc {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}
.card-links {
  list-style: none;
  margin-bottom: 1.5rem;
}
.card-links li {
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--text-color);
}
.btn-outline:hover {
  background: var(--primary-color);
  color: #fff;
}

/* Sections */
.section-title {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 2rem;
}

/* Features List */
.features-list {
  list-style: none;
  max-width: 400px;
  margin: 0 auto;
}
.features-list li {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.features-list li::before {
  content: '✔';
  color: var(--primary-color);
  font-weight: bold;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 5%;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-top: var(--glass-border);
  margin-top: auto;
}
.social-links {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}
.social-links a {
  color: var(--text-color);
  text-decoration: none;
  transition: var(--transition);
}
.social-links a:hover {
  color: var(--primary-color);
}

/* Back to Top */
#backToTop {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--primary-color);
  color: #fff;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: var(--transition);
  z-index: 1000;
}
#backToTop:hover {
  background: var(--secondary-color);
  transform: translateY(-3px);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.card-links a {
  color: var(--text-color);
  text-decoration: none;
  transition: var(--transition);
}
.card-links a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}
