/* nl-preview.css · v1
   Превью в редакторе ссылок в стиле телефона с главной («Как это работает»)
   + выравнивание нижнего меню кабинета на телефоне.
   Только внешний вид: разметка, логика и данные не меняются. */

/* ---------- 1. Корпус телефона ---------- */
html body #editorModal .mini-phone {
  width: 300px !important;
  height: 620px !important;
  padding: 8px !important;
  border-radius: 48px !important;
  background: #171717 !important;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .10),
    0 40px 80px -30px rgba(30, 20, 80, .55),
    0 0 90px -10px rgba(139, 92, 246, .35),
    inset 0 0 0 1px rgba(255, 255, 255, .10) !important;
}
/* Dynamic Island вместо узкой полоски */
html body #editorModal .mini-phone:before {
  top: 16px !important;
  width: 86px !important;
  height: 24px !important;
  border-radius: 999px !important;
  background: #0a0a0a !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06) !important;
  z-index: 30 !important;
}
html body #editorModal .mini-phone:after {
  right: -3px !important;
  top: 130px !important;
  height: 58px !important;
  background: #262626 !important;
  box-shadow: 0 70px 0 #262626 !important;
}
html body #editorModal .mini-phone .phone-home-indicator {
  width: 104px !important;
  height: 4px !important;
  bottom: 16px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, .55) !important;
  z-index: 30 !important;
}

/* ---------- 2. Экран ---------- */
html body #editorModal .mini-screen {
  position: relative !important;
  border-radius: 40px !important;
  padding: 74px 18px 40px !important;
  scrollbar-width: none !important;
}
html body #editorModal .mini-screen::-webkit-scrollbar { display: none !important; }
/* мягкие «mesh»-пятна поверх цвета темы, как на главной */
html body #editorModal .mini-screen::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 100%;
  min-height: 604px;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60% 34% at 100% 0%, rgba(255, 155, 216, .38), transparent 70%),
    radial-gradient(70% 36% at 0% 100%, rgba(157, 136, 255, .34), transparent 70%),
    radial-gradient(80% 30% at 20% 0%, rgba(255, 255, 255, .16), transparent 70%);
  animation: nlpBlob 9s ease-in-out infinite alternate;
}
@keyframes nlpBlob { from { transform: translate(0, 0); } to { transform: translate(10px, -8px); } }
html body #editorModal .mini-screen > :not(.mini-cover):not(.preview-selection-box) { position: relative; z-index: 1; }
html body #editorModal .mini-screen > .preview-selection-box { z-index: 5 !important; }

/* ---------- 3. Профиль ---------- */
html body #editorModal .mini-avatar {
  width: 78px !important;
  height: 78px !important;
  margin: 0 auto !important;
  border: 4px solid #fff !important;
  border-radius: 999px !important;
  box-shadow: 0 12px 26px -10px rgba(20, 10, 60, .55) !important;
  font-size: 26px !important;
}
html body #editorModal #previewName {
  margin: 12px 0 0 !important;
  font-family: Fustat, Outfit, Inter, system-ui, sans-serif !important;
  font-weight: 800 !important;
  font-size: 17px !important;
  line-height: 1.2 !important;
  letter-spacing: -.2px !important;
  text-align: center !important;
}
html body #editorModal #previewBio {
  margin: 4px 0 0 !important;
  font-size: 11.5px !important;
  line-height: 1.35 !important;
  text-align: center !important;
  opacity: .85;
}

/* ---------- 4. Кнопки: «стеклянные», как на главной ----------
   Цвет кнопки из настроек сохраняется, сверху ложится стекло и блик. */
html body #editorModal .mini-cta,
html body #editorModal .mini-link {
  position: relative !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-height: 44px !important;
  height: auto !important;
  margin: 0 !important;
  padding: 10px 16px !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  text-align: center !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
  border: 1px solid rgba(255, 255, 255, .32) !important;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .04)) !important;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 10px 20px -12px rgba(20, 10, 60, .65) !important;
  transform: none !important;
}
html body #editorModal .mini-cta { margin-top: 20px !important; }
html body #editorModal .mini-extra {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  margin-top: 10px !important;
  width: 100% !important;
}
html body #editorModal .mini-cta::after,
html body #editorModal .mini-link::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 45%;
  pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent);
  animation: nlpShine 2.8s ease-in-out infinite;
}
html body #editorModal .mini-extra .mini-link:nth-child(1)::after { animation-delay: .25s; }
html body #editorModal .mini-extra .mini-link:nth-child(2)::after { animation-delay: .5s; }
html body #editorModal .mini-extra .mini-link:nth-child(n+3)::after { animation-delay: .75s; }
@keyframes nlpShine { 0% { left: -60%; } 55%, 100% { left: 130%; } }

/* ---------- 5. Подложка вокруг телефона ---------- */
html body #editorModal .builder-stage {
  background:
    radial-gradient(40% 50% at 50% 50%, rgba(157, 136, 255, .18), transparent 70%),
    radial-gradient(rgba(23, 23, 23, .06) 1px, transparent 1.4px) 0 0 / 18px 18px,
    #fafaff !important;
}

/* ---------- 6. Телефон: кнопка «Во весь экран» не налезает на превью ---------- */
@media (max-width: 768px) {
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage .mobile-preview-badge {
    top: 10px !important;
    right: 10px !important;
    transform: none !important;
    flex-direction: row !important;
    width: auto !important;
    min-height: 0 !important;
    height: 34px !important;
    padding: 0 12px !important;
    gap: 6px !important;
    border-radius: 999px !important;
    white-space: nowrap !important;
    font-size: 11.5px !important;
    background: rgba(255, 255, 255, .92) !important;
    border: 1px solid rgba(0, 0, 0, .06) !important;
    box-shadow: 0 6px 16px -8px rgba(30, 20, 80, .35) !important;
    z-index: 20 !important;
  }
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage .mobile-preview-badge b {
    white-space: nowrap !important;
    font-size: 11.5px !important;
  }
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage .mobile-preview-badge svg { width: 14px !important; height: 14px !important; }
}

/* ---------- 7. Нижнее меню кабинета на телефоне ---------- */
@media (max-width: 768px) {
  body.uip-has-bnav:not(.uip-editor-open):not(.uip-overlay-open):not(.uip-drawer-open) .uip-bnav {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%);
    width: calc(100% - 24px) !important;
    max-width: 440px;
    box-sizing: border-box !important;
    gap: 4px !important;
    padding: 5px !important;
    border-radius: 24px !important;
    background: rgba(255, 255, 255, .96) !important;
    border: 1px solid rgba(0, 0, 0, .07) !important;
    box-shadow: 0 16px 34px -18px rgba(30, 20, 80, .35), 0 2px 6px rgba(0, 0, 0, .05) !important;
    overflow: hidden;
  }
  .uip-bnav button {
    box-sizing: border-box !important;
    height: 54px !important;
    min-height: 54px !important;
    padding: 0 2px !important;
    gap: 4px !important;
    border-radius: 19px !important;
    font-size: 10.5px !important;
  }
  .uip-bnav svg { width: 20px !important; height: 20px !important; flex: 0 0 auto; }
  .uip-bnav button.is-active { background: rgba(104, 71, 238, .08) !important; color: #6847ee !important; }
  .uip-bnav button.uip-bnav-new {
    background-image: linear-gradient(135deg, #6847ee, #9d88ff) !important;
    color: #fff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3) !important;
  }
  /* последний элемент списка не прячется под меню */
  body.uip-has-bnav #root .app .main { padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)) !important; }
}

@media (prefers-reduced-motion: reduce) {
  html body #editorModal .mini-screen::before,
  html body #editorModal .mini-cta::after,
  html body #editorModal .mini-link::after { animation: none !important; }
}

/* ---------- 8. Доводка после проверки ---------- */
/* контент превью ближе к верху, как на главной */
html body #editorModal .mini-screen { padding-top: 46px !important; }
html body #editorModal .mini-cta, html body #editorModal .mini-link { font-size: 13.5px !important; min-height: 46px !important; }
html body #editorModal #previewName { font-size: 18px !important; }
@media (max-width: 768px) {
  /* «Во весь экран» — компактная круглая кнопка в углу, не налезает на телефон */
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage .mobile-preview-badge {
    width: 40px !important; height: 40px !important; padding: 0 !important; justify-content: center !important;
  }
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage .mobile-preview-badge b { display: none !important; }
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage .mobile-preview-badge svg { width: 18px !important; height: 18px !important; }
  /* мягкое затухание под нижним меню — карточки не «торчат» из-под него */
  body.uip-has-bnav:not(.uip-editor-open):not(.uip-overlay-open):not(.uip-drawer-open)::after {
    content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: calc(96px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(250, 249, 255, 0), rgba(250, 249, 255, .94) 45%);
    pointer-events: none; z-index: 44;
  }
  /* адрес ссылки не обрезается слишком рано */
  #root .app .main .slug { max-width: min(64%, 240px) !important; }
}

/* ---------- 9. Обложка как фон сверху (как на главной), а не пустой блок ---------- */
html body #editorModal .mini-screen > .mini-cover {
  position: absolute !important;
  left: 0 !important; right: 0 !important; top: 0 !important;
  height: 150px !important; margin: 0 !important;
  border: 0 !important; border-radius: 0 !important;
  z-index: 0 !important;
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
}
html body #editorModal .mini-screen > .mini-avatar { margin-top: 44px !important; }

/* ---------- 10. Шапка таблицы ссылок: без старых бежевых плашек ---------- */
html body #root .thead, html body #root thead, html body #root thead tr { background: #fafaff !important; }
html body #root .thead > *, html body #root thead th { background: transparent !important; box-shadow: none !important; border: 0 !important; }

/* CTA: белый текст, как у остальных кнопок */
html body #editorModal .mini-cta { color: #fff !important; text-shadow: 0 1px 2px rgba(20,10,60,.25); }

/* ---------- 11. Превью на телефоне: телефон целиком, строго по центру ---------- */
@media (max-width: 768px) {
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage {
    height: clamp(420px, 58svh, 560px) !important;
    overflow: hidden !important;
  }
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage .phone-scale-shell {
    display: flex !important; justify-content: center !important; align-items: flex-start !important;
    width: 100% !important; overflow: hidden !important;
  }
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage .epreview {
    display: flex !important; justify-content: center !important; width: 100% !important; margin: 0 !important;
  }
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage .mini-phone {
    flex: none !important; margin: 10px auto 0 !important;
    transform-origin: 50% 0 !important;
  }
}

/* ---------- 12. На телефоне старые стили сжимали телефон до 210×380 — экран обрезался.
   Теперь телефон всегда целый 300×620, а под место его вписывает масштаб. ---------- */
@media (max-width: 768px) {
  html body #editorModal#editorModal .builder-stage .mini-phone.mini-phone {
    width: 300px !important; height: 620px !important;
    border-radius: 48px !important;
  }
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage .mini-phone.mini-phone {
    transform: scale(var(--uip-phone-scale, .66)) !important;
  }
  html body #editorModal#editorModal.mobile-fullscreen-preview .builder-stage .mini-phone.mini-phone {
    transform: scale(var(--uip-fs-scale, 1)) !important;
    margin: var(--uip-fs-offset, 0px) auto 0 !important;
  }
}
