:root {
  --bg: #fffaf0;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --accent: #f97316;
  --accent-hover: #ea580c;
  --border: #f1e4d2;
  --shadow: 0 10px 15px -3px rgb(249 115 22 / 0.1);
}

body.dark {
  --bg: #0f172a;
  --card-bg: #1e2937;
  --text: #f1f5f9;
  --text-light: #cbd5e1;
  --accent: #fb923c;
  --accent-hover: #f59e0b;
  --border: #334155;
  --shadow: 0 10px 15px -3px rgb(251 146 60 / 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo::before {
  content: "🍳";
  font-size: 2rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 9999px;
  transition: all 0.3s ease;
}

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

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

.search-container {
  flex: 1;
  max-width: 420px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 14px 20px 14px 52px;
  border: 2px solid var(--border);
  border-radius: 9999px;
  font-size: 1rem;
  background: var(--card-bg);
  color: var(--text);
  outline: none;
  transition: all 0.3s ease;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
}

.search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem;
}

.theme-toggle {
  background: var(--card-bg);
  border: 2px solid var(--border);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.4rem;
  transition: all 0.4s ease;
  box-shadow: var(--shadow);
}

.hero {
  max-width: 1280px;
  margin: 0 auto;
  padding: 4rem 2rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: linear-gradient(135deg, #fffaf0 0%, #fefce8 100%);
  border-radius: 0 0 40px 40px;
  position: relative;
  overflow: hidden;
}

body.dark .hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e2937 100%);
}

.hero::before {
  content: "🍝 🥘 🍣";
  position: absolute;
  top: -30px;
  right: -30px;
  font-size: 8rem;
  opacity: 0.08;
  z-index: 0;
  transform: rotate(12deg);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 700px;
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 1rem;
  color: var(--text);
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-light);
  margin-bottom: 2rem;
}
.heroy {
  margin-top: 2rem;
  font-size: 0.95rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.heroe {
  display: flex;
  align-items: center;
  gap: 4px;
}
.hero-span {
  background: #f97316;
  color: white;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.8rem;
}

.filters {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 2rem 1rem;
}

.filter-title {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 1rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-span {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.category-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 1rem;
  scrollbar-width: none;
}

.category-list::-webkit-scrollbar {
  display: none;
}

.category-btn {
  background: var(--card-bg);
  border: 2px solid var(--border);
  color: var(--text);
  padding: 10px 24px;
  border-radius: 9999px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
}

.category-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 25px -5px rgb(249 115 22 / 0.15);
}

.category-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.section-header {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#section-title {
  font-size: 1.8rem;
  font-weight: 600;
}
#result-info {
  font-size: 1rem;
  color: var(--text-light);
  display: none;
}

.recipes-grid {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.recipe-card {
  background: var(--card-bg);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
}

.recipe-card:hover {
  transform: scale(1.04) translateY(-4px);
  box-shadow: 0 25px 50px -12px rgb(249 115 22 / 0.25);
}

.recipe-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.recipe-card:hover img {
  transform: scale(1.08);
}

.card-content {
  padding: 1.25rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.card-desc {
  color: var(--text-light);
  font-size: 0.95rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1rem;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.heart-btn {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.heart-btn:hover {
  transform: scale(1.2);
}

.heart-filled {
  color: #ef4444;
}

.content-btn {
  margin-left: 12px;
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.3s ease;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  max-width: 900px;
  width: 100%;
  max-height: 95vh;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 30px 60px -15px rgb(0 0 0 / 0.3);
  display: flex;
  flex-direction: column;
}

.modal-header {
  position: relative;
}

.modal-header img {
  width: 100%;
  height: 320px;
  object-fit: cover;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.9);
  color: #1f2937;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.modal-button {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.9);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
}

.modal-title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.modal-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.tag {
  background: #fefce8;
  color: #854d0e;
  padding: 6px 18px;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 500;
}

body.dark .tag {
  background: #451a03;
  color: #fed7aa;
}

.ingredients,
.instructions {
  margin-bottom: 2rem;
}

.section-label {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ingredients ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.ingredients li {
  background: var(--bg);
  padding: 12px 18px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.instructions ol {
  counter-reset: step;
  padding-left: 1.5rem;
}

.instructions li {
  margin-bottom: 1.25rem;
  position: relative;
}

.instructions li::before {
  content: counter(step);
  counter-increment: step;
  position: absolute;
  left: -2.2rem;
  background: var(--accent);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}
.back-button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2rem auto 0;
}

.footer-content {
  max-width: 1280px;
  margin: 4rem auto;
  padding: 2rem;
  text-align: center;
  color: var(--text-light);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
}
.footer-content a {
  color: var(--accent);
}

.footer-content p {
  margin-top: 8px;
}

@media (max-width: 768px) {
  .nav-container {
    padding: 1rem;
  }
  .hero {
    padding: 3rem 1rem 2rem;
  }
  .recipes-grid {
    padding: 0 1rem 2rem;
    gap: 1.5rem;
  }
  .modal-content {
    max-height: 100vh;
  }
}

.loader {
  width: 48px;
  height: 48px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 3rem auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-light);
}

.empty svg {
  width: 80px;
  height: 80px;
  margin-bottom: 1rem;
  opacity: 0.3;
}
