/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
  scroll-behavior: smooth;
}

body {
  background: linear-gradient(135deg, #121212 0%, #1a2a1a 100%);
  color: #e0e0e0;
  line-height: 1.6;
}

/* Variables */
:root {
  --primary-color: #27ae60;
  --secondary-color: #00ff88;
  --text-color: #e0e0e0;
  --card-bg: rgba(30, 30, 30, 0.9);
  --nav-bg: rgba(18, 18, 18, 0.95);
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 5%;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  z-index: 1000;
  transition: padding 0.3s ease;
}

.navbar.scrolled {
  padding: 15px 5%;
}

.logo {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
}

.logo span {
  color: var(--secondary-color);
}

.nav-links {
  display: flex;
  gap: 30px;
  list-style: none;
}

.nav-links a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  position: relative;
  transition: color 0.3s ease;
}

.nav-links a:hover {
  color: var(--primary-color);
}

.nav-links a::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -5px;
  left: 0;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

.hamburger {
  display: none;
  font-size: 1.8rem;
  color: var(--text-color);
  cursor: pointer;
}

/* Hero Section */
.hero {
  padding: 120px 5% 60px;
  text-align: center;
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.hero-content {
  max-width: 1200px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.hero .highlight {
  color: var(--primary-color);
}

.hero p {
  font-size: 1.2rem;
  color: #b0b0b0;
  max-width: 800px;
  margin: 0 auto 30px;
}

.search-container {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 700px;
  margin: 0 auto 50px;
}

#search-input {
  flex: 1;
  padding: 15px 20px;
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-color);
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#search-input:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.search-btn {
  padding: 15px 30px;
  background: var(--primary-color);
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}

.search-btn:hover {
  background: #1e8449;
  transform: translateY(-2px);
}

#ai-loading {
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--primary-color);
  margin-top: 10px;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--primary-color);
  border-top: 3px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Results Section */
.results-container {
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  margin-bottom: 40px;
}

.section-header h2 {
  font-size: 2rem;
  font-weight: 600;
}

.section-header h2 span {
  color: var(--primary-color);
}

.divider {
  width: 100px;
  height: 4px;
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  margin: 15px auto;
  border-radius: 2px;
}

.filters {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 20px;
}

.filters label {
  font-size: 0.9rem;
}

.filters select {
  padding: 8px 15px;
  border-radius: 5px;
  background: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--primary-color);
  cursor: pointer;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.product-name {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.similarity {
  background: var(--primary-color);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
}

.product-desc {
  font-size: 0.95rem;
  color: #b0b0b0;
  margin-bottom: 15px;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.meta-item {
  background: rgba(39, 174, 96, 0.1);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--primary-color);
}

.meta-item i {
  margin-right: 5px;
}

.related-suggestion {
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--secondary-color);
  cursor: pointer;
  text-decoration: underline;
}

/* Calculator Section */
.calculator {
  padding: 80px 5%;
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
}

.calc-inputs {
  display: flex;
  gap: 15px;
  max-width: 500px;
  margin: 20px auto;
}

.calc-inputs input {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--primary-color);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-color);
}

#calc-btn {
  padding: 12px 25px;
  background: var(--primary-color);
  border: none;
  border-radius: 5px;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

#calc-btn:hover {
  background: #1e8449;
}

#calc-result {
  margin-top: 20px;
  font-size: 1.1rem;
  color: var(--secondary-color);
}

/* Animations */
.fade-in {
  opacity: 0;
  animation: fadeIn 1s ease forwards;
}

.fade-in.delay {
  animation-delay: 0.5s;
}
.fade-in.delay-2 {
  animation-delay: 1s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-up {
  opacity: 0;
  animation: slideUp 1s ease forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .navbar {
    padding: 15px 5%;
  }
  .nav-links {
    display: none;
  }
  .hamburger {
    display: block;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .hero p {
    font-size: 1rem;
  }
  .search-container {
    flex-direction: column;
  }
  .search-btn {
    width: 100%;
  }
  .results {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    background: var(--nav-bg);
    flex-direction: column;
    padding: 20px 0;
    gap: 20px;
    clip-path: circle(0px at 90% -10%);
    transition: all 0.5s ease-out;
    pointer-events: none;
  }

  .nav-links.active {
    clip-path: circle(1000px at 90% -10%);
    pointer-events: all;
  }
}
