/* ── LAYERS PANEL ── */
.edit-layers-panel {
  position: fixed;
  top: 52px; left: 0; bottom: 0;
  width: 280px;
  background: #1a1a1a;
  color: #f4f4f0;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 4px 0 24px rgba(0,0,0,0.35);
  font-family: 'Inter', sans-serif;
}
.edit-layers-panel.open { transform: translateX(0); }

body.layers-open .nav,
body.layers-open .edit-toolbar { left: 280px; }
body.layers-open { padding-left: 280px; }

.edit-layers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: #FF6200;
  flex-shrink: 0;
}
.edit-layers-header button {
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.5);
  width: 26px; height: 26px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: 0.15s;
}
.edit-layers-header button:hover { background: rgba(255,255,255,0.15); color: #fff; }

.edit-layers-search {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.edit-layers-search input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 7px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  color: #f4f4f0;
}
.edit-layers-search input::placeholder { color: rgba(255,255,255,0.25); }
.edit-layers-search input:focus { outline: none; border-color: #FF6200; }

.edit-layers-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.edit-layers-body::-webkit-scrollbar { width: 4px; }
.edit-layers-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

.edit-layer-group { margin-bottom: 4px; }
.edit-layer-group-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 10px 14px 4px;
}
.edit-layer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 0;
}
.edit-layer-item:hover { background: rgba(255,255,255,0.06); }
.edit-layer-item:hover .layer-edit-btn { opacity: 1; }

.layer-icon {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: rgba(255,98,0,0.18);
  color: #FF6200;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Montserrat', sans-serif;
  font-weight: 900;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.layer-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.layer-key {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layer-preview {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layer-edit-btn {
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.5);
  width: 24px; height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  opacity: 0;
  transition: 0.15s;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.layer-edit-btn:hover { background: #FF6200; color: #fff; opacity: 1; }

.edit-layer-img-item .layer-icon { display: none; }
.layer-img-thumb {
  width: 36px; height: 36px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.1);
}

/* Highlight element on page when hovered in layers */
.layer-highlight {
  outline: 2px solid #FF6200 !important;
  outline-offset: 3px !important;
}

/* Delete / hide button */
.layer-del-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.25);
  width: 24px; height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  opacity: 0;
  transition: 0.15s;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.edit-layer-item:hover .layer-del-btn { opacity: 1; }
.layer-del-btn:hover { background: rgba(220,38,38,0.25); color: #f87171; opacity: 1; }

/* Hidden items */
.layer-item--hidden { opacity: 0.45; }
.layer-item--hidden .layer-del-btn { opacity: 1; color: rgba(255,255,255,0.4); }
.layer-item--hidden .layer-del-btn:hover { background: rgba(34,197,94,0.2); color: #86efac; }

/* Custom block icon tint */
.layer-icon--custom { background: rgba(124,58,237,0.2); color: #a78bfa; }

/* Add text button per section */
.layer-add-btn {
  display: block;
  width: calc(100% - 28px);
  margin: 4px 14px 8px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px dashed rgba(255,255,255,0.15);
  border-radius: 8px;
  color: rgba(255,255,255,0.4);
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  cursor: pointer;
  text-align: left;
  transition: 0.15s;
}
.layer-add-btn:hover { border-color: #FF6200; color: #FF6200; background: rgba(255,98,0,0.07); }

/* Custom text block on the page in edit mode */
.edit-mode .custom-text-block {
  outline: 2px dashed rgba(167,139,250,0.5);
  outline-offset: 3px;
  border-radius: 4px;
  min-height: 1em;
  cursor: pointer;
}
.edit-mode .custom-text-block:empty::before {
  content: 'Шинэ текст блок — засахын тулд дарна уу';
  opacity: 0.35;
  font-style: italic;
  pointer-events: none;
}

/* Layers toggle button in toolbar */
.edit-layers-toggle {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
  padding: 6px 14px;
  border-radius: 8px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: 0.2s;
}
.edit-layers-toggle:hover,
.edit-layers-toggle.active { background: #FF6200; color: #fff; border-color: #FF6200; }

/* ── EDIT TOOLBAR ── */
.edit-toolbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  background: #1a1a1a;
  color: #fff;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 16px rgba(0,0,0,0.4);
  font-family: 'Montserrat', sans-serif;
}
.edit-toolbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}
.edit-toolbar-logo {
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: #FF6200;
  flex: 1;
}
.edit-toolbar-hint {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.04em;
}
.edit-toolbar-lang {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.1);
  border-radius: 100px;
  padding: 3px;
}
.edit-toolbar-lang button {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: rgba(255,255,255,0.5);
  transition: 0.2s;
}
.edit-toolbar-lang button.active {
  background: #FF6200;
  color: #fff;
}
.edit-save-btn {
  background: #FF6200;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 100px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: 0.2s;
}
.edit-save-btn:hover { opacity: 0.85; }
.edit-save-btn:disabled { opacity: 0.5; cursor: default; }
.edit-exit-btn {
  background: transparent;
  color: rgba(255,255,255,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 7px 16px;
  border-radius: 100px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  cursor: pointer;
  transition: 0.2s;
}
.edit-exit-btn:hover { color: #fff; border-color: rgba(255,255,255,0.4); }

/* Offset nav when toolbar shown */
body.edit-mode .nav { top: 52px; }
body.edit-mode { padding-top: 52px; }

/* ── EDITABLE TEXT HOVER ── */
body.edit-mode [data-i18n] {
  cursor: pointer;
  position: relative;
  transition: outline 0.15s;
  border-radius: 4px;
}
body.edit-mode [data-i18n]:hover {
  outline: 2px dashed #FF6200;
  outline-offset: 4px;
}
body.edit-mode [data-i18n]:hover::after {
  content: '✎';
  position: absolute;
  top: -10px; right: -10px;
  background: #FF6200;
  color: #fff;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

/* ── IMAGE EDIT BUTTON ── */
.edit-img-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  border: 2px solid #fff;
  padding: 10px 20px;
  border-radius: 100px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 5;
  white-space: nowrap;
}
.edit-img-wrap:hover .edit-img-btn { opacity: 1; }
.edit-img-wrap { position: relative; overflow: hidden; }

/* ── EDIT MODAL ── */
.edit-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.edit-modal {
  background: #fff;
  border-radius: 20px;
  width: 540px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 64px rgba(0,0,0,0.25);
}
.edit-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 16px;
  border-bottom: 1px solid #e0e0dc;
}
.edit-modal-header h3 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 1rem;
}
.edit-modal-header button {
  background: #f5f5f3;
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.edit-modal-body {
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.edit-modal-key {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #999;
}
.edit-modal-lang-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}
.edit-lang-tab {
  padding: 6px 16px;
  border-radius: 100px;
  border: 1.5px solid #e0e0dc;
  background: #fff;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
  color: #6b6b6b;
}
.edit-lang-tab.active { background: #0d0d0d; color: #fff; border-color: #0d0d0d; }
.edit-textarea {
  width: 100%;
  min-height: 100px;
  border: 1.5px solid #e0e0dc;
  border-radius: 10px;
  padding: 12px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  resize: vertical;
  color: #0d0d0d;
  line-height: 1.6;
}
.edit-textarea:focus { outline: none; border-color: #FF6200; }
.edit-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 28px 24px;
  border-top: 1px solid #e0e0dc;
}
.edit-modal-footer button {
  padding: 10px 24px;
  border-radius: 100px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  border: none;
  transition: 0.2s;
}
.edit-modal-save { background: #FF6200; color: #fff; }
.edit-modal-save:hover { opacity: 0.85; }
.edit-modal-cancel { background: #f5f5f3; color: #0d0d0d; }
.edit-modal-cancel:hover { background: #e0e0dc; }
.edit-html-note {
  font-size: 0.72rem;
  color: #aaa;
  font-family: 'Inter', sans-serif;
}
.edit-html-note code {
  background: #f5f5f3;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.7rem;
}

/* Color picker */
.edit-color-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid #e0e0dc;
  margin-top: 4px;
}
.edit-color-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b6b6b;
}
.edit-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.edit-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.edit-swatch:hover { transform: scale(1.15); }
.edit-swatch.swatch-active {
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px #FF6200;
  transform: scale(1.1);
}
.edit-swatch-custom {
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  position: relative;
}
.edit-swatch-custom input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.edit-color-preview {
  display: flex;
  align-items: center;
  gap: 8px;
}
#editColorDot {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.12);
  flex-shrink: 0;
}
#editColorVal {
  font-family: 'Inter', monospace;
  font-size: 0.8rem;
  color: #6b6b6b;
}

/* Image modal */
.edit-img-preview {
  width: 100%;
  height: 160px;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f5f3;
  border: 1.5px solid #e0e0dc;
}
.edit-img-preview img { width: 100%; height: 100%; object-fit: cover; }
.edit-file-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed #e0e0dc;
  border-radius: 10px;
  padding: 12px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #6b6b6b;
  cursor: pointer;
  transition: 0.2s;
}
.edit-file-label:hover { border-color: #FF6200; color: #FF6200; }
.edit-file-label input { display: none; }
.edit-url-input {
  width: 100%;
  border: 1.5px solid #e0e0dc;
  border-radius: 10px;
  padding: 10px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  color: #0d0d0d;
}
.edit-url-input:focus { outline: none; border-color: #FF6200; }
.edit-or-divider {
  text-align: center;
  color: #bbb;
  font-size: 0.8rem;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
}

/* ── RICH TEXT EDITOR ── */
.edit-modal-rte {
  width: 620px;
}

.rte-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 16px;
  background: #f7f7f5;
  border-top: 1px solid #e0e0dc;
  border-bottom: 1px solid #e0e0dc;
}

.rte-toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.rte-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 5px 8px;
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  color: #333;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s;
  min-width: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rte-btn:hover { background: #e8e8e4; border-color: #d0d0cc; }
.rte-btn:active { background: #ddd; }

.rte-sep {
  width: 1px;
  height: 22px;
  background: #d8d8d4;
  margin: 0 4px;
  flex-shrink: 0;
}

.rte-font-select {
  border: 1px solid #d0d0cc;
  border-radius: 6px;
  padding: 5px 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  background: #fff;
  color: #333;
  cursor: pointer;
  outline: none;
}
.rte-font-select:focus { border-color: #FF6200; }

.rte-size-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
}
.rte-size-input {
  width: 46px;
  border: 1px solid #d0d0cc;
  border-radius: 6px;
  padding: 4px 6px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  text-align: center;
  color: #333;
  background: #fff;
  outline: none;
  -moz-appearance: textfield;
}
.rte-size-input::-webkit-outer-spin-button,
.rte-size-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.rte-size-input:focus { border-color: #FF6200; }
.rte-size-btn { font-size: 0.72rem; font-weight: 700; padding: 5px 7px; }

.rte-colors-group {
  flex-wrap: wrap;
  gap: 4px;
}

.rte-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.12);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: transform 0.12s, box-shadow 0.12s;
}
.rte-color-swatch:hover { transform: scale(1.2); box-shadow: 0 2px 6px rgba(0,0,0,0.2); }

.rte-color-custom {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid rgba(0,0,0,0.12);
  transition: transform 0.12s;
}
.rte-color-custom:hover { transform: scale(1.2); }

.rte-color-rainbow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
}

.rte-color-picker {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.rte-editor {
  min-height: 120px;
  max-height: 280px;
  overflow-y: auto;
  padding: 14px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #0d0d0d;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}
.rte-editor:focus { background: #fdfdfb; }
.rte-editor::-webkit-scrollbar { width: 4px; }
.rte-editor::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* ── SAVED TOAST ── */
.edit-toast {
  position: fixed;
  bottom: 32px; right: 32px;
  background: #0d0d0d;
  color: #fff;
  padding: 12px 22px;
  border-radius: 100px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 99999;
  border-left: 4px solid #FF6200;
  animation: editToastIn 0.3s ease, editToastOut 0.3s ease 1.7s forwards;
}
@keyframes editToastIn  { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes editToastOut { to   { opacity:0; transform:translateY(16px); } }
