:root {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
  color: #222;
  background-color: #f5f7fa;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2rem;
  min-height: 100vh;
}

.page {
  max-width: 960px;
  margin: 0 auto;
}

.page__header {
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

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

.brand__image {
  width: clamp(220px, 40vw, 360px);
  height: auto;
  display: block;
}

.discount-note {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: #425466;
}

.form-note {
  font-size: 0.95rem;
  color: #4a5568;
  max-width: 320px;
}

.page__header h1 {
  margin: 0;
  color: #d0332a;
  font-size: 1.8rem;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card__section {
  border: 1px solid #f5d5cf;
  border-radius: 10px;
  padding: 1rem;
  background: #fff0ec;
}

.section__title {
  font-weight: 600;
  color: #c4412f;
  margin-bottom: 0.75rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field__label {
  font-size: 0.9rem;
  color: #334155;
  display: inline-flex;
  align-items: flex-start;
  gap: 0.35rem;
}

.field__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #d0332a;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.discount-grid .field {
  justify-content: flex-start;
}

.discount-grid .field__label {
  min-height: 0;
  margin-bottom: auto;
}

.discount-grid .field select {
  margin-top: auto;
}

input,
select,
textarea {
  border-radius: 8px;
  border: 1px solid #cbd5f5;
  padding: 0.6rem 0.75rem;
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #2b6cb0;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.3);
}

/* Подсветка полей с ошибкой валидации */
.field--error input,
.field--error select,
.field--error textarea {
  border-color: #c53030;
  box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.35);
}

.field--error .field__label {
  color: #c53030;
}

textarea {
  resize: vertical;
}

.full-width {
  width: 100%;
}

.attachments-hint {
  margin-top: 1rem;
  background: #fff;
  border: 1px dashed #a0aec0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

.attachments-hint ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.attachments-hint__note {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #4a5568;
}

.attachments-hint ul {
  margin: 0.5rem 0 0;
  padding-left: 0;
  list-style: none;
}

.doc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #d0332a;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.4rem;
}

.file-upload-section {
  margin-top: 1.25rem;
}

.file-upload-label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem;
  border: 2px dashed #f5d5cf;
  border-radius: 10px;
  background: #fff0ec;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.file-upload-label:hover {
  border-color: #c4412f;
  background: #fff;
}

.file-upload-label input[type='file'] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.file-upload-text {
  font-size: 1rem;
  font-weight: 600;
  color: #c4412f;
  text-align: center;
}

.file-upload-hint {
  font-size: 0.85rem;
  color: #666;
  text-align: center;
}

.file-list {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #f5d5cf;
  border-radius: 8px;
  font-size: 0.9rem;
}

.file-item-name {
  flex: 1;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item-size {
  color: #666;
  margin-left: 0.5rem;
  margin-right: 0.5rem;
}

.file-item-remove {
  background: #c4412f;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.2s;
}

.file-item-remove:hover {
  background: #b03828;
}

.email-reminder {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  background: #fff4de;
  border: 2px solid #f6ad55;
  font-size: 1.05rem;
  font-weight: 650;
  color: #7b341e;
  line-height: 1.4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.passport-note {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  background: #fff0ec;
  border: 2px solid #f5d5cf;
  font-size: 0.95rem;
  font-weight: 600;
  color: #c4412f;
  line-height: 1.5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.passport-note strong {
  font-weight: 700;
}

.email-reminder a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.consent {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.consent input[type='checkbox'] {
  margin-top: 0.15rem;
  cursor: pointer;
  accent-color: #c4412f;
}

.consent a {
  color: #c4412f;
  text-decoration: underline;
}

.consent__download-note {
  font-size: 0.85rem;
  color: #4a5568;
}

.proxy-toggle {
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

.ddu-bank-details {
  display: none;
}

.ddu-toggle {
  /* Делаем чекбокс ДДУ "строчным" элементом, а не вертикальным как обычные поля */
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.2rem; /* визуально выравниваем по центру относительно селекта */
}

.ddu-toggle .field__label {
  margin: 0;
  align-items: center;
}

.ddu-toggle input[type='checkbox'] {
  cursor: pointer;
  accent-color: #c4412f;
  margin: 0;
}

.proxy-toggle .field__label {
  align-items: center;
}

.proxy-toggle input[type='checkbox'] {
  margin-top: 0;
  cursor: pointer;
  accent-color: #c4412f;
}

/* Блоки с дополнительными данными по ИП и ЮЛ скрыты по умолчанию.
   Они показываются скриптом в зависимости от поля "Кто приобретает". */
.person-extra {
  display: none;
}

button[type='submit'] {
  background: #c4412f;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1.6rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
}

button[type='submit']:hover:not(:disabled) {
  transform: translateY(-1px);
  background-color: #b03828;
  box-shadow: 0 8px 20px rgba(196, 65, 47, 0.3);
}

button[type='submit']:disabled {
  opacity: 0.6;
  cursor: progress;
}

#form-status {
  min-height: 1.5rem;
  font-size: 0.95rem;
}

#form-status.success {
  color: #2f855a;
}

#form-status.error {
  color: #c53030;
}

@media (max-width: 600px) {
  body {
    padding: 1rem;
  }

  .card {
    padding: 1rem;
  }

  .page__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-note {
    max-width: 100%;
  }
}

/* Лоадер при отправке формы */
#form-loader {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.loader-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  background: white;
  padding: 2rem 3rem;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #c4412f;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loader-text {
  font-size: 1.1rem;
  color: #222;
  font-weight: 500;
  text-align: center;
}
