/* =================== Конструктор создан Kolobdur при использовании СhatGpt / The constructor was created by Kolobdur using ChatGPT =================== */

/* =================== Стиль конструктора =================== */

/* =========================================================
1. БАЗОВЫЕ СТИЛИ
========================================================= */

/* ===== Скрываем посты до парсинга ===== */
.post-content  {
  opacity: 0;
  transition: opacity 0.15s linear;
}

/* ===== Общие стили контейнера и блоков ===== */
.site-container>div  {
  display: flex;
  flex-wrap: nowrap;
  overflow: auto;
}

.site-container>div>div {
  overflow:auto;
}

/* Чекбоксы */
.Lcheckbox {
  display: grid;
  grid-template-columns: 20px auto;
  font-weight: 700;
  grid-row: 2/3;
}

.Lcheckbox input {
  margin-right: 4px;
}

/* Курсор для кликабельных элементов */
#button-site,
.remove-block,
.remove-cell,
.remove-image-btn,
#site-area-child button,
#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:not(.remove-image-btn) {
  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 {
  box-shadow: 0 1px #888,0 1px 2px rgba(0,0,0,0.15);
  transform: translateY(1px);
}
#site-area-child button: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;
}

/* Кнопки удаления */
.remove-image-btn {
  display: block;
  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 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;
}

.add-cell {
  grid-row: 2/3;
  grid-column: 3/4;
  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;
}

.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;
}

/* =========================================================
   8. МОДАЛЬНЫЕ ОКНА
========================================================= */

.modal-overlay,
.faq-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-overlay {
  background: rgba(0,0,0,0.5);
}

.faq-modal-overlay {
  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 {
  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;
}

/* =========================================================
   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;
}