/* =========================================
   Blocks Builder — Light, Flat, No-Shadows
   (no markup changes)
   ========================================= */

/* --------- CSS Variables & Theme --------- */
:root{
  --bg: #f7f8fb;
  --panel: #ffffff;
  --panel-2: #f4f6fb;
  --text: #0b1220 !important;
  --muted: #5b6b85;
  --border-color: rgba(9,20,51,.12);
  --border: 1px solid var(--border-color);
  --brand: #3b82f6;      /* основной акцент (синий) */
  --brand-2: #1d4ed8;    /* актив/hover */
  --accent: #10b981;     /* доп. акцент (зелёный) */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --focus: 0 0 0 3px rgba(59,130,246,.25);

  --orange-gradient: none; /* без градиентов */
  --font: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* --------- Base --------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin:0;
  font-family: var(--font);
  color: #111;
  background: #FFF;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Scrollbar (светлый, без тени) */
*{ scrollbar-width: thin; scrollbar-color: rgba(0,0,0,.25) transparent; }
*::-webkit-scrollbar { height: 10px; width: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(0,0,0,.25); border-radius: 20px; }
*::-webkit-scrollbar-track { background: transparent; }

/* --------- Layout --------- */
.wrap{
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px 60px;
}

h1{
  font-size: clamp(24px, 2.8vw, 38px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 10px 0 22px;
  color: #0b1220;
}

/* --------- Card / Panel --------- */
.panel{
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(16px, 2.2vw, 26px);
}

/* --------- Rows --------- */
.row{
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
}

.row + .row{ border-top: var(--border); }

.row.between{
  grid-template-columns: 1fr auto;
  align-items: end;
}

.htaccess-settings{
  background: var(--panel-2);
  border: var(--border);
  border-radius: var(--radius);
  margin: -4px 0 12px;
  padding: 12px 16px;
}
.htaccess-settings .row{
  border-top: none;
  padding: 10px 0;
}
.htaccess-settings .row + .row{
  border-top: var(--border);
}

.radio-group{
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.radio-group label{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}
.radio-group input{
  margin: 0;
}

.help{
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.5;
}
.htaccess-summary{
  margin: 8px 0 0 240px;
}

select {
      appearance: none;
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text);
    transition: border .2s 
      ease, background .2s 
      ease, transform .06s 
      ease;
}
label{
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .02em;
}

/* --------- Inputs --------- */
input[type="text"],
input[type="color"],
input[type="url"]{
  appearance: none;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text);
  transition: border .2s ease, background .2s ease, transform .06s ease;
}

input[type="color"]{
  padding: 0;
  height: 40px;
  width: 56px;
  border-radius: 8px;
  cursor: pointer;
}

input::placeholder{ color: rgba(9,20,51,.45); }

input:focus{
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus);
  background: #fff;
}

.vpair{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin: 6px 10px 6px 0;
  background: var(--panel-2);
  border: var(--border);
  border-radius: 10px;
}
.vpair span{
  font: 600 12px/1 var(--font);
  color: var(--muted);
  padding: 6px 8px;
  background: #eef2ff;
  border: 1px solid rgba(29,78,216,.12);
  border-radius: 6px;
  min-width: 70px;
  text-align: center;
}

/* inputs group for vars */

.vars .grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  width: 100%;
}
.vpair {
  display: grid;
  grid-template-columns: 80px 140px 1fr;
  gap: 8px;
  align-items: center;
  
}

.vpair input {
  color: #0b1220 !important;
}
.vpair input[type="text"].input-error {
  outline: 2px solid #ff4d4f;
}
/* --------- Buttons (плоские) --------- */
button, .download{
  border: 1px solid var(--border-color);
  color: #0b1220;
  background: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .06s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

button:hover, .download:hover{
  background: #f5f7ff;
  border-color: rgba(59,130,246,.45);
}

button:active, .download:active{ transform: translateY(1px); }

/* Primary */
button.primary{
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
button.primary:hover{ background: var(--brand-2); border-color: var(--brand-2); }

/* Secondary */
button.secondary{
  background: #f3f4f6;
  border-color: var(--border-color);
  color: #0b1220;
}

/* Actions line */
.actions{
  display: flex;
  gap: 12px;
  justify-content: flex-start;
  align-items: center;
  margin-top: 18px;
}

.download[hidden]{ display: none !important; }

/* --------- Langs & Add-lang --------- */
.langs{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.langs .chip{
  background: var(--panel-2);
  border: var(--border);
  border-radius: 999px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.add-lang,
.add-page{
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
}
.add-page input#newSlug{ grid-column: 1 / span 2; }

/* --------- Tabs --------- */
.tabs{
  margin-top: 12px;
  border-bottom: var(--border);
  display: flex;
  gap: 6px;
  overflow: auto hidden;
  padding-bottom: 6px;
}

.tabs .tab{
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.tabs .tab:hover{
  color: var(--text);
  background: #eef2ff;
  border-color: rgba(29,78,216,.18);
}
.tabs .tab.is-active{
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

/* --------- Pages content area --------- */
#pagesContent{
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

/* Generic editor block */
#pagesContent .block{
  padding: 14px;
  background: var(--panel-2);
  border: var(--border);
  border-radius: var(--radius);
}

#pagesContent textarea,
#pagesContent input[type="text"]{
  width: 100%;

  resize: vertical;
}
.grid {
    display: grid
;
    grid-template-columns: 1fr 1fr;
}

.palette {
    display: grid
;
    grid-template-columns:  1fr 1fr;
    gap: 10px;
}
.palette button {
    margin-left: auto !important;
    background: #242424 !important;
    color: #FFF !important;
}
/* --------- Headings inside panel --------- */
h3{
  margin: 6px 0 0;
  font-size: 18px;
  letter-spacing: .01em;
}

/* --------- HR --------- */
hr{
  border: none;
  border-top: var(--border);
  margin: 18px 0;
}

/* --------- Log --------- */
.log{
  margin-top: 16px;
  background: #0f172a;
  border: 1px solid rgba(0,0,0,.25);
  color: #a7ffb7;
  border-radius: 10px;
  padding: 14px;
  max-height: 320px;
  overflow: auto;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* --------- Responsive --------- */
@media (max-width: 980px){
  .row{ grid-template-columns: 200px 1fr; }
}
@media (max-width: 760px){
  .row{ grid-template-columns: 1fr; }
  label{ margin-bottom: -2px; }
  .add-lang, .add-page{ grid-template-columns: 1fr; }
  .actions{ flex-wrap: wrap; }
}

/* --------- Micro-interactions --------- */
input[type="text"]:hover{
  border-color: rgba(59,130,246,.35);
}

/* --------- Utility --------- */
.hidden{ display: none !important; }
.full{ width: 100% !important; }

/* --------- Selection --------- */
::selection{ background: rgba(59,130,246,.25); color: #0b1220; }

/* ===========================================================
   HOT-FIX: строки «текст + кнопка» выравниваем в один ряд
   (без изменения разметки)
   =========================================================== */
.panel :where(p, li, div, section):has(> button){
  display: flex;
  align-items: center;

  gap: 12px;
  padding: 6px 10px;
  border-radius: 10px;

  border: var(--border);
}

.panel :where(p, li, div, section):has(> button) > button{
  flex: 0 0 auto;
  white-space: nowrap;
  margin-left: 12px;
}

/* интервал между строками-контейнерами */
.panel :where(p, li, div, section):has(> button)
  + :where(p, li, div, section):has(> button){
  margin-top: 8px;
}

/* компактнее на мобилке */
@media (max-width: 600px){
  .panel :where(p, li, div, section):has(> button){ padding: 6px 8px; gap: 10px; }
  button, .download{ padding: 9px 12px; }
}

.modal[hidden]{display:none}
.modal{position:fixed;inset:0;display:grid;place-items:center;background:rgba(0,0,0,.2);z-index:1000}
.modal__panel{width:min(920px,95vw);background:#fff;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 10px 20px rgba(0,0,0,.06);display:flex;flex-direction:column}
.modal__head,.modal__foot{padding:12px 16px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #eee}
.modal__foot{border-top:1px solid #eee;border-bottom:0;justify-content:flex-end;gap:8px}
.modal__toolbar{display:flex;gap:6px;align-items:center;padding:8px 12px;border-bottom:1px solid #eee}
.modal__toolbar .sep{width:1px;height:20px;background:#e5e7eb;margin:0 4px}
.modal__editor{min-height:260px;max-height:60vh;overflow:auto;padding:14px 16px}
.icon-btn{font-size:18px;line-height:1;border:0;background:transparent;cursor:pointer}
.primary{background:#111;color:#fff;border:0;border-radius:8px;padding:10px 14px}


/* Tooltip превью блока */
.block-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: rgba(15, 22, 35, 0.9);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
  padding: 6px;
  opacity: 0;
  transform: translate3d(0,0,0);
  transition: opacity 120ms ease;
  max-width: min(440px, 48vw);
  max-height: min(320px, 45vh);
  display: flex;
  align-items: center;
  justify-content: center;
}

.block-tooltip.is-visible { opacity: 1; }

.block-tooltip__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
}

.block-tooltip__loading,
.block-tooltip__error {
  color: #e9edf3;
  font-size: 12px;
  padding: 6px 8px;
  opacity: .8;
  white-space: nowrap;
}
