/* ========================================================
   TOOREGOR UNIVERSE AUTH & ONBOARDING SDK - STYLES
   ======================================================== */

.trg-auth-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 10, 16, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.trg-auth-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.trg-auth-modal {
  width: 100%;
  max-width: 440px;
  background: #141722;
  background: linear-gradient(175deg, #161f2c 0%, #0d131d 100%);
  border: 1px solid #2a384e;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 30px rgba(56, 189, 248, 0.08);
  padding: 20px 22px;
  color: #e6edf3;
  position: relative;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  max-height: 90vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2a384e rgba(9, 14, 23, 0.8);
}

.trg-auth-modal::-webkit-scrollbar {
  width: 5px;
}

.trg-auth-modal::-webkit-scrollbar-track {
  background: rgba(9, 14, 23, 0.8);
  border-radius: 4px;
}

.trg-auth-modal::-webkit-scrollbar-thumb {
  background: #2a384e;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.trg-auth-modal::-webkit-scrollbar-thumb:hover {
  background: #38bdf8;
}

.trg-auth-backdrop.active .trg-auth-modal {
  transform: translateY(0) scale(1);
}

.trg-auth-modal.modal-large {
  max-width: 580px;
}

/* Вписанный оверлей: когда оверлей ограничен контейнером (например, дисплеем терминала) */
.trg-auth-backdrop.trg-backdrop-scoped,
.terminal-screen-display .trg-auth-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  z-index: 100;
  box-sizing: border-box;
}

.trg-auth-backdrop.trg-backdrop-scoped .trg-auth-modal,
.terminal-screen-display .trg-auth-backdrop .trg-auth-modal {
  max-height: calc(100% - 24px);
}

.trg-modal-header {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

.trg-modal-logo {
  width: 120px;
  height: 120px;
  margin: 0 auto 14px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.65)) drop-shadow(0 0 6px rgba(229, 169, 26, 0.15));
  transition: transform 0.3s ease, filter 0.3s ease;
}

.trg-modal-logo:hover {
  transform: scale(1.02);
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.75)) drop-shadow(0 0 10px rgba(229, 169, 26, 0.25));
}

.trg-modal-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 50%;
}

.trg-modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.trg-modal-sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: #8b949e;
  line-height: 1.4;
}

.trg-close-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 20px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.trg-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

/* TABS */
.trg-auth-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.trg-auth-tab {
  flex: 1;
  padding: 8px 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #8b949e;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.trg-auth-tab.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* SERVICES SECTION */
.trg-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 22px 0 16px;
  color: #8b949e;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.trg-divider::before,
.trg-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.trg-divider span {
  padding: 0 12px;
}

.trg-services-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
}
.trg-services-stack .trg-btn {
  width: 100%;
}
.trg-tg-widget-wrap {
  width: 100%;
  min-height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* BUTTONS */
.trg-btn {
  width: 100%;
  height: 46px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
  flex-shrink: 0;
}

.trg-btn:active {
  transform: scale(0.98);
}

.trg-btn-yandex {
  background: #fc3f1d;
  color: #ffffff;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 15px rgba(252, 63, 29, 0.3);
}

.trg-btn-yandex:hover {
  background: #e33516;
  box-shadow: 0 6px 20px rgba(252, 63, 29, 0.45);
}

.trg-yandex-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.trg-telegram-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.trg-telegram-badge svg {
  margin-right: 1px;
  margin-top: 1px;
}

.trg-btn-telegram {
  background: #2aabee;
  color: #ffffff;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 15px rgba(42, 171, 238, 0.3);
}

.trg-btn-telegram:hover {
  background: #229ed9;
  box-shadow: 0 6px 20px rgba(42, 171, 238, 0.45);
}

.trg-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(229, 192, 123, 0.3);
  border-top-color: #e5c07b;
  border-radius: 50%;
  animation: trgSpin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

@keyframes trgSpin {
  to { transform: rotate(360deg); }
}

.trg-btn-primary {
  background: linear-gradient(135deg, #e5c07b 0%, #d4a754 100%);
  color: #0d1117;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(229, 192, 123, 0.25);
}

.trg-btn-primary:hover {
  box-shadow: 0 6px 20px rgba(229, 192, 123, 0.35);
}

.trg-btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #c9d1d9;
}

.trg-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

/* INPUTS */
.trg-form-group {
  margin-bottom: 16px;
  text-align: left;
}

.trg-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #c9d1d9;
  margin-bottom: 6px;
}

.trg-input {
  width: 100%;
  padding: 12px 14px;
  background: #0d1017;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #ffffff;
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.trg-input:focus {
  outline: none;
  border-color: #e5c07b;
}

.trg-pin-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 16px 0;
}

.trg-pin-digit {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 22px;
  font-weight: bold;
  font-family: monospace;
  background: #0d1017;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #ffffff;
  transition: all 0.15s;
}

.trg-pin-digit:focus {
  outline: none;
  border-color: #e5c07b;
  box-shadow: 0 0 10px rgba(229, 192, 123, 0.3);
}

/* ERROR MESSAGE */
.trg-error-msg {
  background: rgba(218, 54, 51, 0.15);
  border: 1px solid rgba(218, 54, 51, 0.4);
  color: #f85149;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
  text-align: left;
}

/* TOS SCROLL BOX */
.trg-tos-scrollbox {
  background: #0d1017;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px;
  max-height: 240px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.55;
  color: #8b949e;
  margin-bottom: 18px;
  text-align: left;
}

.trg-tos-scrollbox h5 {
  color: #e5c07b;
  margin: 10px 0 4px;
  font-size: 13px;
}

.trg-tos-scrollbox h5:first-child {
  margin-top: 0;
}

.trg-tos-scrollbox p {
  margin: 0 0 8px;
}

/* USER PILL WIDGET IN APP HEADER */
.trg-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(22, 27, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 12px 4px 5px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.trg-user-pill:hover {
  background: rgba(30, 36, 46, 0.95);
  border-color: rgba(229, 192, 123, 0.4);
}

.trg-pill-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #21262d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  color: #e5c07b;
  overflow: hidden;
}

.trg-pill-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trg-pill-name {
  font-size: 12px;
  font-weight: 600;
  color: #e6edf3;
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trg-pill-sync {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #238636;
  box-shadow: 0 0 6px #238636;
}

.trg-pill-sync.syncing {
  background: #e5c07b;
  box-shadow: 0 0 6px #e5c07b;
  animation: trgPulse 1s infinite alternate;
}

@keyframes trgPulse {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* ========================================================
   TELEGRAM MODAL - NASAPUNK / AEROSPACE STYLING
   ======================================================== */
.trg-tg-header {
  margin-bottom: 10px;
}

.trg-tg-radar-badge {
  position: relative;
  width: 46px;
  height: 46px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trg-tg-radar-core {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.22) 0%, rgba(14, 23, 38, 0.95) 70%);
  border: 1.5px solid rgba(56, 189, 248, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.35), inset 0 0 10px rgba(56, 189, 248, 0.2);
  z-index: 2;
}

.trg-tg-radar-core svg {
  margin-right: 2px;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6));
}

.trg-tg-radar-ping {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid rgba(56, 189, 248, 0.5);
  animation: trgRadarPulse 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  pointer-events: none;
}

@keyframes trgRadarPulse {
  0% { transform: scale(0.9); opacity: 0.9; }
  70% { transform: scale(1.45); opacity: 0; }
  100% { transform: scale(1.45); opacity: 0; }
}

.trg-tg-sys-tag {
  font-family: 'Share Tech Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 10px;
  color: #38bdf8;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.trg-tg-body {
  text-align: center;
  padding: 0;
}

.trg-tg-qr-frame {
  background: #ffffff;
  border-radius: 10px;
  padding: 8px;
  display: inline-block;
  margin: 0 auto 8px auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(56, 189, 248, 0.35), 0 0 14px rgba(56, 189, 248, 0.15);
  line-height: 0;
}

.trg-tg-qr-container {
  width: 144px;
  height: 144px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trg-tg-qr-container img,
.trg-tg-qr-container canvas {
  display: block;
  width: 144px !important;
  height: 144px !important;
}

.trg-tg-scan-hint {
  font-family: 'Share Tech Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  color: #64748b;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  line-height: 1.3;
}

.trg-btn-tg-action {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #ffffff;
  font-family: 'Share Tech Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  height: 40px;
  min-height: 40px;
  box-shadow: 0 0 18px rgba(2, 132, 199, 0.35);
  text-decoration: none;
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

.trg-btn-tg-action:hover {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  border-color: #38bdf8;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.55);
  color: #ffffff;
  transform: translateY(-1px);
}

.trg-tg-telemetry-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Share Tech Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  color: #38bdf8;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.trg-tg-telemetry-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: trgDotPulse 1.2s ease-in-out infinite alternate;
}

@keyframes trgDotPulse {
  from { opacity: 0.35; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.15); }
}

.trg-btn-tg-back {
  height: 36px;
  min-height: 36px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-family: 'Share Tech Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.2s ease;
}

.trg-btn-tg-back:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(56, 189, 248, 0.4);
  color: #f1f5f9;
}
