/* ============================================================
   FORM CONTAINER
   ============================================================ */
.custom-contact-form {
  max-width: 700px;
  margin: 0 auto;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-sizing: border-box;
  padding: 0 15px;
}

/* ============================================================
   FORM ROW LAYOUT
   ============================================================ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
  align-items: start;
}

.form-row .input-group-block:nth-child(1) { grid-column: 1; }
.form-row .input-group-block:nth-child(2) { grid-column: 2; }

.form-row .input-group-block.full-width,
.form-row .phone-block.full-width { grid-column: 1 / -1; }

/* ============================================================
   INPUT GROUPS & FIELDS
   ============================================================ */
.input-group-block {
  position: relative;
  display: flex;
  align-items: center;
  flex-direction: column;
  width: 100%;
}

/* ============================================================
   ОБЩИЕ ИКОНКИ ДЛЯ ВСЕХ ПОЛЕЙ
   ============================================================ */
.input-group-block::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background-size: contain;
  background-repeat: no-repeat;
  z-index: 1;
  pointer-events: none;
}

/* Иконка для имени */
.input-group-block:has(#full-name)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4.4 3.6-7 8-7s8 2.6 8 7'/%3E%3C/svg%3E");
}

/* Иконка для email */
.input-group-block:has(#email)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M4 7l8 6 8-6'/%3E%3C/svg%3E");
}

/* Иконка для инвестиций (доллар) */
.input-group-block.select-with-icon::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='1' x2='12' y2='23'/%3E%3Cpath d='M17 5H9.5A3.5 3.5 0 0 0 6 8.5v0A3.5 3.5 0 0 0 9.5 12h5A3.5 3.5 0 0 1 18 15.5v0A3.5 3.5 0 0 1 14.5 19H6'/%3E%3C/svg%3E");
}

/* Убираем иконку у textarea */
.input-group-block:has(#input_message)::before {
  content: none;
}

/* Убираем иконку у phone (она отдельно) */
.phone-block::before {
  content: none;
}

.phone-block {
  position: relative;
  display: flex;
  align-items: center;
}

/* ============================================================
   ПОЛЯ ВВОДА
   ============================================================ */
.input-group-block input:not([type="hidden"]),
.input-group-block select,
.phone-block input {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 38px;
  background-color: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 18px;
  color: #212529;
  font-family: 'Roboto', sans-serif;
  box-sizing: border-box;
  outline: none;
  transition: all 0.2s ease;
}

.phone-block input {
  padding: 0 14px 0 14px;
}

.input-group-block textarea {
  width: 100%;
  min-height: 70px;
  max-height: 220px;
  padding: 10px 14px;
  background-color: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 18px;
  color: #212529;
  font-family: 'Roboto', sans-serif;
  box-sizing: border-box;
  outline: none;
  resize: vertical;
  transition: all 0.2s ease;
}

/* ============================================================
   ПЛЕЙСХОЛДЕРЫ - ЕДИНЫЙ СТИЛЬ ДЛЯ ВСЕХ ПОЛЕЙ
   ============================================================ */
.input-group-block input::placeholder,
.input-group-block textarea::placeholder,
.phone-block input::placeholder,
.input-group-block select:invalid,
.input-group-block select option[value=""] {
  color: #999 !important;
  font-weight: 400 !important;
  font-size: 18px !important;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  line-height: 1.3 !important;
}

/* Специально для селекта */
.input-group-block select:invalid {
  color: #999 !important;
}

.input-group-block select option:not([value=""]) {
  color: #212529 !important;
  font-weight: 400 !important;
}

.input-group-block input:focus,
.input-group-block textarea:focus,
.phone-block input:focus,
.input-group-block select:focus {
  border: 2px solid #d4b649;
  background-color: #fff;
}

/* ============================================================
   SELECT STYLING - МАКСИМАЛЬНО КОМПАКТНЫЙ ДЛЯ ВСЕХ ЭКРАНОВ
   ============================================================ */
.input-group-block select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  height: 46px !important;
  min-height: 46px !important;
  line-height: 1.3 !important;
  padding: 6px 28px 6px 34px !important;
  background-color: #fafafa !important;
  color: #212529 !important;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9L12 15L18 9' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  cursor: pointer;
  font-size: 15px !important;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  box-sizing: border-box;
  letter-spacing: -0.2px;
}

.input-group-block select:focus {
  border: 2px solid #d4b649;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9L12 15L18 9' stroke='%23d4b649' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.input-group-block select option {
  font-size: 15px;
  padding: 8px 12px;
}

/* ============================================================
   PHONE FIELD
   ============================================================ */
.phone-block input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 18px;
  color: #212529;
  box-sizing: border-box;
  outline: none;
  transition: all 0.2s ease;
}

.phone-block input:focus {
  border: 2px solid #d4b649;
  background: #fff;
}

/* ============================================================
   PRIVACY NOTE - СТИЛЬ ПО ЗАДАЧЕ
   ============================================================ */
.privacy-note {
  text-align: left;
  margin: 0 0 10px;
  padding: 0 4px;
}

.privacy-text {
  font-size: 13px !important;
  color: #777;
  line-height: 1.4;
  margin: 0;
  font-weight: 400 !important;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

.privacy-text a {
  color: #5b9bd5 !important;
  text-decoration: none !important;
  font-weight: 400 !important;
  border-bottom: none !important;
  transition: opacity 0.2s;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

.privacy-text a:hover {
  opacity: 0.7;
}

/* ============================================================
   FORM FOOTER
   ============================================================ */
.form-footer {
  text-align: center;
  margin-top: 10px;
}

/* ============================================================
   SUBMIT BUTTON
   ============================================================ */
.submit-button {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #d4b649 0%, #b89a3a 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(212, 182, 73, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.submit-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #b89a3a 0%, #a0852e 100%);
  box-shadow: 0 6px 16px rgba(212, 182, 73, 0.4);
  transform: translateY(-2px);
}

.submit-button:active:not(:disabled) {
  transform: translateY(0);
}

.submit-button.loading {
  pointer-events: none;
  opacity: 0.9;
  background: linear-gradient(135deg, #d4b649 0%, #c4a642 100%);
  min-height: 52px;
}

.submit-button .spinner {
  display: inline-block;
  font-size: 18px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.submit-button .loading-text {
  display: inline-block;
  margin-left: 8px;
  font-weight: 500;
}

.submit-button.loading::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -100%;
  width: 200%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #d4b649, #f0d860, #d4b649, transparent);
  animation: progress-loading 2s ease-in-out infinite;
  border-radius: 0 0 8px 8px;
}

@keyframes progress-loading {
  0% { left: -100%; }
  100% { left: 100%; }
}

.submit-button:disabled {
  cursor: not-allowed;
}

/* ============================================================
   MESSAGE DISPLAY
   ============================================================ */
#custom-form-message {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  animation: slideIn 0.3s ease;
  display: none;
}

#custom-form-message:not(:empty) {
  display: block;
}

#custom-form-message.success {
  background-color: #f0f8f0;
  border: 1px solid #c8e6c9;
  color: #2e7d32;
}

#custom-form-message.error {
  background-color: #fff3f3;
  border: 1px solid #ffcdd2;
  color: #c62828;
}

#custom-form-message.timeout {
  background-color: #fff8e1;
  border: 1px solid #ffe082;
  color: #e65100;
}

#custom-form-message p {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* ============================================================
   INTL TEL INPUT OVERRIDES
   ============================================================ */
.iti__search-input {
  height: 32px;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 4px;
}

.iti__country-container {
  font-size: 14px;
}

.iti__flag-container {
  margin-right: 8px;
}

.phone-block .iti,
.phone-block .intl-tel-input {
  width: 100% !important;
}

.phone-block .iti {
  display: block !important;
}

.phone-block .iti__flag-container {
  z-index: 2;
}

.phone-block .iti__selected-flag {
  background: transparent !important;
  padding: 0 8px 0 12px !important;
}

.phone-block .iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag {
  background: rgba(0, 0, 0, 0.05) !important;
}

/* ============================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ============================================================ */
@media (max-width: 768px) {
  .custom-contact-form {
    padding: 0 8px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 8px;
  }

  .form-row .input-group-block:nth-child(1),
  .form-row .input-group-block:nth-child(2),
  .form-row .input-group-block,
  .form-row .phone-block {
    grid-column: 1 / -1;
    width: 100%;
  }

  .input-group-block input:not([type="hidden"]),
  .phone-block input {
    height: 40px;
    font-size: 15px;
    padding: 0 10px 0 28px;
  }

  .phone-block input {
    padding: 0 10px;
  }

  .input-group-block select {
    height: 40px !important;
    min-height: 40px !important;
    padding: 4px 24px 4px 26px !important;
    font-size: 14px !important;
    line-height: 1.3 !important;
    background-position: right 8px center !important;
    background-size: 12px !important;
    letter-spacing: -0.3px !important;
  }

  .input-group-block::before {
    width: 14px;
    height: 14px;
    left: 8px;
  }

  .input-group-block.select-with-icon::before {
    width: 14px;
    height: 14px;
    left: 8px;
  }

  .input-group-block textarea {
    font-size: 15px;
    min-height: 55px;
    padding: 8px 10px;
  }

  /* Плейсхолдеры на планшете */
  .input-group-block input::placeholder,
  .input-group-block textarea::placeholder,
  .phone-block input::placeholder,
  .input-group-block select:invalid {
    font-size: 15px !important;
  }

  .privacy-text {
    font-size: 13px !important;
  }

  .privacy-text a {
    font-size: 13px !important;
  }

  .submit-button {
    font-size: 15px;
    padding: 12px 16px;
  }
}

@media (max-width: 480px) {
  .custom-contact-form {
    padding: 0 6px;
  }

  .form-row {
    gap: 6px;
    margin-bottom: 6px;
  }

  .input-group-block input:not([type="hidden"]),
  .phone-block input {
    height: 38px;
    font-size: 14px;
    padding: 0 8px 0 26px;
  }

  .phone-block input {
    padding: 0 8px;
  }

  .input-group-block select {
    height: 38px !important;
    min-height: 38px !important;
    padding: 4px 22px 4px 24px !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
    background-position: right 6px center !important;
    background-size: 11px !important;
    letter-spacing: -0.4px !important;
  }

  .input-group-block::before {
    width: 13px;
    height: 13px;
    left: 7px;
  }

  .input-group-block.select-with-icon::before {
    width: 13px;
    height: 13px;
    left: 7px;
  }

  .input-group-block textarea {
    font-size: 14px;
    min-height: 50px;
    padding: 6px 8px;
  }

  /* Плейсхолдеры на мобилке */
  .input-group-block input::placeholder,
  .input-group-block textarea::placeholder,
  .phone-block input::placeholder,
  .input-group-block select:invalid {
    font-size: 14px !important;
  }

  .privacy-text {
    font-size: 13px !important;
  }

  .privacy-text a {
    font-size: 13px !important;
  }

  .submit-button {
    font-size: 14px;
    padding: 10px 14px;
  }
}

@media (max-width: 375px) {
  .input-group-block select {
    font-size: 12px !important;
    padding: 3px 20px 3px 22px !important;
    height: 36px !important;
    min-height: 36px !important;
    letter-spacing: -0.5px !important;
  }

  .input-group-block::before,
  .input-group-block.select-with-icon::before {
    width: 12px;
    height: 12px;
    left: 6px;
  }

  .input-group-block input:not([type="hidden"]),
  .phone-block input {
    font-size: 13px;
    height: 36px;
    padding: 0 6px 0 24px;
  }

  .phone-block input {
    padding: 0 6px;
  }

  /* Плейсхолдеры на 375px */
  .input-group-block input::placeholder,
  .input-group-block textarea::placeholder,
  .phone-block input::placeholder,
  .input-group-block select:invalid {
    font-size: 13px !important;
  }

  .privacy-text {
    font-size: 13px !important;
  }

  .privacy-text a {
    font-size: 13px !important;
  }

  .submit-button {
    font-size: 13px;
    padding: 8px 12px;
  }
}

@media (max-width: 320px) {
  .input-group-block select {
    font-size: 11px !important;
    padding: 3px 18px 3px 20px !important;
    letter-spacing: -0.6px !important;
  }

  .input-group-block::before,
  .input-group-block.select-with-icon::before {
    width: 11px;
    height: 11px;
    left: 5px;
  }

  .input-group-block input:not([type="hidden"]),
  .phone-block input {
    font-size: 12px;
    padding: 0 5px 0 22px;
  }

  .phone-block input {
    padding: 0 5px;
  }

  /* Плейсхолдеры на 320px */
  .input-group-block input::placeholder,
  .input-group-block textarea::placeholder,
  .phone-block input::placeholder,
  .input-group-block select:invalid {
    font-size: 12px !important;
  }

  .privacy-text {
    font-size: 13px !important;
  }

  .privacy-text a {
    font-size: 13px !important;
  }

  .submit-button {
    font-size: 12px;
    padding: 8px 10px;
  }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.custom-contact-form {
  animation: fadeIn 0.3s ease;
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
.custom-contact-form input:focus,
.custom-contact-form textarea:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.submit-button:focus-visible {
  outline: 2px solid #d4b649;
  outline-offset: 2px;
}