/* Основные стили конструктора */
.builder-container {
  display: flex;
  gap: 30px;
  margin-top: 30px;
}

/* Стили для заголовка калькулятора */
.page-header {
  margin-top: 90px;
  text-align: center;
  margin-bottom: 40px;
  padding: 30px 20px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  border-left: 4px solid #4361ee;
}

.page-title {
  font-size: 2rem;
  color: #333;
  margin: 0 0 10px 0;
  position: relative;
  padding-bottom: 10px;
}

.page-title:after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: #f72585;
}

.subtitle {
  font-size: 1.1rem;
  color: #666;
  margin: 0;
  line-height: 1.5;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
  .page-header {
    padding: 20px 15px;
    margin-bottom: 30px;
  }

  .page-title {
    font-size: 1.6rem;
  }

  .subtitle {
    font-size: 1rem;
  }
}

.page-title i {
  color: #4361ee;
  margin-right: 10px;
}

.builder-content {
  flex: 3;
}

.builder-sidebar {
  flex: 1;
  position: sticky;
  top: 100px;
  align-self: flex-start;
}

.builder-section {
  margin-bottom: 40px;
  background: #fff;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.builder-section h2 {
  font-size: 1.5em;
  margin-top: 0;
  margin-bottom: 20px;
  color: #4361ee;
  display: flex;
  align-items: center;
  gap: 10px;
}

.builder-section h2 i {
  font-size: 1.2em;
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.item-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  transition: transform 0.3s, box-shadow 0.3s;
}

.item-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.item-card h3 {
  margin-top: 0;
  margin-bottom: 10px;
  color: #333;
  font-size: 1.2em;
}

.item-description {
  color: #666;
  font-size: 0.9em;
  margin-bottom: 15px;
  min-height: 40px;
}

.item-price {
  font-weight: bold;
  color: #4361ee;
  font-size: 1.2em;
  margin-bottom: 15px;
}

.item-option {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.add-btn {
  width: 100%;
  padding: 10px;
  background: #4361ee;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s;
}

.add-btn:hover {
  background: #3a56d4;
}

.quantity-control {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.quantity-btn {
  width: 30px;
  height: 30px;
  background: #ddd;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
}

.quantity-input {
  width: 50px;
  height: 30px;
  text-align: center;
  margin: 0 5px;
  border: 1px solid #ddd;
}

/* Стили корзины */
.cart-container {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.cart-container h2 {
  margin-top: 0;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #4361ee;
}

.cart-items {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.empty-cart {
  color: #666;
  text-align: center;
  padding: 20px 0;
}

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

.cart-item-name {
  flex: 2;
}

.cart-item-price {
  flex: 1;
  text-align: right;
  font-weight: bold;
}

.cart-item-remove {
  color: #f72585;
  margin-left: 10px;
  cursor: pointer;
}

.cart-summary {
  border-top: 1px solid #eee;
  padding-top: 15px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.summary-row.total {
  font-weight: bold;
  font-size: 1.2em;
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid #ddd;
}

.checkout-btn {
  width: 100%;
  padding: 12px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1.1em;
  cursor: pointer;
  margin-top: 20px;
  transition: background 0.3s;
}

.checkout-btn:hover {
  background: #218838;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
  .builder-container {
    flex-direction: column;
  }

  .builder-sidebar {
    position: static;
    margin-top: 30px;
  }

  /* Увеличиваем размер кнопки закрытия на мобильных для лучшего UX */
  .cart-close {
    width: 40px;
    height: 40px;
    font-size: 1.8em;
    top: 8px;
    right: 8px;
    min-width: 40px;
    min-height: 40px;
    /* Ensure better touch target on mobile */
    padding: 4px;
  }
}

/* Стили для кнопки "Добавлено" */
.add-btn.added {
  background-color: #4caf50;
  cursor: default;
}

.cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
  justify-content: center;
  align-items: center;
}

.builder-sidebar {
  background: white;
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(-50px);
  opacity: 0;
  transition: all 0.3s ease;
  position: relative; /* Ensure close button is positioned relative to this container */
}

.builder-sidebar.open {
  transform: translateY(0);
  opacity: 1;
}

.cart-overlay.open {
  display: flex;
}

/* Обновлённые стили для значка корзины */
.cart-floating {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
  cursor: pointer;
  transition: all 0.3s;
}

.cart-floating .cart-icon {
  position: relative;
  background-color: #4361ee;
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
  transition: all 0.3s;
}

.cart-floating .cart-icon:hover {
  background-color: #3a56d4;
  transform: scale(1.1);
}

.cart-floating .cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: #f72585;
  color: white;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

/* Анимация */
@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-15px);
  }
  60% {
    transform: translateY(-7px);
  }
}

.bounce {
  animation: bounce 0.8s;
}

/* Кнопка закрытия */
.cart-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: #666;
  z-index: 1002;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.3s ease;
  /* Ensure button is always visible and clickable */
  min-width: 32px;
  min-height: 32px;
  flex-shrink: 0;
}

.cart-close:hover {
  color: #f72585;
  background-color: rgba(247, 37, 133, 0.1);
  transform: scale(1.1);
}

.cart-close:active {
  transform: scale(0.95);
}

.cart-item-remove {
  color: #f72585;
  margin-left: 10px;
  cursor: pointer;
  transition: color 0.3s;
}

.cart-item-remove:hover {
  color: #d3165e;
}

/* Стили для управления количеством в корзине */
.cart-item-quantity {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cart-item-quantity button {
  width: 25px;
  height: 25px;
  background: #f0f0f0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.cart-item-quantity button:hover {
  background: #e0e0e0;
}

.cart-item-quantity span {
  min-width: 20px;
  text-align: center;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  gap: 10px;
}

.cart-item-name {
  flex: 1;
}

.cart-item-price {
  min-width: 80px;
  text-align: right;
  font-weight: bold;
}

.example-section {
  margin-right: auto;
  margin-left: auto;
  width: 50%;
  margin-bottom: 50px;
  padding: 35px;
  border-radius: 15px;
  margin-top: 40px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.06);
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #e6f0ff;
}

.example-section h2 {
  font-size: 1.6rem;
  color: #2c3e50;
  margin-bottom: 30px;
  display: flex;
  text-align: center;
  align-items: center;
  gap: 15px;
}

.price-total {
  text-align: center;
  font-size: 1.8rem;
  font-weight: bold;
  margin-top: 30px;
  color: #28a745;
  background: rgba(40, 167, 69, 0.08);
  padding: 20px;
  border-radius: 10px;
  display: inline-block;
  width: 100%;
  box-shadow: inset 0 0 0 2px rgba(40, 167, 69, 0.2);
}

.price-note {
  text-align: center;
  color: #2673fd;
  margin-top: 25px;
  font-size: 1.25rem;
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
  padding: 18px;
  background: rgba(38, 115, 253, 0.05);
  border-radius: 10px;
  border-left: 4px solid #2673fd;
  font-weight: 500;
  line-height: 1.5;
}

.price-example-list {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 550px;
  font-size: 1.15rem;
  color: #333;
}

.price-example-list li {
  padding: 12px 0;
  text-align: left;
  border-bottom: 1px dashed #d0e4ff;
  display: flex;
  justify-content: space-between;
}

@media (max-width: 768px) {
   
  
  .pricing-section h2 {
    font-size: 1.7rem;
  }
  
  .pricing-section h3 {
    font-size: 1.3rem;
    margin-top: 35px;
  }
  
  .example-section {
    width: 85%;
    padding: 25px;
  }
  
  .price-example-list {
    font-size: 1rem;
  }
  
  .price-total {
    font-size: 1.5rem;
    padding: 15px;
  }
  
  .price-note {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  
  .subtitle {
    font-size: 1rem;
    margin-bottom: 30px;
  }
  
  .pricing-section h2 {
    font-size: 1.5rem;
    margin-bottom: 30px;
  }
  
  .example-section h2 {
    font-size: 1.3rem;
  }
  
  .price-note {
    font-size: 1rem;
    padding: 15px;
  }
}
