/* =================== Конструктор создан Kolobdur при использовании СhatGpt / The constructor was created by Kolobdur using ChatGPT =================== */

/* =================== Стиль конструктора =================== */

/* =========================================================
1.1 БАЗОВЫЕ СТИЛИ. В ПОСТАХ
========================================================= */

/* ===== Скрываем посты до парсинга ===== */
.post-content  {
  opacity: 0;
  transition: opacity 0.15s linear;
}

/* ===== Общие стили контейнера и блоков ===== */
.site-container>div[class*=block] {
  display: flex;
  flex-wrap: nowrap;
  overflow: auto;
}

.site-container>div[class*=block]>div[class*=block], 
.site-container>div[class*=block] div[class*=cell] {
  overflow:auto;
}

/* Размеры превью изображения в постах */
.minimg {width: 160px;}
.midimg {width: 320px;}
.fullimg {width: 640px;}

/* ===== Списки в постах ===== */

/* Убираем лишний padding */
.site-container div ul, .site-container div ol {padding: 0 0 0 2.3em;}

/* Показать маркировку списка */
.site-container div li {list-style: inherit;}
.site-container div ul li {list-style: square;}

/* Убрать маркировку списка в именах вкладок */
.site-container .bb-tabs .bb-tabs-nav li {list-style: none;}

/* Обнуляем padding в списках в именах вкладок */
.site-container .bb-tabs .bb-tabs-nav {padding: 0;}

/* =========================================================
1.2 БАЗОВЫЕ СТИЛИ. В ПАНЕЛИ КОНСТРУКТОРА
========================================================= */

/* Чекбоксы */
.Lcheckbox {
  display: grid;
  grid-template-columns: 20px auto;
  font-weight: 700;
  grid-row: 2/3;
}

.main-toggle {
  grid-column: 2 / 3;
}

.main-toggle-tabs {
  grid-column: 3 / 4;
}

.Lcheckbox input {
  margin-right: 4px;
}

/* Курсор для кликабельных элементов */
#button-site,
.remove-block,
.remove-cell,
.remove-image-btn,
#site-area-child button,
.custom-bb-img-file,
#site-area-child input[type="checkbox"] {
  cursor: pointer;
}

/* =========================================================
   2. КНОПКА ВЫЗОВА ПАНЕЛИ НА ОСНОВЕ MATERIAL ICONS
========================================================= */

/* Подключение шрифта Material Icons */
@font-face {
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  src: url(https://fonts.gstatic.com/s/materialicons/v143/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
}

#button-site {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 24px;
}

#button-site .material-icons {
  position: absolute;
  display: inline-block;
  z-index: 1;
  left: 0;
  padding: 3px;
  color: #50594e;
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 18px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

#button-site:hover .material-icons {
  color: #68645a;
}

/* =========================================================
   3. ПАНЕЛЬ КОНСТРУКТОРА
========================================================= */

/* Панель скрыта по умолчанию */
#site-area,
#site-loading {
  display: none;
}

/* Контейнер панели */
#site-area {
  position: absolute;
  top: 43px;
  right: 6px;
  z-index: 2;
  font-family: tahoma, verdana, arial, helvetica, sans-serif;
  text-shadow: none;
}

#site-area-child {
  display: grid;
  grid-template-columns: auto auto auto;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: rgb(250,251,252);
  color: #333;
}

/* Сетка панели */
.site-token {
  grid-column: 1/2;
  margin-bottom: 8px;
}
.site-button, 
#constructor-area {
  grid-column: 1/-1;
  margin-bottom: 8px;
}
#current-template-name {
  grid-column: 3/4;
  justify-self: end;
  margin-top: -6px;
  font-style: italic;
  font-weight: bold;
}
.site-button {
  display: grid;
  grid-template-columns: repeat(6,auto);
}
.site-button button {
  margin:5px;
}
#faq-template-btn {
  grid-column:-2/-1;
  grid-row:1/2;
}
#load-template-btn,#add-bottom-block {
  margin-right:20px;
}

/* =========================================================
   4. КНОПКИ
========================================================= */

/* Кнопки панели */
#site-area-child button, .custom-bb-img-file {
  background: #f0f0f0;
  font-weight: bold;
  font-size: 12px;
  padding: 4px 12px;
  border: 1px solid #888;
  border-radius: 3px;
  box-shadow: 0 2px #aaa,0 2px 4px rgba(0,0,0,0.15);
  text-transform: uppercase;
  transition: all 0.15s ease;
}
#site-area-child button:hover, .custom-bb-img-file:hover {
  box-shadow: 0 1px #888,0 1px 2px rgba(0,0,0,0.15);
  transform: translateY(1px);
}
#site-area-child button:active, .custom-bb-img-file:active {
  box-shadow: 0 0 #666,0 0 1px rgba(0,0,0,0.1);
  transform: translateY(2px);
}

/* Цвета кнопок */
#site-area button  {
  color: #111;
}
#site-area #add-column,
#site-area #add-top-block,
#site-area #add-bottom-block {
  color: blue;
}
#site-area #generate-bbcode {
  color: maroon;
}
#site-area #clear-constructor {
  color: green;
}
#site-area #save-template-btn,
#site-area #clear-template-btn,
#site-area #load-template-btn {
  color: red;
}
#site-area #export-template-btn,
#site-area #import-template-btn {
  color: fuchsia;
}

/* Кнопки удаления */
#site-area-child .remove-image-btn {
  display: block;
  position: absolute;
  top: -6px;
  right: -6px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  grid-column: 2/3;
  grid-row: 1/1;
  height: 16px;
  width: 16px;
  padding: 0;
  color: rgb(61,43,31);
  font-size: 12px;
  line-height: 100%;
  border: 0;
}

/* =========================================================
   5. БЛОКИ и ЯЧЕЙКИ
========================================================= */

.block, 
.cell,
.child1, 
.cell-header,
.bg-image-item, 
.bg-preview {
  display: grid;
}

.block, 
.cell {
  grid-template-columns: auto auto auto 1fr;
  align-items: center;
}

.block {
  border: 1px dashed #999;
  margin-bottom: 10px;
  padding: 8px;
  background: rgb(245,245,245);
}
.block-cells {
  grid-row: 7/8;
  grid-column: 1/-1;
  margin-top: 5px;
}

.cell {
  grid-row: 1/2;
  grid-column: 1/-1;
  padding: 8px;
  border: 1px dotted #aaa;
  background: rgb(250,251,252);
  margin-bottom: 8px;
}

.cell-header {
  grid-row: 1/2;
  grid-column: 1/-1;
}

.text-panel {
  grid-row: 3/4;
  grid-column: 1/-1;
  margin-top: 4px;
  text-align: center;
}

.block-bg-panel, 
.cell-bg-panel {
  margin-top: 5px;
  display: none;
}

.child1,
.cell-header {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.child1 {
  grid-row: 1/2;
  grid-column: 1/-1;
  font-size: 14px;
}

.cell-header  {
  font-size: 13px;
}

.child2 {
  grid-row: 2/3;
}

.child2, 
.Lcheckbox, 
.add-cell {
  margin: 5px;
}

.child2 {
  font-size: 12px;
  color: #222;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8), 0 2px 2px rgba(0, 0, 0, 0.25);
  transition: color 0.2s ease;
}

.block-width {
  margin-right: 5px;
}

.fields-preview {
  grid-row: 5/6;
  grid-column: 1/-1;
}

.bb-tabs-holder {
  grid-row: 6/7;
  grid-column: 1/-1;
}

.add-cell {
  grid-row: 2/3;
  grid-column: 4/5;
  width: max-content;
}

.block-bg-preview {
  margin-top: 5px;
}

.cell-bg-preview {
  margin-top: 4px;
}

.bg-image-item {
  grid-template-columns: minmax(10px,auto) 1fr auto auto;
  align-items: center;
  justify-items: center;
  padding: 10px;
  border: 1px dashed #999;
  background: #f5f5f5;
  margin: 2px 0;
  cursor: all-scroll;
}

.css-panel {
  grid-row: 2/3;
  margin: 14px;
}

.bg-preview {
  grid-template-columns: auto auto;
  align-content: start;
  justify-self: center;
  position: relative;
}

.bg-preview img {
  grid-column: 1/-1;
  grid-row: 1;
}

/* =========================================================
   6. СВОРАЧИВАНИЕ БЛОКОВ И ЯЧЕЕК
========================================================= */

.block .child1 strong, 
.cell .cell-header strong {
  color: rgba(0, 0, 0, 0.8);
  cursor: pointer;
  user-select: none;
  position: relative;
  display: inline-block;
  padding-left: 16px;
  transition: color 0.2s ease;
  text-transform: uppercase;
  font-weight: 500;
  text-shadow: 0 0px #aaa, 0 0px 4px rgba(0, 0, 0, 0.15), 0px 0px 1px rgb(245, 245, 245);
}

.block .child1 strong:hover,
.cell .cell-header strong:hover  {
  color: rgba(0, 0, 0, 0.6);
}

.block .child1 strong::before,
.cell .cell-header strong::before  {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  /* вправо */border-color: transparent transparent transparent #333;
  transition: transform 0.2s ease;
}

/* вниз, когда раскрыто */
.block:not(.collapsed) .child1 strong::before,
.cell:not(.collapsed) .cell-header strong::before  {
  border-width: 8px 5px 0 5px;
  border-color: #333 transparent transparent transparent; /* вниз */
}

/* =========================================================
   7. ПОЛЯ И TEXTAREA
========================================================= */


#site-area #site-area-child input[type=text],
#site-area  .text-panel textarea {
  background: rgb(255, 255, 255);
  color: rgb(0, 0, 0);
  font: 1em verdana, arial, helvetica, sans-serif;
  text-shadow: none;
  box-shadow: none;
  border: 1px solid light-dark(rgb(118, 118, 118), rgb(133, 133, 133));
  padding: 2px !important;
}

#site-area  .text-panel .block-text {
  margin: 0;
}

.row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.row input {
  display: block;
  width: 99%;
  margin-bottom: 3px;
}

.bg-image-index {
  justify-self: start;
  font-weight: 600;
}

.block-bg-url,
.cell-bg-url {
  width: 98%;
}

#site-area .block-bg-file,
#site-area .cell-bg-file {
  width: 106px;
  font-size: 12px !important;
  border: none;
  background: none;
  text-shadow: none;
}

.css-panel i {
  display: block;
  padding-right: 10px;
}

.add-block-bg-image,
.block-bg-list {
  margin-bottom: 10px;
}

.section-body {
  display: none;
  margin: 14px;
}

.text-panel textarea, .tab-text {min-height: 36px;}

/* =========================================================
   8. МОДАЛЬНЫЕ ОКНА
========================================================= */

.modal-overlay,
.faq-modal-overlay,
#html-result-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background: rgba(0,0,0,0.6);
}

.modal,
.faq-modal {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  max-width: 90%;
  overflow-y: auto;
}

.modal {
  min-width: 300px;
  max-height: 80vh;
}

.faq-modal {
  width: 700px;
  position: relative;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transform: translateY(-30px);
  opacity: 0;
  transition: all 0.3s ease;
}

.faq-modal.show {
  transform: translateY(0);
  opacity: 1;
}

.modal h3, #html-result-modal h3 {
  margin-top: 0;
}

.modal-actions {
  margin-top: 20px;
  text-align: right;
}

.modal-actions button {
  padding: 6px 12px;
}

.modal-checkboxes label {
  display: grid;
  grid-template-columns: 30px auto;
  padding: 5px 0;
  border: 1px solid #ccc;
  border-width: 1px 1px 0 1px;
}

.modal-checkboxes label:last-child {
  border-width: 1px;
}

.modal-actions button,
#html-result-modal button {
  cursor: pointer;
}

/* =========================================================
   9. FAQ
========================================================= */

.faq-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  z-index: 2;
}

.faq-tabs {
  display: flex;
  border-bottom: 2px solid #eee;
  position: relative;
  margin-bottom: 15px;
  z-index: 1;
}

.faq-tabs button {
  position: relative;
  z-index: 1;
  background: none;
  border: none;
  padding: 10px 15px;
  cursor: pointer;
  font-weight: bold;
  color: #555;
  transition: color .2s;
}

.faq-tabs button:hover,
.faq-tabs button.active {
  color: #000;
}

.faq-active-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: #007bff;
  transition: all .3s ease;
}

.faq-tab-content {
  display: none;
  padding: 10px 0;
  max-height: 400px;
  overflow-y: auto;
  opacity: 0;
  transition: opacity .3s;
}

.faq-tab-content.active {
  display: block;
  opacity: 1;
}

/* =========================================================
   10. КОПИРОВАТЬ / ВСТАВИТЬ / DRAG&DROP / COPY-PASTE
========================================================= */

.modal-overlay  {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal  {
  background: #fff;
  border-radius: 8px;
  padding: 15px;
  max-height: 90%;
  overflow-y: auto;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.modal-animated  {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn  {
  from {
    opacity: 0;
    transform: scale(.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.drag-source li, 
.drag-target li  {
  padding: 4px;
  margin: 2px;
  cursor: grab;
  border-radius: 4px;
}

.drag-source li[data-type="cell"], 
.drag-target li[data-type="cell"]  {
  border-left: 20px solid transparent;
}

.drag-mappings li  {
  padding: 3px;
  margin: 2px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 13px;
}

.modal-actions button  {
  margin-left: 5px;
}

/* =========================================================
   11. Генерация HTML
========================================================= */

/* Кнопки в панели */
#generate-wrapper {
  position: relative;
  display: inline-flex
}
#generate-wrapper #generate-options {
  display: none;
  position: absolute;
  top: -30px;
  width: 400px;
  margin-left: -50%;
}
#generate-wrapper #generate-main-btn {
  width: 95%;
}

/* Модальное окно */
#html-result-modal {   
  width: 80%;
  height: 70%;
  padding: 20px;
  z-index: 9999;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

#generated-html {
  width: 100%;
  height: 75%;
  margin: 10px 0;
  font-family: monospace;
  font-size: 13px;
}

#html-result-modal div {
  margin-top: 10px;
  text-align: right;
}

#html-result-modal .modal-buttons {
  text-align: right;
}
#html-result-modal button {
  margin-left: 8px;
}

/* =========================================================
   12. Панель бб-кода
========================================================= */

.text-panel textarea {min-height:36px;}
.bb-panel{display:flex;align-items:center;gap:4px;margin-bottom:4px;}
.bb-panel button{border:1px solid #ccc;background:#f9f9f9;cursor:pointer;padding:2px 6px;border-radius:4px;}
.bb-panel button:hover{background:#e0e0e0;}
.bb-panel .material-icons{font-size:18px;vertical-align:middle;}



/* — BB-панель над полем во вкладках — */
.bb-field-line {
  display: grid;
  grid-template-columns: auto 1fr;
}

.tabs-panel .tab-text-item,
.tabs-panel .tab-name-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
}

.bb-mini-toggle {grid-column: 1/2;grid-row: 2;}
.bb-panel {grid-column: 2/-1;grid-row: 1;}
.bb-field-line textarea, .tab-name, .tab-text {grid-column: 2/3;grid-row: 2;}
.tab-remove {grid-column: 3/4;grid-row: 2;}

/* Сверхкомпактная мини-кнопка "BB" слева от поля */
#site-area-child .bb-mini-toggle{
  width: 22px; 
  height: 22px;
  padding: 0;
  margin-top: 2px;
  border: 1px solid #cfcfcf;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  font: 600 10px/20px system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  text-align: center;
  color: #333;
}
#site-area-child .bb-mini-toggle:hover{ background:#f3f3f3; }
#site-area-child .bb-mini-toggle[aria-expanded="true"]{
  border-color: #2b76d2; 
  color: #2b76d2;
  background: #eef5ff;
}

/* Полная BB-панель — по умолчанию ПОЛНОСТЬЮ скрыта (нет бордюра, нет места) */
.bb-panel{ display:none; }               /* <- ключевой момент */
.bb-panel.is-open{                        /* показываем только когда открыта */
  display:block;
  margin-bottom: 4px;
}

/* Контент панели */
.bb-panel-body{ display:flex; align-items:center; gap:4px; flex-wrap:wrap; }
.bb-panel-body .bb-panel button,
.bb-panel-body .bb-color-wrapper>button,
.bb-panel-body .bb-img-wrapper>button{ padding:2px 6px; }

/* Размещение над полем: панель занимает всю ширину строки */
.bb-field-line .bb-panel,
.tabs-panel .tab-text-item .bb-panel,
.tabs-panel .tab-name-item .bb-panel{ order:-1; flex:0 0 100%; }

.tab-text-item .tab-text, .tab-name, .tab-remove {margin-bottom: 6px;}
.tabs-panel .tab-text-item .tab-remove,
.tabs-panel .tab-name-item .tab-remove{ align-self:center; height:28px; }

.tabs-panel .tab-name{
  width:100%;
  overflow-y: auto;     /* нужно для ресайза */
  min-height: 24px;
}

/* Выпадашка шрифтов и размеров (как палитра) */
.bb-font-wrapper, 
.bb-size-wrapper,
.bb-list-wrapper,
.bb-color-wrapper,
.bb-img-wrapper {
  position:relative;
  display: grid;
  justify-items: center;
}

.bb-fonts, 
.bb-sizes,
.bb-lists,
.bb-colors {
  display: none;
  position: absolute;
  bottom: 28px;
  border-radius: 6px;
  padding: 6px 0;
  z-index: 100;
  width: 260px;
  height: auto;
  max-height: 220px;
  margin-left: -50%;
  overflow: auto;
}

.bb-fonts,
.bb-colors {
  margin-right: -16px;
} 

.bb-fonts button, 
.bb-sizes button,
.bb-lists button,
.bb-colors button {
  display:block;
  width:100%;
  text-align:left;
  padding:6px 8px;
  margin:0;
  border:1px solid transparent;
  border-radius:4px;
  background:#fff;
  cursor:pointer;
  font-size:13px;
  line-height:1.2;
}
.bb-fonts button:hover,
.bb-sizes button:hover,
.bb-lists button:hover,
.bb-colors button:hover {
  background:#f3f5f7;
  border-color:#dfe3e7;
}

/* Кнопка открытия списка шрифтов */
.bb-font-wrapper > button,
.bb-size-wrapper > button,
.bb-list-wrapper > button,
.bb-color-wrapper > button {
  border:1px solid #ccc;
  background:#fff;
  border-radius:4px;
  padding:2px 6px;
  cursor:pointer;
}
.bb-font-wrapper > button:hover,
.bb-size-wrapper > button:hover,
.bb-list-wrapper > button:hover,
.bb-color-wrapper > button {
  background:#f0f0f0;
}

.bb-colors button {
  width: 100%;
  height: 24px;
}

.bb-img-box{
  display: none;
  position: absolute;
  bottom: 34px;
  margin-left: -50%;
  background: #f0f0f0;
  border: 1px solid #888;
  padding: 6px;
  border-radius: 6px;
  z-index: 100;
  width: 520px;
  grid-template-columns: 1fr auto;
  box-shadow: 0 2px #aaa, 0 2px 4px rgba(0, 0, 0, 0.15);
}

#bb-img-file {display: none;}

#constructor-area .bb-img-box textarea {
  width: auto;
  margin-right: 2px;
  margin-bottom: 4px;
  grid-column: 1 / 2;
  grid-row: 1 / 2;
}

.bb-img-box .custom-bb-img-file {
  display: block;
  width: 94px;
  height: 38px;
  grid-column: 2 / 3;
  grid-row: 1 / 2;
  display: grid;
  align-items: center;
}

.bb-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bb-preview-item {
  position: relative;
  display: inline-block;
}

.bb-preview-item img {
  max-width: 70px;
  max-height: 70px;
  cursor: pointer;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.bb-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
  grid-row: 3 / 4;
  grid-column: 1 / -1;
}

.bb-controls select {
  flex: 1;
  height: 23px;
}

.bb-controls button {
  margin-left: 2px;
  width: 120px;
}

#site-area-child .bb-lists button {
  text-transform: none;
}

#site-area-child .bb-lists button:nth-child(1) {
  text-transform: uppercase;
}




