/*
 * Страница входа (главная, index.php). Чистый CSS без фреймворков.
 * Стиль: светлый «морозный» glassmorphism поверх assets/fon.png (WebP-копии
 * fon.webp / fon-1280.webp, PNG — запасной вариант).
 * Фон полностью статичный: размытая приглушённая картинка + неподвижный световой
 * спот за карточкой. Анимируется только однократное появление при загрузке.
 */

.lg {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --text: #18181b;      /* zinc-900 */
  --muted: #71717a;     /* zinc-500 */
  --btn: #18181b;
  --btn-hover: #27272a; /* zinc-800 */

  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  isolation: isolate;
}

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

html, body.ac-page-login { margin: 0; min-height: 100%; background: #e8ecf1; }

/* ---------- Фон ---------- */

.lg-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: #e8ecf1;
}

.lg-bg__img {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  background-color: #e8ecf1;
  background-image: var(--bg-png);
  background-image: image-set(var(--bg-webp) type('image/webp'), var(--bg-png) type('image/png'));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* scale прячет за краем экрана светлую кромку, которую даёт blur */
  transform: scale(1.04);
  filter: blur(2px);
  /* Мягкая прогрузка: проявляется только картинка, затемняющая вуаль видна сразу —
     поэтому без яркой вспышки. Лёгкий «наезд» 1.08 → 1.04 добавляет глубины. */
  animation: lg-bg-in 1.1s ease-out both;
}
@keyframes lg-bg-in {
  from { opacity: 0; transform: scale(1.08); }
  to { opacity: 1; transform: scale(1.04); }
}

@media (max-width: 760px) {
  .lg-bg__img {
    background-image: image-set(var(--bg-webp-sm) type('image/webp'), var(--bg-png) type('image/png'));
  }
}

/* Приглушение фона: затемнение slate-950/40 + радиальная виньетка — картинка не спорит
   с карточкой, бренд и копирайт по углам читаются */
.lg-bg__veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.55) 100%),
    rgba(2, 6, 23, 0.4);
}

/* ---------- Световой спот за карточкой (статичный) ---------- */

/* Мягкое тёплое свечение: стекло карточки размывает его, создавая подсветку изнутри.
   Мягкость даёт сам radial-gradient — без filter и без анимации. */
.lg-spot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(900px, 150vw);
  height: min(760px, 130vw);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 236, 200, 1) 0%, rgba(255, 240, 214, 0.55) 38%, rgba(255, 246, 232, 0.18) 66%, rgba(255, 255, 255, 0) 100%);
  opacity: 0.22;
  pointer-events: none;
  z-index: 0;
  animation: lg-spot-in 1.2s ease-out 0.4s both;
}
/* без to: анимация идёт к собственной opacity элемента */
@keyframes lg-spot-in {
  from { opacity: 0; }
}

/* ---------- Шапка / подвал ---------- */

.lg-top,
.lg-foot {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 22px clamp(18px, 4vw, 40px);
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 0 12px rgba(0, 0, 0, 0.18);
  animation: lg-fade 0.8s ease-out 0.9s both;
}

.lg-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  transition: color 0.2s ease;
}
.lg-brand:hover { color: #fff; }
.lg-brand img {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  object-fit: cover;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.lg-foot {
  justify-content: center;
  font-size: 12px;
  letter-spacing: 0.01em;
}

/* ---------- Карточка ---------- */

.lg-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0 24px;
}

.lg-card {
  position: relative;
  z-index: 1;
  width: calc(100% - 32px);
  max-width: 420px;
  margin: 0 16px;
  padding: 44px 40px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.75) 50%, rgba(255, 255, 255, 0.65) 100%);
  -webkit-backdrop-filter: blur(40px) saturate(1.5);
  backdrop-filter: blur(40px) saturate(1.5);
  box-shadow:
    0 24px 60px -15px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  animation: lg-card-in 0.6s var(--ease-out) 0.25s both;
}

/* Без backdrop-filter стекло делаем плотнее, чтобы текст оставался читаемым */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .lg-card { background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.86)); }
}

.lg-logo {
  width: 56px;
  height: 56px;
  margin-bottom: 22px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 14px -6px rgba(15, 23, 42, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lg-logo img {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  object-fit: cover;
  display: block;
}

.lg-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 8px;
}

.lg-title {
  margin: 0 0 28px;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  text-wrap: balance;
}
@media (min-width: 640px) {
  .lg-title { font-size: 28px; }
}

/* ---------- Кнопка ---------- */

.lg-cta { width: 100%; }

.lg-btn {
  position: relative;
  width: 100%;
  min-height: 52px;
  padding: 0 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 9999px;
  background: var(--btn);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
  box-shadow: 0 10px 24px -10px rgba(24, 24, 27, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.lg-btn:hover {
  background: var(--btn-hover);
  transform: translateY(-2px);
  box-shadow: 0 16px 30px -12px rgba(24, 24, 27, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.lg-btn:active { transform: translateY(0) scale(0.98); }
.lg-btn:focus-visible { outline: 2px solid #18181b; outline-offset: 3px; }

.lg-btn__g {
  position: absolute;
  left: 8px;
  top: 50%;
  width: 36px;
  height: 36px;
  margin-top: -18px;
  border-radius: 9999px;
  background: #fff;
  color: #18181b;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lg-btn__arrow {
  position: absolute;
  right: 20px;
  top: 50%;
  margin-top: -9px;
  display: flex;
  opacity: 0.7;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.lg-btn:hover .lg-btn__arrow { transform: translateX(4px); opacity: 1; }

.lg-btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  box-shadow: none;
}

.lg-btn.is-busy { pointer-events: none; }
.lg-btn.is-busy .lg-btn__arrow { opacity: 1; transform: none; }
.lg-btn.is-busy .lg-btn__arrow svg { display: none; }
.lg-btn.is-busy .lg-btn__arrow::before {
  content: '';
  width: 16px;
  height: 16px;
  margin: 1px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  animation: lg-spin 0.7s linear infinite;
}
@keyframes lg-spin { to { transform: rotate(360deg); } }

/* ---------- Уведомление / дисклеймер ---------- */

.lg-notice {
  width: 100%;
  margin-top: 16px;
  padding: 11px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  font-size: 13px;
  line-height: 1.45;
  color: #9f1239;
  background: rgba(255, 241, 242, 0.75);
  border: 1px solid rgba(244, 63, 94, 0.22);
  border-radius: 14px;
}
.lg-notice svg { flex: none; margin-top: 1px; color: #e11d48; }

.lg-note {
  margin: 18px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #52525b; /* zinc-600 */
}

/* ---------- Форма регистрации (register.php) ---------- */

.lg-title--tight { margin-bottom: 22px; }

.lg-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  text-align: left;
}

/* Аккаунт Google, к которому привязывается профиль */
.lg-account {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 10px;
  margin-bottom: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.lg-account__av {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: var(--btn);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}
.lg-account__meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.lg-account__name,
.lg-account__mail {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lg-account__name { font-size: 14px; font-weight: 600; color: var(--text); }
.lg-account__mail { font-size: 12.5px; color: var(--muted); }
.lg-account__g {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.lg-field { display: flex; flex-direction: column; }

.lg-label {
  margin: 0 0 7px 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: #3f3f46; /* zinc-700 */
}

.lg-input {
  width: 100%;
  height: 50px;
  padding: 0 18px;
  border-radius: 9999px;
  border: 1px solid rgba(24, 24, 27, 0.1);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}
.lg-input::placeholder { color: #a1a1aa; font-weight: 400; }
.lg-input:hover { background: rgba(255, 255, 255, 0.85); }
.lg-input:focus {
  background: #fff;
  border-color: rgba(24, 24, 27, 0.55);
  box-shadow: 0 0 0 4px rgba(24, 24, 27, 0.08);
}
.lg-input.is-invalid {
  border-color: rgba(225, 29, 72, 0.5);
  box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.1);
}

.lg-hint {
  margin: 7px 4px 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.lg-cta--form { margin-top: 20px; }
.lg-form .lg-btn { border: none; cursor: pointer; }

.lg-link {
  margin-top: 16px;
  font-size: 13px;
  font-weight: 500;
  color: #3f3f46;
  text-decoration: none;
  border-bottom: 1px solid rgba(63, 63, 70, 0.25);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.lg-link:hover { color: var(--text); border-bottom-color: currentColor; }
.lg-link:focus-visible { outline: 2px solid #18181b; outline-offset: 3px; border-radius: 4px; }

.ac-page-register .lg-note { margin-top: 12px; }

/* ---------- Ожидание одобрения (pending.php) ---------- */

/* Логотип с мягко расходящимся кольцом — «идёт проверка» */
.lg-logo--wait { position: relative; }
.lg-logo--wait::before,
.lg-logo--wait::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1.5px solid rgba(24, 24, 27, 0.28);
  animation: lg-wait-ring 2.6s ease-out infinite;
  pointer-events: none;
}
.lg-logo--wait::after { animation-delay: 1.3s; }
@keyframes lg-wait-ring {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.7); opacity: 0; }
}

.lg-lead {
  margin: -10px 0 22px;
  font-size: 14px;
  line-height: 1.55;
  color: #52525b;
  text-wrap: pretty;
}

.lg-facts {
  width: 100%;
  margin: 0;
  padding: 4px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  text-align: left;
}
.lg-facts__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  font-size: 13.5px;
}
.lg-facts__row + .lg-facts__row { border-top: 1px solid rgba(24, 24, 27, 0.07); }
.lg-facts dt { color: var(--muted); }
.lg-facts dd {
  margin: 0;
  min-width: 0;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lg-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 8px;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
  font-size: 12.5px;
}
.lg-status__dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
}
.lg-status__dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  animation: lg-status-ping 1.8s ease-out infinite;
}
@keyframes lg-status-ping {
  0% { transform: scale(1); opacity: 0.7; }
  80%, 100% { transform: scale(2.6); opacity: 0; }
}
.lg-status.is-ok { background: rgba(34, 197, 94, 0.14); color: #15803d; }
.lg-status.is-ok .lg-status__dot { background: #22c55e; }
.lg-status.is-bad { background: rgba(244, 63, 94, 0.12); color: #be123c; }
.lg-status.is-bad .lg-status__dot { background: #f43f5e; }

.lg-logout { margin: 16px 0 0; }
button.lg-link {
  margin: 0;
  padding: 0;
  background: none;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  font-family: inherit;
  cursor: pointer;
}
.ac-page-pending .lg-note { margin-top: 12px; }

/* ---------- Заявка отклонена (denied.php) ---------- */

.lg-logo--denied { position: relative; }
.lg-logo__badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: #e11d48;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 4px 10px -3px rgba(225, 29, 72, 0.55);
  animation: lg-badge-pop 0.45s var(--ease-out) 0.75s both;
}
@keyframes lg-badge-pop {
  from { transform: scale(0.3); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Статус без пульса — решение окончательное */
.lg-status--static .lg-status__dot::after { display: none; }

.lg-logout--main { width: 100%; margin-top: 20px; }
.lg-logout--main .lg-btn { border: none; cursor: pointer; }
.ac-page-denied .lg-note { margin-top: 14px; }

/* ---------- Появление: фон → карточка → каскад содержимого (шаг 60 мс) ---------- */

.lg-in {
  animation: lg-rise 0.5s var(--ease-out) both;
  animation-delay: calc(0.45s + var(--i, 0) * 60ms);
}

@keyframes lg-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes lg-card-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes lg-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Адаптив ---------- */

@media (max-width: 520px) {
  .lg-card { padding: 36px 24px 28px; border-radius: 24px; }
  .lg-title { margin-bottom: 24px; }
  .lg-top { padding-top: 16px; padding-bottom: 16px; }
}

@media (max-height: 560px) {
  .lg-main { padding: 0 0 12px; }
  .lg-card { padding-top: 28px; padding-bottom: 24px; }
  .lg-logo { margin-bottom: 14px; }
}

/* ---------- Меньше движения ---------- */

@media (prefers-reduced-motion: reduce) {
  .lg-bg__img, .lg-spot, .lg-top, .lg-foot, .lg-card, .lg-in { animation-duration: 0.01ms; animation-delay: 0s; }
  .lg-btn, .lg-btn__arrow, .lg-input, .lg-link { transition: none; }
  .lg-logo--wait::before, .lg-logo--wait::after, .lg-status__dot::after { animation: none; display: none; }
  .lg-logo__badge { animation: none; }
  .lg-btn:hover { transform: none; }
}
