/* BASIC EDITOR — editor minimalist (bold, italic, underline, tăiat, liste) */
/* -------------------------------------------------------------------------------*/

.basic-editor {
  display: block;
  position: relative;
  width: 100%;
  border: 1px solid var(--ICL, #ddd);
  border-radius: 4px;
  background: var(--IBG, #fafafa);
  color: var(--PCL, #222);
  box-sizing: border-box;
}

.basic-editor .be-tools {
  position: sticky;
  top: calc(var(--col-top, 136px) + 10px);   /* sub grupul sticky al adminului, cu 10px ca să pară în interiorul casetei */
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  min-height: 34px;
  padding: 4px 4px 4px 4px;
  border-bottom: 1px solid var(--ICL, #ddd);
  background: var(--IBG, #fafafa);
  box-sizing: border-box;
}

/* când bara e lipită preia capătul de sus al casetei: chenar + colțuri rotunjite */
.basic-editor .be-tools.stuck {
  border-top: 1px solid var(--ICL, #ddd);
  border-radius: 4px 4px 0 0;
}

/* mască albă deasupra barei: acoperă tot spațiul până la taburi, dar lasă vizibil chenarul de sus */
.basic-editor .be-tools.stuck::before {
  content: "";
  position: absolute;
  left: -1px;
  right: -1px;
  bottom: calc(100% + 1px);   /* pornește de deasupra chenarului de 1px */
  height: 24px;
  background: var(--PBG, #fff);
}

.basic-editor .be-tools button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--PCL, #000);
  font: normal 400 13px Roboto, Arial, sans-serif;
  line-height: 1;
  cursor: pointer;
  box-sizing: border-box;
}

.basic-editor .be-tools button:hover,
.basic-editor .be-tools button.on {
  background: var(--ABG1, #eff);
  color: var(--ACL1, #fff);
}

/* glifele stau puțin mai sus decât centrul cutiei — le coborâm 1px ca spațiul să pară egal */
.basic-editor .be-tools button i { font-size: 13px; transform: translateY(1px); }
.basic-editor .be-tools button b { font: normal 700 15px Roboto, Arial, sans-serif; transform: translateY(1px); color: inherit; }

.basic-editor .be-sep {
  display: block;
  width: 1px;
  height: 18px;
  margin: 0 5px;
  background: var(--ICL, #ddd);
}

.basic-editor .be-area {
  display: block;
  width: 100%;
  min-height: 400px;
  max-height: 520px;
  overflow-y: auto;
  padding: 14px;
  outline: 0;
  color: inherit;
  font: normal 400 13px Roboto, Arial, sans-serif;
  font-family: var(--FONT_PARA, Roboto), Arial, sans-serif;
  font-size: var(--FONT_PARA_SIZE, 13px);
  text-transform: var(--FONT_PARA_TT, none);
  line-height: 1.5;
  cursor: text;
  box-sizing: border-box;
}

.basic-editor.small .be-area { min-height: 190px; }

/* vizualizarea de cod (developer) */
.basic-editor .be-area.off { display: none; }

.basic-editor .be-code {
  display: none;
  width: 100%;
  min-height: 400px;
  max-height: 520px;
  margin: 0;
  padding: 14px;
  border: 0;
  outline: 0;
  resize: vertical;
  background: var(--IBG, #fbfbfb);
  color: var(--PCL, #333);
  font: normal 400 13px/1.55 Consolas, "Courier New", monospace;
  box-sizing: border-box;
}

.basic-editor.small .be-code { min-height: 190px; }
.basic-editor .be-code.open { display: block; }

.basic-editor .be-tools.source button:not([data-cmd="source"]) {
  opacity: .35;
  pointer-events: none;
}

/* spațierile imită frontendul (.content / .container.page hr), ca editorul să fie WYSIWYG */
.basic-editor .be-area p { margin: 12px 0 0 0; }
.basic-editor .be-area ul { margin: 0; padding-left: 18px; }
.basic-editor .be-area ol { margin: 0; padding-left: 30px; }
.basic-editor .be-area li { margin-bottom: 2px; }
.basic-editor .be-area li p { margin: 0; }
.basic-editor .be-area a { color: var(--ABG1, #f5a02c); text-decoration: underline; }


/* fereastra de link */
/* -------------------------------------------------------------------------------*/

.be-popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1300;
  width: 100%;
  height: 100%;
  padding: 16px;
  background: rgba(0, 0, 0, .35);
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
}

.be-popup.open { display: flex; }

.be-popup .be-box {
  width: 100%;
  max-width: 380px;
  padding: 18px;
  border-radius: 8px;
  background: var(--BBG, #fff);
  color: var(--PCL, #222);
  font: normal 400 13px Roboto, Arial, sans-serif;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .28);
  box-sizing: border-box;
}

.be-popup .be-head {
  font: normal 700 15px Roboto, Arial, sans-serif;
  margin-bottom: 12px;
}

.be-popup .be-url {
  display: block !important;
  width: 100% !important;
  height: 40px;
  margin: 0;
  padding: 8px 10px !important;
  border: 1px solid var(--ICL, #cfcfcf) !important;
  border-radius: 5px !important;
  background: var(--IBG, #fff) !important;
  color: var(--PCL, #222) !important;
  font: normal 400 14px Roboto, Arial, sans-serif !important;
  box-sizing: border-box;
}

.be-popup .be-url:focus { border-color: var(--ABG1, #f5a02c) !important; }

.be-popup .be-hint {
  margin-top: 7px;
  color: var(--PLH, #888);
  font: normal 300 11px Roboto, Arial, sans-serif;
}

.be-popup .be-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.be-popup .be-gap { flex: 1 1 auto; }

.be-popup .be-act {
  display: inline-block;
  padding: 8px 14px 7px 14px;
  border: 0;
  border-radius: 5px;
  background: var(--IBG, #f0f0f0);
  color: var(--PCL, #333);
  font: normal 400 13px Roboto, Arial, sans-serif;
  cursor: pointer;
}

.be-popup .be-act:hover { background: var(--BBG, #e6e6e6); }
.be-popup .be-act.primary { background: var(--ABG1, #f5a02c); color: var(--ACL1, #fff); }
.be-popup .be-act.primary:hover { background: var(--ABG2, #df8f1f); }
.be-popup .be-act.off { background: none; color: #c33; padding-left: 0; padding-right: 0; }
.be-popup .be-act.off:hover { background: none; text-decoration: underline; }
.be-popup .be-act.hide { display: none; }


/* paleta de culori (dropdown sub buton) */
/* -------------------------------------------------------------------------------*/

.be-palette {
  display: none;
  position: absolute;
  z-index: 1200;
  width: 260px;
  padding: 8px;
  border-radius: 6px;
  background: var(--BBG, #fff);
  color: var(--PCL, #333);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
  box-sizing: border-box;
}

.be-palette.open { display: flex; flex-wrap: wrap; gap: 5px; }

.be-palette .be-sw {
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--ICL, rgba(0, 0, 0, .18));
  border-radius: 4px;
  cursor: pointer;
  box-sizing: border-box;
}

.be-palette .be-sw:hover { transform: scale(1.12); }

.be-palette .be-sw.none {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--PLH, #999);
  font-size: 11px;
}

/* mărimea textului — pătrățele de aceeași dimensiune ca swatch-urile de culoare */
.be-palette.sizes {
  width: 260px;
  gap: 5px;
}

.be-palette.sizes .be-sz {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--ICL, rgba(0, 0, 0, .18));
  border-radius: 4px;
  background: transparent;
  color: var(--PCL, #333);
  font: normal 600 11px Roboto, Arial, sans-serif;
  cursor: pointer;
  box-sizing: border-box;
}

.be-palette.sizes .be-sz:hover { transform: scale(1.12); }

.be-palette.sizes .be-sz.on {
  background: var(--ABG1, #f5a02c);
  border-color: transparent;
  color: var(--ACL1, #fff);
}

.be-palette.sizes .be-sz.none { color: var(--PLH, #999); }

/* dropdown cu taburi (culoare fundal: Basic / Highlights) */
.be-palette.with-tabs {
  flex-direction: column;
  align-items: stretch;
  width: 260px;
  gap: 13px;
}

.be-palette .be-tabs { display: flex; gap: 4px; }

.be-palette .be-tab {
  flex: 1 1 0;
  min-width: 0;
  height: 26px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid var(--ICL, rgba(0, 0, 0, .12));
  border-radius: 4px;
  background: transparent;
  color: var(--PCL, #555);
  font: normal 400 12px Roboto, Arial, sans-serif;
  cursor: pointer;
}

.be-palette .be-tab:hover { background: var(--IBG, #ececec); }

.be-palette .be-tab.on {
  background: var(--ABG1, #f5a02c);
  border-color: transparent;
  color: var(--ACL1, #fff);
}

.be-palette .be-body {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* presetarea de evidențiere (fundal accent + text ACL1) */
.be-palette .be-sw.hl {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  font: normal 700 11px Roboto, Arial, sans-serif;
}

/* inserare (momentan doar linia orizontală) și aliniere */
.be-palette.insert,
.be-palette.align { width: auto; }

.basic-editor .be-area hr {
  height: 0;
  margin: 30px 0;
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, .1);
}


/* editorul stă de obicei într-o casetă .form-box imbricată — scoatem padding-ul lateral
   al casetei, ca editorul să fie aliniat pe toată lățimea cu câmpurile de deasupra */
.form-box.nos:has(> .basic-editor) { padding-left: 0; padding-right: 0; }

/* ECRAN COMPLET */
/* -------------------------------------------------------------------------------*/

body.be-full { overflow: hidden; }

.basic-editor.full {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
}

.basic-editor.full .be-tools {
  position: static;
  flex: 0 0 auto;
  border-radius: 0;
}

.basic-editor.full .be-tools::before { content: none; }

.basic-editor.full .be-area {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

.basic-editor.full .be-code {
  flex: 1 1 auto;
  max-height: none;
}

/* textarea-ul original rămâne în formular, dar ascuns */
.basic-editor-src { display: none !important; }
