/* Relleu Studio — interfície de l'editor */

:root {
  --ground: #e8edf3;
  --surface: #ffffff;
  --panel: #f5f7fa;
  --text: #0f1826;
  --muted: #56657a;
  --line: #d8e0ea;
  --line-soft: #e6ebf2;
  --accent: #0e528f;
  --accent-soft: #e2edf7;
  --warn: #9a5a12;
  --danger: #a33c2a;
  --shadow: 0 18px 46px -30px rgba(9, 22, 40, .55);
  --r: 10px;
  --ui: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Bricolage Grotesque", "Archivo", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0a0f17;
    --surface: #131b26;
    --panel: #0f1620;
    --text: #e6ecf3;
    --muted: #8fa1b6;
    --line: #223043;
    --line-soft: #1a2533;
    --accent: #3fb6e0;
    --accent-soft: #102233;
    --warn: #d3a251;
    --danger: #e0806c;
    --shadow: 0 18px 46px -30px rgba(0, 0, 0, .8);
  }
}

:root[data-theme="dark"] {
  --ground: #0a0f17;
  --surface: #131b26;
  --panel: #0f1620;
  --text: #e6ecf3;
  --muted: #8fa1b6;
  --line: #223043;
  --line-soft: #1a2533;
  --accent: #3fb6e0;
  --accent-soft: #102233;
  --warn: #d3a251;
  --danger: #e0806c;
  --shadow: 0 18px 46px -30px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font-family: var(--ui); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { height: 100%; display: flex; flex-direction: column; }

/* ---------- barra superior ---------- */
.bar {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  background: var(--surface); border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 7px; font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: -.02em; margin-right: 4px; }
.logo span { font-family: var(--ui); font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.bar .sp { flex: 1 1 auto; }

select.site-pick { max-width: 210px; }
select, input[type="text"], input[type="password"], input[type="number"], input[type="color"], textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { resize: vertical; min-height: 74px; line-height: 1.5; }
select { cursor: pointer; }

.btn { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 8px 13px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
a.btn, a.btn:visited { text-decoration: none; color: var(--text); }
a.btn:hover { color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 9px; font-size: 12px; border-radius: 7px; }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { background: none; border: 0; border-radius: 7px; padding: 6px 11px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

.state { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 99px; background: var(--accent); }
.dot.off { background: var(--warn); }

/* ---------- estructura ---------- */
.main { flex: 1; display: grid; grid-template-columns: 296px 1fr 320px; min-height: 0; }
.panel { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.panel.right { border-right: 0; border-left: 1px solid var(--line); }
.panel-head { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 8px; flex: none; }
.panel-head h2 { font-family: var(--display); font-size: 14px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.panel-body { overflow: auto; padding: 12px 14px 60px; display: flex; flex-direction: column; gap: 12px; }

.tabs { display: flex; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); flex: none; }
.tabs button { flex: 1; background: none; border: 0; border-radius: 8px; padding: 7px 4px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.on { background: var(--accent-soft); color: var(--accent); }
.tabs.five button { font-size: 11px; padding: 7px 2px; letter-spacing: -.01em; }
.tabs.six button { font-size: 10.5px; padding: 7px 1px; letter-spacing: -.02em; }

/* ---------- idiomes ---------- */
.langrow { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: var(--surface); }
.langrow b { font-size: 13px; }
.langrow .sp { flex: 1; }
.langrow small { color: var(--muted); font-size: 11.5px; }
.langrow.falta { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.langbar { display: flex; gap: 4px; flex-wrap: wrap; }
.langbar button { flex: 1; min-width: 54px; white-space: normal; text-align: center; justify-content: center; line-height: 1.25; }
#langPill { background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 3px 9px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.tradbar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.tradbar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* ---------- xarxes socials ---------- */
.socrow { display: flex; align-items: center; gap: 7px; }
.socrow input { flex: 1; }
.socico { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); }
.socico svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- llista de blocs ---------- */
.blk { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 9px 10px; cursor: pointer; }
.blk.on { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.blk.drag { opacity: .4; }
.blk.over { border-color: var(--accent); border-style: dashed; }
.blk .grip { color: var(--muted); cursor: grab; font-size: 13px; line-height: 1; }
.blk .nm { flex: 1; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blk .nm small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.blk.hidden .nm { opacity: .5; text-decoration: line-through; }
.iconbtn { background: none; border: 0; padding: 4px; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1; }
.iconbtn:hover { background: var(--accent-soft); color: var(--accent); }

.addgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.addgrid button { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 11px 9px; text-align: left; font-size: 12px; font-weight: 600; cursor: pointer; }
.addgrid button:hover { border-color: var(--accent); color: var(--accent); border-style: solid; }
.grouplabel { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }

/* ---------- camps ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.field .hint { font-size: 11px; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

.imgfield { display: flex; gap: 10px; align-items: center; }
.imgfield .thumb { width: 66px; height: 50px; border-radius: 7px; border: 1px solid var(--line); object-fit: cover; background: var(--ground); flex: none; }

.item { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.item > summary { list-style: none; cursor: pointer; padding: 9px 11px; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.item > summary::-webkit-details-marker { display: none; }
.item > summary:before { content: "▸"; color: var(--muted); font-size: 11px; }
.item[open] > summary:before { content: "▾"; }
.item .body { padding: 4px 11px 12px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line-soft); }
.item .sum-act { margin-left: auto; display: flex; gap: 2px; }

/* ---------- escenari ---------- */
.stage { background: var(--ground); overflow: auto; display: flex; justify-content: center; padding: 18px; min-height: 0; }
.frame { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; width: 100%; height: 100%; transition: max-width .2s ease; }
.frame.tablet { max-width: 800px; }
.frame.phone { max-width: 412px; }
.frame iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

/* ---------- targetes de web ---------- */
.sitecard { display: flex; gap: 11px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; cursor: pointer; }
.sitecard.on { border-color: var(--accent); }
.sitecard:hover { border-color: var(--accent); }
.swatch { width: 40px; height: 40px; border-radius: 8px; flex: none; border: 1px solid var(--line); }
.sitecard b { display: block; font-size: 13px; }
.sitecard small { color: var(--muted); font-size: 11px; }

.themecard { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 9px 10px; cursor: pointer; width: 100%; text-align: left; }
.themecard.on { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.themedots { display: flex; flex: none; }
.themedots i { width: 15px; height: 26px; display: block; border: 1px solid rgba(0, 0, 0, .08); }
.themedots i:first-child { border-radius: 5px 0 0 5px; }
.themedots i:last-child { border-radius: 0 5px 5px 0; }

/* miniatura dels packs d'estil: tres mòduls que insinuen la maquetació */
.stylemini { display: flex; gap: 3px; flex: none; width: 46px; height: 28px; align-items: stretch; }
.stylemini i { display: block; flex: 1; background: var(--line); border: 1px solid var(--line-soft); }
.stylemini.s-classic i { border-radius: 4px; }
.stylemini.s-editorial i { border-radius: 0; }
.stylemini.s-editorial i:first-child { flex: 1.6; border-top: 3px solid var(--accent); }
.stylemini.s-bento i { border-radius: 7px; }
.stylemini.s-bento i:first-child { flex: 2; }
.stylemini.s-suau i { border-radius: 10px; border-color: transparent; box-shadow: 0 4px 8px -5px rgba(0, 0, 0, .6); }
.stylemini.s-contrast i { border-radius: 0; border: 1.5px solid var(--text); box-shadow: 2px 2px 0 var(--accent); }

/* ---------- modals ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8, 16, 13, .55); display: none; align-items: center; justify-content: center; padding: 18px; z-index: 80; }
.overlay.on { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); width: min(760px, 100%); max-height: 86vh; display: flex; flex-direction: column; overflow: hidden; }
.modal header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.modal header h3 { margin: 0; font-family: var(--display); font-size: 16px; font-weight: 700; }
.modal .mbody { padding: 16px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal footer { padding: 12px 16px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; justify-content: flex-end; }
.illusgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.illusgrid button { border: 1px solid var(--line); background: none; border-radius: 9px; padding: 0; overflow: hidden; cursor: pointer; }
.illusgrid button:hover { border-color: var(--accent); }
.illusgrid img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.illusgrid span { display: block; font-size: 11px; font-weight: 600; padding: 6px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
pre.code { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 11px; line-height: 1.5; max-height: 42vh; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }
.note { background: var(--accent-soft); border-radius: 9px; padding: 11px 13px; font-size: 12.5px; color: var(--text); }
.note b { color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(16px); background: #11201c; color: #fff; padding: 11px 17px; border-radius: 10px; font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; transition: .22s ease; z-index: 99; }
.toast.on { opacity: 1; transform: translateX(-50%); }

.iconpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.iconpick button { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 4px; font-size: 9px; cursor: pointer; color: var(--muted); }
.iconpick button.on, .iconpick button:hover { border-color: var(--accent); color: var(--accent); }
.iconpick svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 22px 10px; }

/* ---------- responsiu ---------- */
.mobtabs { display: none; }
@media (max-width: 1180px) {
  .main { grid-template-columns: 268px 1fr 296px; }
}
@media (max-width: 1000px) {
  .main { grid-template-columns: 1fr; position: relative; }
  .panel { position: absolute; inset: 0 auto 0 0; width: min(340px, 86%); z-index: 20; box-shadow: var(--shadow); transform: translateX(-102%); transition: transform .2s ease; }
  .panel.right { inset: 0 0 0 auto; transform: translateX(102%); border-left: 1px solid var(--line); }
  .panel.open { transform: none; }
  .mobtabs { display: inline-flex; }
  .stage { padding: 10px; }
}
@media (max-width: 620px) {
  .bar { padding: 8px 10px; gap: 7px; }
  .logo span, .state span { display: none; }
  .btn { padding: 7px 10px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* marges de la secció (inspector) */
.padbox{display:flex;flex-direction:column;gap:8px;margin-top:6px}
.padrow{display:grid;grid-template-columns:64px 1fr auto;gap:8px;align-items:center}
.padrow label{font-size:12.5px;color:var(--muted)}
.padrow select{width:100%}.padrow input{width:78px}
/* idioma de l'editor (versió sense servidor: a la barra) */
.uilang-sel{width:auto!important;padding:6px 8px!important;font-size:12.5px}

/* logo de Relleu Digital: versió de text blau (clar) i de text blanc (fosc) */
.logo img.lg { height: 30px; width: auto; display: block; }
.logo img.dk { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo img.lt { display: none; }
  :root:not([data-theme="light"]) .logo img.dk { display: block; }
}
:root[data-theme="dark"] .logo img.lt { display: none; }
:root[data-theme="dark"] .logo img.dk { display: block; }

/* icona de la web (pestanya Dades) */
.favbox{display:flex;flex-direction:column;gap:10px}
.favtab{display:flex;align-items:center;gap:8px;max-width:260px;padding:8px 12px;background:var(--panel);border:1px solid var(--line);border-radius:10px 10px 0 0;font-size:12.5px}
.favico{width:16px;height:16px;flex:none;display:flex}
.favico img{width:16px;height:16px}
.favname{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.favx{color:var(--muted);font-size:11px}
.favsizes{display:flex;align-items:flex-end;gap:12px}
.favbtns{display:flex;gap:8px;flex-wrap:wrap}
.favbtns label.btn{cursor:pointer}

/* nova web: categories i etiqueta clàssica / moderna */
.tplcat{font-size:10.5px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);margin:8px 0 -2px}
.tplcat:first-child{margin-top:0}
.tpltag{display:inline-block;margin-left:8px;padding:2px 7px;border-radius:99px;font-size:10.5px;font-weight:600;background:var(--line-soft);color:var(--muted);vertical-align:1px}
.tpltag.mod{background:var(--accent-soft);color:var(--accent)}

/* avís de plantilla actualitzada (pestanya Webs) */
.tplnew{background:var(--accent-soft);border:1px solid var(--accent);border-radius:var(--r);padding:12px;font-size:13px;display:flex;flex-direction:column;gap:6px}
.tplnew p{margin:0;color:var(--muted);line-height:1.45}
.tplnewbtns{display:flex;flex-direction:column;gap:6px;margin-top:4px}
.tplnewbtns .btn{justify-content:center}
/* gestor d'imatges d'un mateix lloc */
.imgrow{display:flex;align-items:center;gap:8px;padding:6px;border:1px solid var(--line);border-radius:10px;margin-bottom:6px}
.imgrow img{width:64px;height:44px;object-fit:cover;border-radius:6px;flex:none}
.imgnum{font-size:12px;color:var(--muted);width:16px}
.imgrow .btn.sm{margin-left:auto}
/* ajustar una foto */
.adjprev{background:var(--panel);border:1px solid var(--line);border-radius:10px;overflow:hidden;display:flex;justify-content:center;margin-bottom:10px}
.adjprev img{max-width:100%;max-height:260px;object-fit:contain;display:block}
.adjrow{display:grid;grid-template-columns:78px 1fr 48px;gap:10px;align-items:center;margin-bottom:6px;font-size:13px}
.adjrow span{color:var(--muted);text-align:right;font-variant-numeric:tabular-nums}
.adjrow input[type=range]{width:100%}
.adjbtns{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}

/* barreta que surt en seleccionar text a la previsualització */
.lnkbar{position:fixed;z-index:90;display:none;gap:4px;padding:4px;border-radius:10px;
  background:var(--panel);border:1px solid var(--line);box-shadow:0 12px 30px -12px rgba(0,0,0,.45)}
.lnkbar button{border:0;background:transparent;color:var(--text);font:inherit;font-size:13px;
  font-weight:600;padding:6px 10px;border-radius:7px;cursor:pointer;white-space:nowrap}
.lnkbar button:hover{background:var(--line-soft)}

/* calendari de reserves: camp i finestra de connexió */
.connfield .connst { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.connfield .dot { width: 9px; height: 9px; border-radius: 99px; background: #1f9d55; flex: none; }
.connfield .dot.off { background: #c2410c; }
.connfield .btn { align-self: flex-start; }
.connmodal .seg2 { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.connmodal .seg2 label { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.connmodal .seg2 small { font-weight: 400; color: var(--muted); }
.connmodal .note { margin: 0 0 12px; }
.connmodal code { font-size: 12px; }
.connmodal .connlist { display: flex; flex-wrap: wrap; gap: 6px; }
.connmodal p.ok { color: #1f7a44; font-size: 13px; font-weight: 600; }
.connmodal p.err { color: #b42318; font-size: 13px; font-weight: 600; }
.connmodal .ra2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
