/* ---------- Inline editing on the page ---------- */
body.ua-editing [data-edit-id] {
  outline: 1.5px dashed rgba(99, 102, 241, .5);
  outline-offset: 2px;
  cursor: text;
  border-radius: 4px;
  transition: outline-color .15s, background-color .15s;
}
body.ua-editing [data-edit-id]:hover {
  outline-color: rgba(99, 102, 241, .9);
  background: rgba(99, 102, 241, .06);
}
body.ua-editing [data-edit-id]:focus {
  outline: 2px solid #6366f1;
  background: rgba(99, 102, 241, .08);
}

.ua-img-wrap { position: relative; display: inline-block; max-width: 100%; }
.ua-img-btn {
  position: absolute; bottom: 8px; left: 8px; z-index: 999997;
  background: rgba(17,24,39,.85); color: #fff; border: none; border-radius: 6px;
  padding: 6px 10px; font-size: 12px; cursor: pointer; font-family: system-ui, sans-serif;
}

.ua-block-hidden-live { opacity: .35; outline: 2px dashed #ef4444; }

body.ua-editing { padding-left: 0; }

/* ---------- Sidebar ---------- */
#ua-sidebar, #ua-sidebar * {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

#ua-sidebar {
  position: fixed; top: 0; left: 0; height: 100vh; width: 320px; max-width: 88vw;
  background: #111827; color: #e5e7eb; z-index: 2147483000;
  display: flex; flex-direction: column;
  box-shadow: 8px 0 30px rgba(0,0,0,.35);
  transition: transform .2s ease; font-size: 13px;
}
#ua-sidebar.ua-collapsed { transform: translateX(-100%); }

#ua-sidebar .ua-sb-header { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
#ua-sidebar .ua-sb-title { font-weight: 700; font-size: 14px; margin-bottom: 6px; color: #fff; }
#ua-sidebar .ua-sb-hint { font-size: 11px; color: #9ca3af; line-height: 1.4; margin-bottom: 10px; }
#ua-sidebar .ua-sb-pages { display: flex; flex-wrap: wrap; gap: 6px; }
#ua-sidebar .ua-sb-pages a {
  color: #cbd5e1; text-decoration: none; font-size: 12px; padding: 5px 9px;
  border-radius: 7px; background: rgba(255,255,255,.06);
}
#ua-sidebar .ua-sb-pages a.ua-current { background: #6366f1; color: #fff; font-weight: 600; }
#ua-sidebar .ua-sb-pages a:hover { background: rgba(255,255,255,.14); }

#ua-sidebar .ua-sb-body { flex: 1; overflow-y: auto; padding: 6px 0; }

#ua-sidebar .ua-sb-group { border-bottom: 1px solid rgba(255,255,255,.06); padding: 9px 16px; }
#ua-sidebar .ua-sb-group-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #e5e7eb; font-weight: 600;
}
#ua-sidebar .ua-sb-block-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; cursor: pointer; }
#ua-sidebar .ua-sb-block-name:hover { color: #a5b4fc; }
#ua-sidebar .ua-sb-drag { cursor: grab; color: #6b7280; flex-shrink: 0; }
#ua-sidebar [data-group-block].ua-drag-over { outline: 2px dashed #6366f1; outline-offset: -2px; }
#ua-sidebar .ua-sb-block-actions { display: flex; gap: 3px; flex-shrink: 0; }
#ua-sidebar .ua-sb-block-actions button {
  width: 22px; height: 22px; border: none; border-radius: 5px; background: rgba(255,255,255,.08);
  color: #e5e7eb; cursor: pointer; font-size: 11px; line-height: 1; padding: 0;
}
#ua-sidebar .ua-sb-block-actions button:hover { background: rgba(255,255,255,.2); }
#ua-sidebar .ua-sb-group.ua-hidden-block { opacity: .5; }
#ua-sidebar .ua-sb-group.ua-hidden-block .ua-sb-group-title::after {
  content: 'скрыт'; color: #f59e0b; font-size: 10px; margin-left: 4px;
}

#ua-sidebar .ua-sb-style {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(255,255,255,.1);
}
#ua-sidebar .ua-sb-style label { display: flex; flex-direction: column; gap: 3px; font-size: 10px; color: #9ca3af; }
#ua-sidebar .ua-sb-style input[type=color] { width: 30px; height: 24px; border: none; border-radius: 5px; padding: 0; background: none; cursor: pointer; }
#ua-sidebar .ua-sb-style select {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: #fff;
  border-radius: 6px; padding: 4px 6px; font-size: 11px;
}
#ua-sidebar .ua-sb-style-reset {
  border: none; background: rgba(255,255,255,.08); color: #cbd5e1; border-radius: 6px;
  padding: 5px 8px; font-size: 11px; cursor: pointer; margin-left: auto;
}
#ua-sidebar .ua-sb-style-reset:hover { background: rgba(255,255,255,.18); }

/* Block library */
#ua-sidebar .ua-sb-library-wrap { border-bottom: none; }
#ua-sidebar .ua-lib-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
#ua-sidebar .ua-lib-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 10px;
  padding: 10px 6px; cursor: pointer; color: #e5e7eb;
}
#ua-sidebar .ua-lib-tile:hover { background: rgba(99,102,241,.15); border-color: #6366f1; }
#ua-sidebar .ua-lib-label { font-size: 10.5px; text-align: center; line-height: 1.2; }
#ua-sidebar .ua-lib-preview {
  width: 100%; height: 40px; background: rgba(255,255,255,.06); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; gap: 4px; padding: 6px;
}
#ua-sidebar .ua-lib-preview i { display: block; background: #6366f1; border-radius: 2px; opacity: .8; }

#ua-sidebar .ua-lib-p-text { flex-direction: column; align-items: stretch; gap: 3px; }
#ua-sidebar .ua-lib-p-text i:nth-child(1) { height: 6px; width: 55%; margin: 0 auto; }
#ua-sidebar .ua-lib-p-text i:nth-child(2) { height: 4px; width: 90%; }
#ua-sidebar .ua-lib-p-text i:nth-child(3) { height: 4px; width: 70%; }

#ua-sidebar .ua-lib-p-imageText i:nth-child(1) { width: 30%; height: 100%; }
#ua-sidebar .ua-lib-p-imageText i:nth-child(2) { width: 45%; height: 4px; align-self: flex-start; margin-top: 8px; }
#ua-sidebar .ua-lib-p-imageText i:nth-child(3) { display: none; }

#ua-sidebar .ua-lib-p-textImage i:nth-child(1) { width: 45%; height: 4px; order: 1; }
#ua-sidebar .ua-lib-p-textImage i:nth-child(2) { width: 30%; height: 100%; order: 2; }
#ua-sidebar .ua-lib-p-textImage i:nth-child(3) { display: none; }

#ua-sidebar .ua-lib-p-features3 i, #ua-sidebar .ua-lib-p-features4 i,
#ua-sidebar .ua-lib-p-gallery i { width: 26%; height: 100%; border-radius: 3px; }

#ua-sidebar .ua-lib-p-stats i, #ua-sidebar .ua-lib-p-team i { width: 20%; height: 70%; align-self: center; border-radius: 50%; }

#ua-sidebar .ua-lib-p-pricing i { width: 26%; height: 100%; border-radius: 4px 4px 2px 2px; }
#ua-sidebar .ua-lib-p-pricing i:nth-child(2) { height: 100%; background: #a5b4fc; }

#ua-sidebar .ua-lib-p-testimonial { flex-direction: column; gap: 3px; }
#ua-sidebar .ua-lib-p-testimonial i:nth-child(1) { width: 90%; height: 4px; }
#ua-sidebar .ua-lib-p-testimonial i:nth-child(2) { width: 60%; height: 4px; }
#ua-sidebar .ua-lib-p-testimonial i:nth-child(3) { width: 30%; height: 10px; border-radius: 50%; margin-top: 3px; }

#ua-sidebar .ua-lib-p-faq { flex-direction: column; gap: 4px; }
#ua-sidebar .ua-lib-p-faq i { width: 85%; height: 5px; }

#ua-sidebar .ua-lib-p-cta { flex-direction: column; gap: 4px; align-items: center; }
#ua-sidebar .ua-lib-p-cta i:nth-child(1) { width: 65%; height: 5px; }
#ua-sidebar .ua-lib-p-cta i:nth-child(2) { width: 40%; height: 10px; border-radius: 5px; background: #a5b4fc; }
#ua-sidebar .ua-lib-p-cta i:nth-child(3) { display: none; }

#ua-sidebar .ua-sb-footer {
  flex-shrink: 0; padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 8px;
}
#ua-sidebar .ua-sb-footer button, #ua-sidebar .ua-sb-footer a {
  border: none; background: rgba(255,255,255,.08); color: #fff; padding: 9px 12px;
  border-radius: 8px; cursor: pointer; font-size: 12px; text-decoration: none; font-family: inherit;
}
#ua-sidebar .ua-sb-footer button.ua-primary { background: #6366f1; flex: 1; font-weight: 600; }
#ua-sidebar .ua-sb-footer button.ua-primary:hover { background: #4f46e5; }
#ua-sidebar .ua-sb-footer a:hover, #ua-sidebar .ua-sb-footer button:hover { background: rgba(255,255,255,.18); }
#ua-sidebar .ua-dot { width: 8px; height: 8px; border-radius: 50%; background: #4b5563; flex-shrink: 0; }
#ua-sidebar .ua-dot.dirty { background: #f59e0b; }

#ua-sidebar-toggle {
  position: fixed; top: 12px; left: 12px; z-index: 2147483001;
  width: 38px; height: 38px; border-radius: 10px; border: none; cursor: pointer;
  background: #111827; color: #fff; font-size: 16px; box-shadow: 0 4px 14px rgba(0,0,0,.35);
  display: none; align-items: center; justify-content: center; font-family: system-ui, sans-serif;
}
#ua-sidebar.ua-collapsed ~ #ua-sidebar-toggle { display: flex; }

#ua-toast {
  position: fixed; left: 336px; bottom: 20px; background: #059669; color: #fff;
  padding: 10px 18px; border-radius: 10px; font-family: system-ui, sans-serif; font-size: 13px;
  z-index: 2147483001; opacity: 0; transition: opacity .2s; pointer-events: none;
}
#ua-toast.show { opacity: 1; }
