/* 
 * Дизайн-система завода сухих строительных смесей ТОО FILIN I CO (FILIN & SOVAMIX)
 * Архитектурный бетон, графитовый металл, кобальтовый акцент и реалистичная 3D-упаковка крафт-мешков
 */

:root {
  --bg-dark: #0B1120;
  --bg-graphite: #0F172A;
  --bg-concrete: #F4F6F8;
  --bg-white: #FFFFFF;
  --accent-cobalt: #2563EB;
  --accent-sky: #608CFF;
  --accent-sheber: #15803D;
  --border-tech: #E2E8F0;
  --text-main: #0F172A;
  --text-muted: #475569;
}

* {
  box-sizing: border-box;
}

html, body {
  scroll-behavior: smooth;
  font-family: 'Noto Sans', 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-concrete);
  overflow-x: hidden;
  max-width: 100vw;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, .font-heading {
  font-family: 'Montserrat', 'Noto Sans', 'Segoe UI', sans-serif;
  letter-spacing: -0.015em;
}

.font-mono-tech {
  font-family: 'Roboto Mono', 'Noto Sans', Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

/* Архитектурная миллиметровая сетка на темном фоне */
.bg-arch-grid {
  background-color: #0B1120;
  background-image: 
    linear-gradient(to right, rgba(148, 163, 184, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.07) 1px, transparent 1px);
  background-size: 40px 40px;
}

.bg-arch-grid-light {
  background-color: #F4F6F8;
  background-image: 
    linear-gradient(to right, rgba(15, 23, 42, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ==========================================================================
   3D-ВИЗУАЛИЗАЦИЯ КРАФТ-МЕШКОВ (ФОРМА МЕШКА ALINEX / СТАРАТЕЛИ 1-В-1 ИЗ PDF)
   ========================================================================== */
.bag-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  perspective: 950px;
  transform-style: preserve-3d;
}

.bag-3d {
  position: relative;
  width: 210px;
  height: 312px;
  transform-style: preserve-3d;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), filter 0.38s ease;
  will-change: transform;
  filter: drop-shadow(0 18px 22px rgba(15, 23, 42, 0.22));
}

.product-card:hover .bag-3d,
.bag-stage:hover .bag-3d {
  transform: translateY(-7px) scale(1.035);
  filter: drop-shadow(0 24px 28px rgba(15, 23, 42, 0.28));
}

/* Контейнер прозрачного 3D-рендера мешка */
.bag-3d-front {
  position: relative;
  width: 100%;
  height: 100%;
  background: transparent;
}

.bag-3d-front img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.bag-3d-spine {
  display: none;
}

/* Тень под мешком на подиуме */
.bag-shadow {
  position: absolute;
  bottom: -6px;
  width: 165px;
  height: 18px;
  background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.28) 0%, rgba(15, 23, 42, 0) 72%);
  pointer-events: none;
  transition: transform 0.38s ease, opacity 0.38s ease;
}

.product-card:hover .bag-shadow {
  transform: scale(0.92);
  opacity: 0.7;
}

/* Крупные мешки для Hero-сцены (динамическая подстройка под диагональ экрана) */
.bag-3d-hero {
  width: clamp(130px, 24vw, 228px);
  height: clamp(194px, 35.8vw, 340px);
}

/* Динамическое масштабирование карточных 3D-мешков на любых диагоналях */
@media (max-width: 480px) {
  .bag-3d {
    width: clamp(140px, 42vw, 195px);
    height: clamp(208px, 62vw, 290px);
  }
}

/* Ультракомпактные смартфоны (до 360px - iPhone SE, Galaxy Fold внешний экран):
   компактная кнопка WhatsApp и гарантированное место под 3 полоски меню */
@media (max-width: 359px) {
  .wa-btn-text {
    display: none;
  }
  #header-whatsapp-btn {
    padding: 0.45rem 0.55rem;
  }
}

/* Более широкий и просторный контейнер для ПК и широких мониторов */
@media (min-width: 1400px) {
  .max-w-7xl {
    max-width: 1480px !important;
  }
}

/* Ноутбуки и ПК (1280px - 1560px): динамическая подстройка отступов и кегля навигации,
   чтобы название компании и все пункты RU/KZ меню помещались полностью без обрезки */
@media (min-width: 1280px) and (max-width: 1560px) {
  header nav .nav-page-link {
    padding-left: clamp(0.32rem, 0.55vw, 0.6rem);
    padding-right: clamp(0.32rem, 0.55vw, 0.6rem);
    font-size: clamp(10.5px, 0.8vw, 12.5px);
  }
}

/* Карточки товаров */
.product-card {
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.product-card:hover {
  border-color: #94A3B8;
  box-shadow: 0 16px 32px -12px rgba(15, 23, 42, 0.1);
}

/* Стилизация ползунков калькулятора */
input[type="range"] {
  accent-color: var(--accent-cobalt);
}

/* Скроллбар */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #0F172A;
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* ==========================================================================
   МНОГОСТРАНИЧНЫЙ РЕЖИМ, СКРЫТЫЙ ДОСТУП И СТУДИЙНЫЙ КОНСТРУКТОР (TILDA / CANVA)
   ========================================================================== */
.page-section-hidden {
  display: none !important;
}

/* Все элементы с классом .admin-only-ui полностью скрыты от обычных покупателей */
.admin-only-ui {
  display: none !important;
}

body.admin-session-active .admin-only-ui {
  display: inline-flex !important;
}

#desktop-nav-pill {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 0.5rem;
  background: rgba(37, 99, 235, 0.28);
  border: 1px solid rgba(96, 140, 255, 0.55);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.22);
  pointer-events: none;
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.34s cubic-bezier(0.22, 1, 0.36, 1),
              height 0.34s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.2s ease;
  opacity: 0;
  z-index: 1;
}

.nav-page-link {
  transition: color 0.25s ease, transform 0.18s ease;
}

.nav-page-link.active-page {
  color: #ffffff !important;
  background-color: transparent;
  border-color: transparent;
}

/* Подсветка редактируемых элементов в режиме Конструктора Tilda / Canva */
body.builder-mode-active [contenteditable="true"] {
  outline: 1.5px dashed #3B82F6;
  outline-offset: 3px;
  border-radius: 4px;
  transition: outline-color 0.15s ease, background-color 0.15s ease;
  cursor: text;
}

body.builder-mode-active [contenteditable="true"]:hover,
body.builder-mode-active [contenteditable="true"]:focus {
  outline: 2px solid #2563EB;
  background-color: rgba(37, 99, 235, 0.10);
}

/* Выбранный элемент на холсте (Canva Selection Box) */
body.builder-mode-active .studio-selected-element {
  outline: 2.5px solid #F59E0B !important;
  outline-offset: 4px !important;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2) !important;
}

body.builder-mode-active .studio-selected-section {
  box-shadow: inset 0 0 0 3px #3B82F6 !important;
}

/* Панель управления секцией в режиме Конструктора */
.builder-section-bar {
  display: none;
}

body.builder-mode-active .builder-section-bar {
  display: flex;
}

/* Боковые панели конструктора Tilda / Canva */
#studio-left-drawer,
#studio-right-inspector {
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

body.builder-mode-active #site-pages-container {
  transition: max-width 0.3s ease, margin 0.3s ease;
}

body.studio-viewport-tablet #site-pages-container {
  max-width: 768px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-shadow: 0 0 0 1px #334155, 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

body.studio-viewport-mobile #site-pages-container {
  max-width: 390px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-shadow: 0 0 0 1px #334155, 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   ПЛАВНЫЕ АНИМИРОВАННЫЕ ПЕРЕХОДЫ СТРАНИЦ И МИНИ-ПОДОКОН (МОДАЛОК)
   ========================================================================== */
@keyframes filinPageEnter {
  0% {
    opacity: 0;
    transform: translate3d(0, 12px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes filinModalIn {
  0% {
    opacity: 0;
    transform: translate3d(0, 10px, 0) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.page-enter-active {
  animation: filinPageEnter 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.filin-modal-overlay {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.filin-modal-card {
  animation: filinModalIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

html.modal-open,
body.modal-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}

/* Угловые маркеры для растягивания и увеличения 3D-мешка в FILIN STUDIO (как в Canva) */
.studio-bag-handles {
  position: absolute;
  inset: -6px;
  border: 2px solid #F59E0B;
  border-radius: 10px;
  pointer-events: none;
  z-index: 30;
}

.studio-bag-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #F59E0B;
  border: 2px solid #0F172A;
  border-radius: 50%;
  pointer-events: auto;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease;
}

.studio-bag-handle:hover {
  transform: scale(1.25);
}

.studio-bag-handle.tl { top: -7px; left: -7px; cursor: nwse-resize; }
.studio-bag-handle.tr { top: -7px; right: -7px; cursor: nesw-resize; }
.studio-bag-handle.bl { bottom: -7px; left: -7px; cursor: nesw-resize; }
.studio-bag-handle.br { bottom: -7px; right: -7px; cursor: nwse-resize; }

@media (prefers-reduced-motion: reduce) {
  .page-enter-active,
  .filin-modal-card {
    animation: none !important;
  }
}

/* Стили для печати сметы / КП */
@media print {
  body * {
    visibility: hidden;
  }
  #printable-estimate, #printable-estimate * {
    visibility: visible;
  }
  #printable-estimate {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    border: 1px solid #000 !important;
  }
  .no-print {
    display: none !important;
  }
}
