/* Aifory Travel — Telegram Mini App. Тема из Telegram с брендовыми фолбэками. */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #f5f7fb);
  --card: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #1a1a2e);
  --hint: var(--tg-theme-hint-color, #8a8aa3);
  --accent: #7C5CFF;
  --accent-soft: #f2effe;
  --good: #1a9e5f;
  --bad: #cf222e;
  --radius: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
#app { max-width: 640px; margin: 0 auto; padding: 12px 14px; }

.tga-loading { display: flex; justify-content: center; padding: 60px 0; }
.tga-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent);
  animation: tgaSpin .8s linear infinite;
}
@keyframes tgaSpin { to { transform: rotate(360deg); } }

/* ---------- Общие элементы ---------- */
.tga-card {
  background: var(--card); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(11,11,16,.04);
}
.tga-title { font-size: 21px; font-weight: 800; margin: 6px 0 12px; }
.tga-sub { font-size: 13px; color: var(--hint); }
.tga-btn {
  display: block; width: 100%; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 700;
  padding: 14px; border-radius: 12px; text-align: center; text-decoration: none;
}
.tga-btn.secondary { background: var(--accent-soft); color: var(--accent); }
.tga-btn:disabled { opacity: .5; }
.tga-label { display: block; font-size: 12px; color: var(--hint); margin: 12px 0 4px; }
.tga-input {
  width: 100%; border: 1.5px solid #e4e6ef; border-radius: 10px;
  padding: 11px 12px; font-size: 15px; background: var(--card); color: var(--text);
  outline: none; appearance: none;
}
.tga-input:focus { border-color: var(--accent); }
.tga-row { display: flex; gap: 10px; }
.tga-row > * { flex: 1; min-width: 0; }

/* Сегмент-переключатель (валюта / способ оплаты) */
.tga-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tga-seg__item {
  border: 1.5px solid #e4e6ef; border-radius: 10px; padding: 9px 6px;
  text-align: center; cursor: pointer; font-size: 13.5px; user-select: none;
}
.tga-seg__item b { display: block; font-size: 14.5px; }
.tga-seg__item span { color: var(--hint); font-size: 11px; }
.tga-seg__item.active { border-color: var(--accent); background: var(--accent-soft); }
.tga-seg__item.active b { color: var(--accent); }

/* Степпер гостей */
.tga-step { display: flex; align-items: center; justify-content: space-between;
  border: 1.5px solid #e4e6ef; border-radius: 10px; padding: 6px 8px; }
.tga-step button {
  width: 34px; height: 34px; border: none; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent); font-size: 20px; font-weight: 700; cursor: pointer;
}
.tga-step b { font-size: 15px; }

/* Подсказки городов */
.tga-hints { position: relative; }
.tga-hints__list {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
  background: var(--card); border-radius: 10px; box-shadow: 0 8px 24px rgba(11,11,16,.14);
  overflow: hidden; margin-top: 4px;
}
.tga-hints__item { padding: 11px 14px; cursor: pointer; border-bottom: 1px solid #f0f0f6; }
.tga-hints__item:last-child { border-bottom: none; }
.tga-hints__item span { color: var(--hint); font-size: 12px; display: block; }
.tga-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tga-chip {
  background: var(--card); border: 1.5px solid #e4e6ef; border-radius: 999px;
  padding: 7px 14px; font-size: 13.5px; cursor: pointer;
}

/* ---------- Каталог ---------- */
.tga-hotel {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  margin-bottom: 12px; box-shadow: 0 1px 3px rgba(11,11,16,.04); cursor: pointer;
}
.tga-hotel__photo { width: 100%; height: 170px; display: block;
  background: #eef0f4 center / cover no-repeat; }
.tga-hotel__body { padding: 12px 14px; }
.tga-hotel__name { font-size: 16px; font-weight: 700; }
.tga-hotel__stars { color: #f5a623; font-size: 12px; letter-spacing: 2px; }
.tga-hotel__addr { font-size: 12.5px; color: var(--hint); margin-top: 2px; }
.tga-hotel__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.tga-hotel__price { font-size: 16px; font-weight: 800; }
.tga-hotel__price small { display: block; font-weight: 400; font-size: 11px; color: var(--hint); }
.tga-hotel__price.pending { color: var(--hint); font-weight: 500; font-size: 13px; }
.tga-note {
  display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--hint);
  background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px;
}

/* ---------- Отель ---------- */
.tga-gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
  border-radius: var(--radius); margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.tga-gallery img { width: 86%; flex-shrink: 0; height: 200px; object-fit: cover;
  border-radius: var(--radius); scroll-snap-align: start; background: #eef0f4; }
.tga-gallery__ph { width: 86%; flex-shrink: 0; height: 200px;
  border-radius: var(--radius); scroll-snap-align: start;
  background: #eef0f4 center / cover no-repeat; }
.tga-rate { border-top: 1px solid #f0f0f6; padding: 12px 0; }
.tga-rate:first-child { border-top: none; }
.tga-rate__name { font-weight: 700; font-size: 14.5px; }
.tga-rate__meta { font-size: 12.5px; color: var(--hint); margin-top: 3px; }
.tga-rate__cancel { font-size: 12.5px; margin-top: 2px; }
.tga-rate__cancel.good { color: var(--good); }
.tga-rate__cancel.bad { color: var(--bad); }
.tga-rate__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.tga-rate__price { font-size: 16px; font-weight: 800; }
.tga-rate__btn {
  border: none; background: var(--accent); color: #fff; font-weight: 700;
  padding: 9px 18px; border-radius: 10px; font-size: 14px; cursor: pointer;
}

/* ---------- Оплата ---------- */
.tga-pay-amount { text-align: center; margin: 6px 0 4px; }
.tga-pay-amount b { font-size: 30px; font-weight: 800; }
.tga-pay-amount span { display: block; font-size: 13px; color: var(--hint); }
.tga-qr { display: flex; justify-content: center; margin: 14px 0 6px; }
.tga-qr img, .tga-qr canvas { border-radius: 10px; }
.tga-addr {
  display: flex; align-items: center; gap: 8px; background: var(--bg);
  border: 1px solid #e4e6ef; border-radius: 10px; padding: 10px 12px; margin-top: 10px;
}
.tga-addr code { flex: 1; font-size: 12px; overflow-wrap: anywhere; }
.tga-addr button { border: none; background: var(--accent-soft); color: var(--accent);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; font-weight: 700; cursor: pointer; }
.tga-warn { background: #fdf0c9; color: #7a5c17; border-radius: 10px;
  padding: 10px 14px; font-size: 12.5px; margin-top: 10px; }
.tga-status { text-align: center; font-size: 13.5px; color: var(--hint); margin-top: 12px; }
.tga-status.ok { color: var(--good); font-weight: 700; }
.tga-status.bad { color: var(--bad); font-weight: 700; }
.tga-dots { display: flex; justify-content: center; gap: 7px; margin-top: 12px; }
.tga-dots span { width: 10px; height: 10px; border-radius: 3px; background: var(--accent);
  animation: tgaDot 1.4s ease-in-out infinite; }
.tga-dots span:nth-child(2) { animation-delay: .15s; }
.tga-dots span:nth-child(3) { animation-delay: .3s; }
.tga-dots span:nth-child(4) { animation-delay: .45s; }
@keyframes tgaDot { 0%,100% { opacity: .3; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }

/* ---------- Мои бронирования ---------- */
.tga-order__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tga-order__hotel { font-weight: 700; font-size: 15px; }
.tga-order__row { font-size: 13.5px; margin-top: 5px; }
.tga-order__row code { font-size: 12.5px; background: var(--bg); border-radius: 6px; padding: 1px 6px; }
.tga-order__voucher { margin-top: 10px; padding: 11px; font-size: 14px; cursor: pointer; }
.tga-badge {
  flex-shrink: 0; border-radius: 999px; padding: 3px 10px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.tga-badge.ok { background: #e3f5ec; color: var(--good); }
.tga-badge.work { background: var(--accent-soft); color: var(--accent); }
.tga-badge.wait { background: #fdf0c9; color: #7a5c17; }
.tga-badge.bad { background: #fdebec; color: var(--bad); }
.tga-badge.muted { background: var(--bg); color: var(--hint); }

/* Успех */
.tga-success { text-align: center; padding: 40px 10px 20px; }
.tga-success__icon { font-size: 64px; }
.tga-success h2 { font-size: 20px; margin: 12px 0 8px; }
.tga-success p { color: var(--hint); font-size: 14px; margin-bottom: 6px; }

.tga-summary p { font-size: 13.5px; margin: 3px 0; }
.tga-summary b { font-weight: 700; }
.tga-back { color: var(--accent); font-size: 14px; cursor: pointer; margin-bottom: 8px; display: inline-block; }
.tga-empty { text-align: center; color: var(--hint); padding: 40px 10px; }
.tga-skel { height: 250px; border-radius: var(--radius); margin-bottom: 12px;
  background: linear-gradient(90deg,#edf0f5 0%,#f8f9fc 45%,#edf0f5 90%);
  background-size: 240% 100%; animation: tgaSkel 1.15s ease-in-out infinite; }
@keyframes tgaSkel { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
