/* Bara de sus și filele editorului vizual (I1-T, U1, U2). Se încarcă înaintea lui admin-theme-editor.css, deci câștigă prin specificitate;
   totul e sub .te. Bara are un singur accent, „Publică”; restul sunt iconițe fără fundal, pe bara închisă. */

.te .te-bar { gap: 0.5rem 0.75rem; }
.te .te-bar a.te-back { display: inline-flex; align-items: center; gap: 0.25rem; min-height: 2rem; padding: 0 0.5rem 0 0.25rem; border-radius: 6px; color: var(--te-bar-fg); font-size: 0.875rem; text-decoration: none; }
.te .te-bar a.te-back:hover { background: #26302a; color: #fff; }
.te .te-history { flex: none; }

/* Un singur rând de la 901 px în sus, și la 1024 (H3): titlul și pagina se strâng, starea ia ce rămâne și se taie cu „…” când e
   lungă. Un mesaj de eroare nu se taie: își ia un rând propriu sub bară (mesajele lungi n-au loc într-o bară). Sub 900 px bara se
   așază pe rânduri, ca înainte. */
@media (min-width: 900.02px) {
  body.te-body .te .te-bar { flex-wrap: nowrap; gap: 0.5rem; }
  body.te-body .te .te-bar > * { flex-shrink: 0; }
  body.te-body .te .te-bar .te-title { flex: 0 1 auto; min-width: 3rem; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.te-body .te .te-bar .te-pages { flex: 0 1 auto; min-width: 0; }
  body.te-body .te .te-bar .te-pages-button { max-width: 14rem; }
  body.te-body .te .te-bar .te-status { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.te-body .te .te-bar .te-status.te-status-error { flex: 1 1 100%; white-space: normal; order: 99; }
  body.te-body .te .te-bar:has(.te-status-error) { flex-wrap: wrap; }
}
@media (min-width: 1280px) {
  body.te-body .te .te-bar { gap: 0.5rem 1rem; }
  body.te-body .te .te-bar .te-title { max-width: 16rem; }
  body.te-body .te .te-bar .te-pages-button { max-width: 18rem; }
}

body.te-body .te .te-bar .te-tool { position: relative; flex: none; width: 2rem; min-height: 2rem; background: transparent; border-color: transparent; color: var(--te-bar-fg); }
body.te-body .te .te-bar .te-tool:hover:not(:disabled) { background: #26302a; color: #fff; }
body.te-body .te .te-bar .te-tool:disabled { background: transparent; color: #7f8c84; opacity: 1; cursor: not-allowed; }
/* Dispozitivul ales: fundal deschis și linie jos, nu doar culoare. */
body.te-body .te .te-bar .te-devices [aria-pressed="true"],
body.te-body .te .te-bar .te-devices [aria-pressed="true"]:hover:not(:disabled) { background: var(--te-accent-soft); color: #0f4f38; box-shadow: inset 0 -3px 0 var(--te-accent); }

/* Indicația iconițelor: la mouse și la focus; Escape o ascunde (theme_editor/tips.js). Numele accesibil e aria-label, nu acest text. */
.te .te-tool[data-tip]:is(:hover, :focus-visible):not([data-tip-off], [aria-expanded="true"])::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  padding: 0.25rem 0.5rem;
  background: #fff;
  color: #1b211d;
  border: 1px solid var(--te-border-strong);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}
/* Ultimele iconițe din dreapta: indicația se aliniază la buton, ca să nu iasă din ecran. */
.te .te-history .te-tool[data-tip]::after, .te .te-more .te-tool[data-tip]::after { left: auto !important; right: 0; transform: none !important; }

/* Meniul „Mai multe” */
.te .te-more .dd-list { color: var(--te-text); }
.te .te-more .dd-item { justify-content: space-between; font: inherit; background: none; border: 0; text-align: left; cursor: pointer; }
.te .te-more select.dd-item { cursor: pointer; }
body.te-body .te .te-bar .te-more .dd-item:hover { background: var(--te-hover); color: var(--te-text); }

/* „Publică” e al editorului; culoarea o ține admin-theme-editor-publish.css. */
.te .te-publish { flex: none; font-weight: 600; }

/* Filele */
.te .te-rail { display: flex; flex-direction: column; gap: 0.25rem; width: 5rem; padding: 0.5rem 0.375rem; background: var(--te-surface-2); border-right: 1px solid var(--te-border-strong); }
.te .te-rail-tab { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; width: 100%; min-height: 3.25rem; padding: 0.5rem 0.125rem; background: none; border: 0; border-radius: 6px; color: var(--te-text); font: inherit; font-size: 0.75rem; line-height: 1.2; cursor: pointer; }
.te .te-rail-tab:hover { background: var(--te-hover); }
/* Fila activă: fundal, bară laterală și text îngroșat, nu doar culoare. */
.te .te-rail-tab[aria-selected="true"] { background: var(--te-accent-soft); color: #0f4f38; font-weight: 700; box-shadow: inset 3px 0 0 var(--te-accent); }

/* „Vitrină” e fila doar a telefonului (H3); intrarea „Șabloane alternative” din „Mai multe” la fel. */
.te .te-rail-phone { display: none; }
@media (min-width: 900.02px) { .te .te-more .te-more-phone { display: none; } }

.te .te-side-panel { overflow-y: auto; min-width: 0; min-height: 0; background: var(--te-surface); border-right: 1px solid var(--te-border-strong); }
.te .te-side-panel[hidden] { display: none; }
.te #te-panel-templates { padding: 1rem; }
.te #te-panel-templates .te-pane-title { font-size: 1rem; text-transform: none; letter-spacing: 0; color: var(--te-text); }
.te .te-side-panel .te-tree { border-right: 0; }
/* Setările temei și șabloanele au nevoie de loc; setările secțiunii se ascund, deci vitrina ia restul. */
.te .te-panes:not([data-te-active="sections"]) { grid-template-columns: auto 340px minmax(0, 1fr); }
.te .te-panes:not([data-te-active="sections"]) .te-skip { display: none; }

/* Sub 900 px bara se așază pe trei rânduri, fără defilare orizontală, iar filele stau jos pe ecran. Câmpurile care primesc focusul nu
   rămân sub ele (2.4.11): scroll-padding pe pagină. */
@media (max-width: 900px) {
  .te .te-bar { padding: 0.5rem 0.75rem; }
  .te .te-bar .te-title { flex: 1 1 60%; max-width: none; }
  html:has(body.te-body) { scroll-padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
  .te .te-panes { padding-bottom: calc(4.25rem + env(safe-area-inset-bottom)); }
  .te .te-panes:not([data-te-active="sections"]) { display: flex; }
  /* Înălțimea barei de file de jos: sursa unică. Ghidul de prima utilizare (admin-theme-editor-tour.css) își ține foaia deasupra ei și o
     citește din măsură când bara crește; cine schimbă bara (padding, înălțimea filelor) schimbă doar valoarea de aici. */
  .te { --te-rail-height: calc(3.75rem + 1px + env(safe-area-inset-bottom, 0px)); }
  .te .te-rail { box-sizing: border-box; min-height: var(--te-rail-height); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; flex-direction: row; width: auto; padding: 0.25rem 0.5rem calc(0.25rem + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--te-border-strong); }
  .te .te-rail-tab { flex: 1 1 0; min-height: 3.25rem; }
  .te .te-rail-tab[aria-selected="true"] { box-shadow: inset 0 3px 0 var(--te-accent); }
  .te .te-side-panel { border-right: 0; overflow-y: visible; }
  /* Trei file pe telefon: Secțiuni, Vitrină, Setări (H3). Șabloanele se deschid din „Mai multe”. */
  .te .te-rail-phone { display: flex; }
  .te .te-rail-wide, .te .te-rail-extra { display: none; }
  /* Vitrina se vede doar în fila ei; celelalte file arată panourile, fără vitrină între ele. */
  .te .te-panes:not([data-te-active="stage"]) .te-stage { display: none; }
  .te .te-panes[data-te-active="stage"] > :not(.te-stage, .te-rail, .te-skip, dialog) { display: none; }
  .te .te-panes[data-te-active="stage"] .te-stage { height: calc(100dvh - 13rem); min-height: 20rem; }
}
