/* ===== МОДАЛЬНОЕ ОКНО ОФОРМЛЕНИЯ ЗАКАЗА ===== */
.checkout-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.checkout-modal.active {
  display: flex;
  opacity: 1;
}

.checkout-content {
  background: #fff;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.checkout-modal.active .checkout-content {
  transform: scale(1);
}

.checkout-header {
  background: #fff;
  color: #111;
  padding: 24px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e5e5e5;
}

.checkout-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: #111;
}

.checkout-close {
  background: transparent;
  border: 1px solid #e5e5e5;
  color: #999;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.checkout-close:hover {
  background: #f5f5f5;
  border-color: #000;
  color: #000;
}

.checkout-body {
  padding: 30px;
  overflow-y: auto;
  flex: 1;
}

.checkout-body::-webkit-scrollbar {
  width: 8px;
}

.checkout-body::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}

.checkout-body::-webkit-scrollbar-thumb {
  background: #e10075;
  border-radius: 4px;
}

/* ===== ФОРМА ЗАКАЗА ===== */
.order-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.required {
  color: #e10075;
}

.form-group input,
.form-group textarea {
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Segoe UI', sans-serif;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #e10075;
  box-shadow: 0 0 0 3px rgba(225, 0, 117, 0.08);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* ===== ИНЛАЙН-ОШИБКИ ПОЛЕЙ =====
   Подсвечиваем конкретное поле красной рамкой и показываем
   сообщение под ним. Заменяют alert("Ошибка 422") для полей,
   которые сервер умеет маппить на конкретный input.
   =========================================== */

.form-group input.field-error,
.form-group textarea.field-error {
  border-color: #e53935;
  background-color: #fff8f8;
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.1);
}

.form-group input.field-error:focus,
.form-group textarea.field-error:focus {
  border-color: #e53935;
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.15);
}

.field-error-msg {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #e53935;
  font-weight: 500;
  margin-top: -4px;  /* чуть поближе к полю */
  animation: errorFadeIn 0.2s ease;
}

.field-error-msg::before {
  content: '⚠';
  font-size: 11px;
  flex-shrink: 0;
}

@keyframes errorFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== СВОДКА ЗАКАЗА ===== */
.order-summary {
  background: #f8f8f8;
  padding: 20px;
  border-radius: 12px;
  margin-top: 10px;
}

.order-summary h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: #111;
}

.order-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.order-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e5e5;
  gap: 12px;
}

.order-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.order-item-img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8f8f8;
  flex-shrink: 0;
}

.order-item-info {
  flex: 1;
}

.order-item-name {
  font-weight: 600;
  color: #111;
  margin-bottom: 4px;
}

.order-item-specs {
  font-size: 12px;
  color: #666;
  margin-bottom: 2px;
}

.order-item-qty {
  font-size: 12px;
  color: #999;
}

.order-item-price {
  font-weight: 600;
  color: #e10075;
  white-space: nowrap;
  margin-left: 12px;
}

.order-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 2px solid #ddd;
  font-size: 18px;
  font-weight: 700;
}

.order-total-price {
  color: #e10075;
  font-size: 24px;
}

/* ===== КНОПКА ОТПРАВКИ ===== */
.checkout-submit {
  background: linear-gradient(180deg, #ff2c9c, #d40073);
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  margin-top: 10px;
}

.checkout-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(225, 0, 117, 0.4);
}

.checkout-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ===== АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ ===== */
@media (max-width: 900px) {
  .checkout-content {
    width: 95%;
    max-height: 85vh;
  }
  
  .checkout-header {
    padding: 18px 20px;
  }
  
  .checkout-header h2 {
    font-size: 18px;
  }
  
  .checkout-body {
    padding: 20px 16px;
  }
  
  .order-form {
    gap: 16px;
  }
  
  .form-group input,
  .form-group textarea {
    padding: 10px 14px;
    font-size: 16px; /* Предотвращает auto-zoom на iOS */
  }
  
  .order-summary {
    padding: 16px;
  }
  
  .order-summary h3 {
    font-size: 15px;
  }
  
  .order-item {
    font-size: 13px;
  }
  
  .order-total {
    font-size: 16px;
  }
  
  .order-total-price {
    font-size: 20px;
  }
  
  .checkout-submit {
    padding: 14px 24px;
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .checkout-content {
    border-radius: 12px 12px 0 0;
    max-height: 95vh;
  }
  
  .order-item {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .order-item-img {
    width: 50px;
    height: 50px;
  }
  
  .order-item-info {
    flex: 1;
    min-width: 0;
  }
  
  .order-item-price {
    margin-left: 0;
    width: 100%;
    text-align: right;
  }
}