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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 10px;
  background-color: #f9f7f4;
  color: #333;
  -webkit-text-size-adjust: none;
  touch-action: manipulation;
}

header {
  text-align: center;
  margin-bottom: 15px;
}

header h1 {
  font-size: 1.6rem;
  margin: 10px 0;
  font-weight: 600;
}

/* Фильтры — компактно на мобильных */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
  justify-content: center;
  padding: 0 5px;
}

.controls label {
  font-size: 0.95rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.controls select {
  font-size: 0.95rem;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  min-width: 130px;
  background: white;
}

/* Сетка карточек */
#products-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Карточка продукта */
.card {
  border: 1px solid #e0e0e0;
  border-radius: 14px;
  overflow: hidden;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.card-info {
  padding: 14px;
}

.card-info h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  color: #2c3e50;
  font-weight: 600;
}

/* Информация на карточке */
.card-info p {
  margin: 4px 0;
  font-size: 0.9rem;
  color: #555;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: #e3f2fd;
  color: #1976d2;
  margin-right: 4px;
}

.badge.orange {
  background-color: #fff3e0;
  color: #ef6c00;
}

.badge.red {
  background-color: #ffebee;
  color: #c62828;
}

.badge.gray {
  background-color: #f5f5f5;
  color: #616161;
}

/* Блок с метками */
.tags {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Модальное окно */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  -webkit-overflow-scrolling: touch;
}

.modal-content {
  background: white;
  margin: 5% auto;
  padding: 18px;
  width: 90%;
  max-width: 600px;
  border-radius: 16px;
  position: relative;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.close {
  position: absolute;
  top: 12px;
  right: 20px;
  font-size: 30px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
  line-height: 1;
}

.close:hover {
  color: #000;
}

#modal-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 16px;
}

#modal-instructions li,
#modal-ingredients li {
  margin: 6px 0;
  line-height: 1.5;
}

/* Адаптация для малых экранов */
@media (max-width: 480px) {
  .controls select {
    font-size: 0.9rem;
    padding: 5px;
  }

  header h1 {
    font-size: 1.4rem;
  }

  .card-info h3 {
    font-size: 1.05rem;
  }

  .badge {
    font-size: 0.65rem;
    padding: 2px 5px;
  }
}
/* === Поисковое поле === */
.search-box {
  display: flex;
  justify-content: center;
  margin: 15px 10px;
  gap: 8px;
}

.search-box input {
  flex: 1;
  max-width: 400px;
  padding: 10px 14px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  outline: none;
}

.search-box input:focus {
  border-color: #4a90e2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.search-box button {
  padding: 10px 16px;
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
}

.search-box button:hover {
  background-color: #3a7bc8;
}
