/* Основные стили для платежной формы */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Классы для управления видимостью элементов */
.hidden {
  display: none !important;
}

/* Заголовок */
header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: all 0.3s ease;
}

header img {
  height: 40px;
  margin-bottom: 0.5rem;
}

header h1 {
  margin: 0;
  color: #333;
  font-size: 1.8rem;
  font-weight: 600;
}

/* Основной контент */
.content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

/* Форма */
.card-form {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 2.5rem;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 500px;
  transition: all 0.3s ease;
}

.card-form:hover {
  transform: translateY(-5px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

/* Строки формы */
.row {
  margin-bottom: 1.5rem;
}

.row.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Лейблы */
label {
  display: block;
  margin-bottom: 0.5rem;
  color: #555;
  font-weight: 500;
  font-size: 0.9rem;
}

/* Поля ввода */
input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e1e5e9;
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-sizing: border-box;
  /* Оптимизация для сенсорных устройств */
  -webkit-appearance: none;
  -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
  touch-action: manipulation;
}

/* Select (выбор валюты) — стиль в едином виде с input */
select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e1e5e9;
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-sizing: border-box;
  background-color: #fff;
}

input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input:hover {
  border-color: #b8c5f0;
}

select:hover {
  border-color: #b8c5f0;
}

/* Кнопка */
button {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 1rem;
  /* Оптимизация для сенсорных устройств */
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
  touch-action: manipulation;
  user-select: none;
  min-height: 48px; /* Минимальная высота для удобного нажатия на мобильных */
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

/* Активное состояние для сенсорных устройств */
button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 5px 10px rgba(102, 126, 234, 0.2);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Сообщения об ошибках */
.err {
  background: #fee;
  color: #c33;
  padding: 1rem;
  border-radius: 10px;
  margin-top: 1rem;
  border: 1px solid #fcc;
  text-align: center;
}

/* Iframe контейнер */
.iframe-wrap {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  width: 100%;
  max-width: 800px;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.iframe-header {
  width: 100%;
  margin-bottom: 1rem;
  text-align: left;
}

.back-button {
  background: #6c757d;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  width: auto;
  margin: 0;
  min-height: 44px;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
  touch-action: manipulation;
  user-select: none;
}

.back-button:hover {
  background: #5a6268;
  transform: translateY(-1px);
}

.back-button:active {
  transform: translateY(1px);
}

.iframe-wrap iframe {
  width: 100%;
  height: 500px;
  border: none;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Информация о платеже */
.payment-info {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.payment-info h2 {
  margin: 0 0 1rem 0;
  color: #333;
  font-size: 1.5rem;
  font-weight: 600;
}

.payment-info p {
  margin: 0.5rem 0;
  color: #555;
}

.payment-info strong {
  color: #333;
}

/* Стили для статусов платежа */
#payment-status {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  margin: 1rem 0;
  display: inline-block;
  transition: all 0.3s ease;
}

.status-created {
  background: #e3f2fd;
  color: #1976d2;
  border: 2px solid #bbdefb;
}

.status-processing {
  background: #fff3e0;
  color: #f57c00;
  border: 2px solid #ffcc02;
}

.status-paid {
  background: #e8f5e8;
  color: #388e3c;
  border: 2px solid #c8e6c9;
}

.status-failed {
  background: #ffebee;
  color: #d32f2f;
  border: 2px solid #ffcdd2;
}

.status-cancelled {
  background: #fafafa;
  color: #757575;
  border: 2px solid #e0e0e0;
}

.waiting-text {
  color: #666;
  font-style: italic;
  margin-top: 1rem;
}

/* Адаптивность */

/* Планшеты и маленькие десктопы */
@media (max-width: 1024px) {
  .content {
    padding: 1.5rem;
  }
  
  .card-form {
    max-width: 600px;
  }
  
  .iframe-wrap {
    max-width: 700px;
  }
}

/* Планшеты */
@media (max-width: 768px) {
  .content {
    padding: 1rem;
    min-height: calc(100vh - 140px);
  }
  
  .card-form {
    padding: 2rem 1.5rem;
    border-radius: 15px;
    margin: 0.5rem;
  }
  
  .row.two {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  header {
    padding: 1rem;
  }
  
  header h1 {
    font-size: 1.5rem;
  }
  
  header img {
    height: 35px;
  }
  
  .iframe-wrap {
    padding: 1.5rem;
    margin: 0.5rem;
    border-radius: 15px;
  }
  
  .iframe-wrap iframe {
    height: 450px;
  }
  
  .payment-info {
    padding: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .payment-info h2 {
    font-size: 1.3rem;
  }
}

/* Мобильные устройства */
@media (max-width: 480px) {
  body {
    font-size: 14px;
  }
  
  .content {
    padding: 0.5rem;
    justify-content: flex-start;
    padding-top: 1rem;
  }
  
  .card-form {
    padding: 1.5rem 1rem;
    margin: 0.25rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  }
  
  header {
    padding: 0.75rem 1rem;
  }
  
  header h1 {
    font-size: 1.3rem;
    margin-top: 0.25rem;
  }
  
  header img {
    height: 30px;
    margin-bottom: 0.25rem;
  }
  
  /* Увеличиваем размеры полей для удобства на мобильных */
  input {
    padding: 1rem;
    font-size: 1rem;
    border-radius: 8px;
    min-height: 20px;
  }
  
  /* Select — мобильная оптимизация */
  select {
    padding: 1rem;
    font-size: 1rem;
    border-radius: 8px;
    min-height: 20px;
  }
  
  button {
    padding: 1.2rem;
    font-size: 1.1rem;
    border-radius: 8px;
    margin-top: 1.5rem;
  }
  
  label {
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
    font-weight: 600;
  }
  
  .row {
    margin-bottom: 1.25rem;
  }
  
  .row.two {
    gap: 0.75rem;
  }
  
  /* Оптимизация для iframe */
  .iframe-wrap {
    padding: 1rem;
    margin: 0.25rem;
    min-height: 350px;
  }
  
  .iframe-wrap iframe {
    height: 400px;
    border-radius: 10px;
  }
  
  .payment-info {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 10px;
  }
  
  .payment-info h2 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
  }
  
  .payment-info p {
    font-size: 0.9rem;
  }
  
  #payment-status {
    font-size: 1rem;
    padding: 0.6rem 1.2rem;
  }
  
  .back-button {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }
}

/* Очень маленькие экраны */
@media (max-width: 360px) {
  .content {
    padding: 0.25rem;
  }
  
  .card-form {
    padding: 1.25rem 0.75rem;
    margin: 0.125rem;
  }
  
  header {
    padding: 0.5rem;
  }
  
  header h1 {
    font-size: 1.2rem;
  }
  
  input, button {
    font-size: 0.95rem;
  }
  
  .payment-info h2 {
    font-size: 1.1rem;
  }
}

/* Дополнительные улучшения для сенсорных устройств */

/* Предотвращение увеличения в iOS Safari при фокусе на поля ввода */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  input[type="text"],
  input[type="email"],
  input[type="password"] {
    font-size: 16px !important;
  }
}

/* Скрытие стрелок у полей с типом number на мобильных */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Улучшение прокрутки на мобильных устройствах */
* {
  -webkit-overflow-scrolling: touch;
}

/* Предотвращение выделения текста при касании на мобильных */
.card-form, .iframe-wrap {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Разрешить выделение в полях ввода */
input, textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}
