* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  background: #f8f9fa;
  color: #333;
  line-height: 1.5;
  padding-bottom: 100px;
}

/* SEARCH BAR REPLACES HEADER */
.search-container {
  background: white;
  padding: 15px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-bar {
  flex: 1;
  background: #f1f1f1;
  border: none;
  padding: 12px 15px;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
}

/* CATEGORIES BAR */
.categories-container {
  overflow-x: auto;
  white-space: nowrap;
  padding: 10px 15px;
  background: #f8f9fa;
  scrollbar-width: none; /* Firefox */
}

.categories-container::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.category-btn {
  display: inline-block;
  padding: 8px 16px;
  margin-right: 8px;
  background: white;
  border: 1px solid #eee;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.category-btn.active {
  background: #ff6600;
  color: white;
  border-color: #ff6600;
  box-shadow: 0 4px 10px rgba(255, 102, 0, 0.2);
}

.section-title {
  padding: 10px 20px 15px;
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #222;
}

/* СЕТКА ТОВАРОВ: 2 колонки по умолчанию */
.container {
  max-width: 800px;
  margin: 0 auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  padding: 0 15px;
}

/* КАРТОЧКА ТОВАРА */
.product {
  background: white;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

/* SQUARE IMAGES */
.product-img-container {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 Aspect Ratio */
  background: #eee;
  overflow: hidden;
}

.product-img-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* PRODUCT WEIGHT */
.product-weight {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.product-content {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-content b {
  font-size: 15px;
  color: #333;
  margin-bottom: 6px;
  display: block;
  min-height: 40px;
  line-height: 1.3;
}

.product-description {
  font-size: 12px;
  color: #999;
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.product-price {
  font-size: 18px;
  font-weight: 800;
  color: #ff6600;
  margin-bottom: 12px;
}

/* КНОПКИ: Фиксированное положение внизу карточки */
.button-container {
  margin-top: auto;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.qty-controls-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: #fff3e0;
  border-radius: 10px;
  padding: 4px;
}

.qty-controls-inline button {
  width: 36px;
  height: 36px;
  border: none;
  background: #ff6600;
  color: white;
  border-radius: 8px;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-controls-inline button:active {
  background: #e55a00;
  transform: scale(0.95);
}

.qty-display {
  flex: 1;
  text-align: center;
  font-weight: 800;
  color: #ff6600;
  font-size: 16px;
}

.btn-add {
  width: 100%;
  background: #ff6600;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-add:active {
  background: #e55a00;
  transform: scale(0.97);
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 16px;
}

/* ПЛАВАЮЩАЯ КОРЗИНА */
.floating-cart {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 500px;
  background: linear-gradient(135deg, #ff6600 0%, #ff8533 100%);
  color: white;
  padding: 16px 24px;
  border-radius: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 8px 25px rgba(255, 102, 0, 0.4);
  z-index: 100;
  cursor: pointer;
  animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUp {
  from { transform: translate(-50%, 100px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.hidden {
  display: none !important;
}

/* МОДАЛЬНОЕ ОКНО */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  width: 100%;
  max-width: 600px;
  border-radius: 24px 24px 0 0;
  padding: 25px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUpModal 0.3s ease-out;
}

@keyframes slideUpModal {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: #f0f0f0;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkout-items {
  background: #f8f9fa;
  border-radius: 16px;
  padding: 15px;
  margin-bottom: 20px;
}

.checkout-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.checkout-total {
  background: #fff3e0;
  padding: 15px;
  border-radius: 12px;
  text-align: right;
  margin-bottom: 25px;
  font-size: 18px;
  font-weight: 800;
}

#checkout-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#checkout-form input {
  padding: 16px;
  border: 2px solid #eee;
  border-radius: 12px;
  font-size: 16px;
  transition: border-color 0.2s;
}

#checkout-form input:focus {
  outline: none;
  border-color: #ff6600;
}

.btn-submit {
  background: #ff6600;
  color: white;
  border: none;
  padding: 18px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 10px;
}

/* SUCCESS SCREEN */
.success-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease-out;
}

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

.success-content {
  background: white;
  border-radius: 24px;
  padding: 40px 30px;
  text-align: center;
  max-width: 400px;
  animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.success-icon {
  width: 80px;
  height: 80px;
  background: #ff6600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: white;
  margin: 0 auto 20px;
  font-weight: bold;
}

.success-content h2 {
  font-size: 24px;
  color: #333;
  margin: 0 0 10px 0;
}

.success-content p {
  font-size: 16px;
  color: #666;
  margin: 0 0 30px 0;
}

.btn-done {
  background: #ff6600;
  color: white;
  border: none;
  padding: 14px 40px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-done:active {
  background: #e55a00;
  transform: scale(0.97);
}

/* АДАПТИВНОСТЬ */
@media (max-width: 350px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
