/* Добавьте в index.css или в отдельный CSS-файл */
/* Стили модального окна — выдержаны в эстетике вашей страницы */
:root{
  --tg-accent-1: #1F299C; /* ваш темно-синий */
  --tg-accent-2: #0F0842; /* второй акцент */
  --tg-cta-grad: linear-gradient(135deg, #5b6bff 0%, #1f299c 100%);
  --tg-backdrop: rgba(8,10,30,0.6);
  --tg-radius: 14px;
  --tg-font: 'Montserrat', sans-serif;
}

/* Overlay */
.tg-modal-overlay {
  position: fixed;
  inset: 0;
  display: none; /* показывается JS */
  justify-content: center;
  align-items: center;
  background: var(--tg-backdrop);
  z-index: 9999;
  padding: 24px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* Modal card */
.tg-modal {
  background: linear-gradient(45deg, #B4A7D6, #F9EFE0 50%);
  border-radius: var(--tg-radius);
  max-width: 720px;
  width: 100%;
  box-shadow: 0 30px 80px rgba(8,12,40,0.45);
  position: relative;
  overflow: hidden;
  transform: translateY(16px) scale(0.98);
  opacity: 0;
  transition: transform 320ms cubic-bezier(.2,.9,.3,1), opacity 280ms ease;
  padding: 34px 36px;
  font-family: var(--tg-font);
}

/* Show state (controlled by JS adding .is-open to overlay) */
.tg-modal-overlay.is-open { display: flex; }
.tg-modal-overlay.is-open .tg-modal { transform: translateY(0) scale(1); opacity: 1; }

/* Close button */
.tg-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #111;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 160ms ease, transform 120ms ease;
}
.tg-modal-close:hover { background: rgba(0,0,0,0.06); transform: rotate(20deg); }

/* Content */
.tg-modal-content { text-align: center; padding: 6px 12px; }
.tg-modal-title {
  font-size: 26px;
  margin: 6px 0 10px;
  color: var(--tg-accent-2);
  font-weight: 700;
  letter-spacing: .2px;
}
.tg-modal-text {
  color: #333;
  font-size: 15px;
  margin-bottom: 20px;
  line-height: 1.5;
  max-width: 80%;
  margin-left: auto;
  margin-right: auto;
  opacity: 0.95;
}

/* CTA */
.tg-modal-cta {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
  color: white;
  background: var(--tg-cta-grad);
  box-shadow: 0 10px 30px rgba(40,55,255,0.14), 0 2px 6px rgba(12,18,60,0.08);
  transition: transform 140ms ease, box-shadow 140ms ease;
  font-size: 15px;
}
.tg-modal-cta:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(40,55,255,0.18); }

/* small action row */
.tg-modal-actions {
  margin-top: 18px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
}
.tg-modal-checkbox {
  font-size: 13px;
  color: #666;
  display: inline-flex;
  align-items: center;
  gap:8px;
  cursor: pointer;
}
.tg-modal-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--tg-accent-1);
  cursor: pointer;
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .tg-modal { padding: 20px; border-radius: 12px; max-width: 92%; }
  .tg-modal-title { font-size: 20px; }
  .tg-modal-text { font-size: 14px; max-width: 100%; }
  .tg-modal-cta { padding: 12px 20px; font-size: 14px; }
}



/* ------------------------- */
/*   📱 MOBILE RESPONSIVE    */
/* ------------------------- */

@media (max-width: 768px) {

  .tg-modal {
    padding: 22px 20px;
    max-width: 92%;
    border-radius: 12px;
    transform: translateY(10px) scale(0.99);
  }

  .tg-modal-title {
    font-size: 20px;
    margin-bottom: 10px;
  }

  .tg-modal-text {
    font-size: 14px;
    max-width: 100%;
    line-height: 1.45;
  }

  .tg-modal-cta {
    padding: 12px 22px;
    font-size: 14px;
    border-radius: 10px;
  }

  .tg-modal-actions {
    flex-direction: column;
    gap: 10px;
  }
}

/* ------------------------- */
/*   📱 SMALL MOBILE (480px) */
/* ------------------------- */

@media (max-width: 480px) {

  .tg-modal {
    padding: 18px 16px;
    border-radius: 10px;
  }

  .tg-modal-title {
    font-size: 18px;
    line-height: 1.25;
  }

  .tg-modal-text {
    font-size: 13.5px;
    margin-bottom: 16px;
  }

  .tg-modal-cta {
    width: 100%;
    text-align: center;
    padding: 12px;
    font-size: 14px;
    border-radius: 10px;
  }

  .tg-modal-close {
    top: 10px;
    right: 10px;
    font-size: 24px;
    padding: 4px 8px;
  }

  .tg-modal-checkbox {
    font-size: 12.5px;
    gap: 6px;
  }

  .tg-modal-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
  }
}

/* ------------------------- */
/*   🍏 iOS Safari FIXES     */
/* ------------------------- */

@supports (-webkit-touch-callout: none) {

  .tg-modal-overlay {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .tg-modal {
    background: linear-gradient(45deg, #c9c0e4, #fdf7ef 55%);
    /* Избегаем возможных белых полос */
    -webkit-transform: translateZ(0);
  }

  .tg-modal-cta {
    /* iOS корректировка градиента */
    background: linear-gradient(135deg, #6674ff 0%, #1f299c 100%);
  }
}
