:root {
  --primary: #d97757;
  --primary-dark: #c44d2c;
  --secondary: #5b8266;
  --accent: #f4a261;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --bg: #fdfcfb;
  --bg-secondary: #f8f5f2;
  --border: #e8e3de;
  --success: #52a675;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

header {
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

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

.logo {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}

nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
}

nav a:hover {
  color: var(--primary);
}

.search-bar {
  position: relative;
  width: 100%;
  max-width: 400px;
}

#searchInput {
  width: 100%;
  padding: 0.75rem 3rem 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 24px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

#searchInput:focus {
  outline: none;
  border-color: var(--primary);
}

.search-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 1.2rem;
}

.hero {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  color: white;
  padding: 4rem 1.5rem;
  text-align: center;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.hero p {
  font-size: 1.25rem;
  opacity: 0.95;
  margin-bottom: 2rem;
}

.season-badge {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

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

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filter-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

.dietary-filters {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.dietary-tag {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  border-radius: 20px;
  background: white;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  user-select: none;
}

.dietary-tag:hover {
  border-color: var(--primary);
}

.dietary-tag.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

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

.recipe-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
}

.recipe-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.recipe-image {
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, var(--bg-secondary), var(--border));
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.recipe-image svg {
  width: 45%;
  height: 45%;
  opacity: 0.25;
}

.recipe-time {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: white;
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.recipe-difficulty {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  padding: 0.35rem 0.8rem;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recipe-difficulty.easy { background: #52a675; color: white; }
.recipe-difficulty.medium { background: #f4a261; color: white; }
.recipe-difficulty.advanced { background: #c44d2c; color: white; }

.recipe-content {
  padding: 1.5rem;
}

.recipe-content h3 {
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
}

.recipe-description {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.recipe-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.recipe-category {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}

.recipe-servings {
  font-size: 0.85rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  padding: 1rem;
  overflow-y: auto;
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.modal-content {
  background: white;
  max-width: 900px;
  width: 100%;
  margin: 2rem auto;
  border-radius: 16px;
  position: relative;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: background 0.2s;
  z-index: 10;
}

.modal-close:hover {
  background: var(--bg-secondary);
}

.modal-header {
  aspect-ratio: 21/9;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px 16px 0 0;
  position: relative;
}

.modal-header svg {
  width: 20%;
  opacity: 0.3;
}

.modal-body {
  padding: 2.5rem;
}

.modal-body h2 {
  font-size: 2.25rem;
  margin-bottom: 1rem;
  color: var(--text);
  font-weight: 700;
  line-height: 1.2;
}

.modal-meta {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--border);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.meta-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  font-weight: 600;
}

.meta-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.servings-calculator {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.servings-calculator h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text);
  font-weight: 600;
}

.servings-control {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.servings-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: white;
  color: var(--primary);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-weight: 600;
}

.servings-btn:hover {
  background: var(--primary);
  color: white;
}

.servings-display {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  min-width: 80px;
  text-align: center;
}

.recipe-sections {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 2.5rem;
}

.ingredients-section h3,
.instructions-section h3 {
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
  color: var(--text);
  font-weight: 700;
}

.ingredient-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ingredient-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--success);
  flex-shrink: 0;
}

.ingredient-text {
  font-size: 1rem;
  color: var(--text);
  transition: opacity 0.2s;
}

.ingredient-item.checked .ingredient-text {
  opacity: 0.5;
  text-decoration: line-through;
}

.instruction-step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.step-number {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.step-text {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  padding-top: 0.25rem;
}

footer {
  background: var(--text);
  color: white;
  padding: 3rem 1.5rem 2rem;
  margin-top: 4rem;
}

.footer-content {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h4 {
  font-size: 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 0.6rem;
}

.footer-section a {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-section a:hover {
  color: white;
}

.footer-bottom {
  max-width: 1280px;
  margin: 0 auto;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.15);
  text-align: center;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.6);
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  nav {
    display: none;
  }

  .recipes-grid {
    grid-template-columns: 1fr;
  }

  .recipe-sections {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .modal-body {
    padding: 2rem 1.5rem;
  }

  .modal-body h2 {
    font-size: 1.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
