/* EduVR UI — единый порядок интерфейса платёжного пути (T-040 этап 2, вариант B + плитки выбора метода D).
   Цвета и палитра — те же, что были на сайте (индиго→фиолет, зелёный, красный, янтарный); меняется только порядок:
   одинаковые отступы (12 px), карточка 440 px, поля и кнопки 52 px, «← Înapoi» ссылкой под кнопкой, один шрифт.
   Классы с префиксом ui-. Состояния, которыми управляет JS страниц (hidden, show, border-red-500, ring-red-500,
   modal-card, modal-visible), определены здесь и не зависят от Tailwind. */

:root {
  --ink: #0f172a;
  --text-2: #374151;
  --muted: #6b7280;
  --title: #3730a3;
  --lead: #4338ca;
  --soft: #eef2ff;
  --panel: #f9fafb;
  --line: #cbd5e1;
  --ph: #94a3b8;
  --err: #dc2626;
  --warn: #ef4444;
  --r-card: 20px;
  --r-btn: 14px;
  --r-field: 12px;
  --h-ctl: 52px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* JS показывает и прячет блоки классом hidden (без !important: в футере index.html есть «hidden md:block») */
.hidden { display: none; }

/* ---------- Страница и карточка ---------- */
body.ui-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: linear-gradient(135deg, #050518, #2b1b6b, #ff3ea5);
}

.ui-card {
  width: 100%;
  max-width: 440px;
  margin: 0;
  padding: 28px 20px;
  background: #fff;
  border-radius: var(--r-card);
  box-shadow: 0 20px 60px rgba(5, 5, 24, 0.4);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
}
/* карточка формы на index.html: на широком экране чуть шире, чтобы имя и фамилия встали в ряд */
@media (min-width: 640px) {
  .ui-card--form { max-width: 520px; }
}
/* Первая страница (форма): вид как до T-040 — серовато-белая полупрозрачная карточка с тонкой рамкой,
   чёрный заголовок, тонкая рамка полей (1.5px на телефоне рисуется заметно толще). Только цвета и рамки. */
.ui-card--form {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e2e8f0;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.ui-card--form .ui-title { color: var(--ink); }
.ui-card--form .ui-field { border-width: 1px; }

/* ---------- Заголовки и текст ---------- */
.ui-title {
  margin: 0 0 16px;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--title);
  overflow-wrap: anywhere;
}
.ui-title--qr { color: #1d4ed8; }
.ui-title--card, .ui-title--ok { color: #16a34a; }
.ui-title--err { color: #dc2626; }

.ui-lead {
  margin: 0 0 20px;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--lead);
  overflow-wrap: anywhere;
}
.ui-title + .ui-lead { margin-top: -6px; }

.ui-text {
  margin: 12px 0;
  font-size: 16px;
  color: var(--text-2);
  text-wrap: balance;
}
.ui-muted { color: var(--muted); font-size: 14px; line-height: 1.45; }
.ui-note { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.ui-note + .ui-panel { margin-top: 0; }
.ui-title + .ui-note, .ui-title + .ui-warn-text { margin-top: -10px; }
.ui-warn-text { margin: 0 0 16px; font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--warn); }

/* ---------- Форма: поля 52 px, отступы между всеми элементами одинаковые (12 px) ---------- */
.ui-form { display: grid; gap: 12px; margin: 0; text-align: left; }
.ui-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.ui-row--class { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ui-row--class .ui-field { padding-inline: 14px; }
@media (max-width: 339px) {
  .ui-row--class { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 640px) {
  .ui-row--names { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.ui-field {
  display: block;
  width: 100%;
  min-height: var(--h-ctl);
  margin: 0;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-field);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.3;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
}
.ui-field::placeholder { color: var(--ph); opacity: 1; }
.ui-field:focus { outline: none; border-color: #34f5c5; box-shadow: 0 0 0 2px #34f5c5; }
/* index.html добавляет и снимает класс border-red-500 — имя то же, вид красной рамки */
.ui-field.border-red-500 { border-color: var(--warn); }
/* буква класса: вводимый текст заглавными, подсказка — как написана */
.ui-field--upper { text-transform: uppercase; }
.ui-field--upper::placeholder { text-transform: none; }

.ui-error-text { margin: 0; font-size: 14px; line-height: 1.4; font-weight: 500; color: var(--err); text-align: left; }
.ui-error-box {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--r-field);
  background: rgba(248, 113, 113, 0.15);
  color: #b91c1c;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}
.ui-error-box.show { display: block; }

/* ---------- Кнопки ---------- */
button.ui-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--h-ctl);
  margin: 0;
  padding: 14px 20px;
  border: 0;
  border-radius: var(--r-btn);
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  color: #fff;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: filter 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
button.ui-btn:hover { filter: brightness(0.94); }
button.ui-btn:active { transform: scale(0.98); }
button.ui-btn:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; transform: none; filter: none; }
button.ui-btn:focus-visible, button.ui-link-back:focus-visible, .ui-tile:focus-visible, .ui-check input:focus-visible {
  outline: 3px solid #a5b4fc;
  outline-offset: 2px;
}

/* цвета кнопок — как на сайте */
button.ui-btn-main { background-image: linear-gradient(to right, #4f46e5, #9333ea); box-shadow: 0 10px 15px -3px rgba(6, 182, 212, 0.2); }
button.ui-btn-green { background-image: linear-gradient(to right, #16a34a, #059669); }
button.ui-btn-qr { background-image: linear-gradient(120deg, #2563eb, #7c3aed); box-shadow: 0 10px 30px rgba(59, 130, 246, 0.35); }
button.ui-btn-card { background-color: #16a34a; background-image: none; }
button.ui-btn-ok { background-color: #16a34a; background-image: none; }
button.ui-btn-err { background-color: #dc2626; background-image: none; }

/* «← Înapoi (editează)»: ссылка под главной кнопкой, по центру; зона нажатия ≥44 px */
button.ui-link-back {
  display: block;
  min-height: 44px;
  margin: 8px auto 0;
  padding: 10px 16px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 15px;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}
button.ui-link-back:hover { color: var(--text-2); }

/* ---------- Выбор метода оплаты: плитки со значком (цвета методов — как на сайте) ---------- */
.ui-stack { display: grid; gap: 12px; }
button.ui-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 0;
  padding: 14px 16px;
  border: 1.5px solid var(--tile);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}
button.ui-tile:hover { box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12); }
button.ui-tile:active { transform: scale(0.98); }
button.ui-tile--qr { --tile: #5f5cff; --tile-bg: linear-gradient(135deg, #5f5cff, #9b5cff); --tile-fg: #ffffff; }
button.ui-tile--card { --tile: #00c853; --tile-bg: linear-gradient(135deg, #00c853, #00e676); --tile-fg: #0b1f14; }
.ui-tile__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--r-field);
  background: var(--tile-bg);
  color: var(--tile-fg);
}
.ui-tile__icon svg { width: 24px; height: 24px; }
.ui-tile__name { display: block; font-size: 17px; line-height: 1.3; font-weight: 700; }
.ui-tile__sub { display: block; font-size: 14px; line-height: 1.3; color: var(--muted); }
.ui-tile__go { margin-left: auto; font-size: 24px; line-height: 1; color: var(--tile); }

/* галочка условий: зона нажатия ≥44 px */
.ui-terms { margin: 0 0 16px; text-align: left; }
.ui-terms .ui-error-text { margin-top: 6px; }
.ui-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px;
  padding: 6px 4px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
}
.ui-check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: #4f46e5; }
.ui-check a { color: #4f46e5; text-decoration: underline; }
/* payment-choice.html на 0,8 с добавляет ring-red-500, если условия не приняты */
.ui-check.ring-red-500 { border-radius: 6px; box-shadow: 0 0 0 2px var(--warn); }

/* ---------- Блоки с данными ---------- */
.ui-info {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: var(--r-field);
  background: var(--soft);
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
}
.ui-info p { margin: 0; }
.ui-info p + p { margin-top: 10px; }
.ui-info--card { background: #ecfdf3; }
.ui-info--qr { background: var(--panel); }

.ui-panel {
  margin: 16px 0;
  padding: 16px 18px;
  border-radius: var(--r-field);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  overflow-wrap: anywhere;
}
.ui-panel p { margin: 6px 0; }
.ui-panel .ui-school {
  margin: 0 0 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
  line-height: 1.3;
  color: var(--lead);
}
.ui-panel .ui-muted { margin: 0 0 12px; }
.ui-panel a { color: #4338ca; font-weight: 600; text-decoration: none; }
.ui-panel a:hover { text-decoration: underline; }

/* шаг 1: имя, подпись «clasa», бейдж класса */
.ui-student { margin: 0 0 20px; padding: 16px; border-radius: var(--r-field); background: var(--soft); text-align: center; }
.ui-name { margin: 0; font-size: 18px; line-height: 1.3; font-weight: 700; color: #312e81; overflow-wrap: anywhere; }
/* подпись «clasa» — едва заметная и близко к значку класса, как было до T-040 (11 px, бледно-индиго, прозрачность 60%) */
.ui-student .ui-muted { margin: 4px 0 1px; font-size: 11px; line-height: 1; color: #a5b4fc; opacity: 0.6; }
.ui-badge {
  display: inline-block;
  margin-top: 0;
  padding: 8px 20px;
  border-radius: var(--r-field);
  background: #fbbf24;
  color: #78350f;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0.025em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

/* шаг 2 и страница ошибки: значок и строка контакта */
.ui-contact { display: flex; align-items: flex-start; gap: 10px; }
.ui-contact svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  fill: none;
  stroke: #4f46e5;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ui-contact .ui-value { color: #4338ca; font-weight: 500; }

/* «ребёнок уже записан» */
.ui-warn {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #fcd34d;
  border-radius: var(--r-field);
  background: #fffbeb;
  color: #78350f;
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
}

/* значок результата: SVG вместо глифа ✓ ✗ (одинаково на всех телефонах) */
.ui-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border: 3px solid currentColor;
  border-radius: 50%;
}
.ui-icon svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.ui-icon--ok { color: #16a34a; background: #f0fdf4; }
.ui-icon--err { color: #dc2626; background: #fef2f2; }
