/* Page blocks (rendu public) */
.pb-hero { margin: 0 0 28px; }
.pb-hero.has-img { display: grid; gap: 16px; }
.pb-hero-media img { width: 100%; max-height: 280px; object-fit: cover; border-radius: 16px; display: block; }
.pb-hero-title { font-size: 1.75rem; margin: 0 0 8px; letter-spacing: -.02em; }
.pb-hero-lead { color: var(--muted); margin: 0 0 16px; max-width: 40rem; line-height: 1.5; }

.pb-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin: 0 0 28px;
}
.pb-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px;
  overflow: hidden;
}
.pb-card-media { margin: -16px -16px 12px; }
.pb-card-media img { width: 100%; height: 120px; object-fit: cover; display: block; }
.pb-card-icon { font-size: 1.4rem; margin-bottom: 8px; }
.pb-card h3 { margin: 0 0 6px; font-size: 1rem; }
.pb-card p { margin: 0; font-size: .86rem; color: var(--muted); line-height: 1.45; }

.pb-cta {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, #fff), #fff);
  border: 1px solid var(--border); border-radius: 16px; padding: 22px; margin: 0 0 28px;
}
.pb-cta.has-img { display: grid; grid-template-columns: 140px 1fr; gap: 16px; align-items: center; }
.pb-cta-media img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; display: block; }
.pb-cta h2 { margin: 0 0 6px; font-size: 1.2rem; }
.pb-cta p { margin: 0 0 14px; color: var(--muted); }

.pb-notice {
  padding: 11px 14px; border-radius: 12px; margin: 0 0 16px; font-size: .88rem; font-weight: 500;
  border: 1px solid var(--border); background: #f8fafc;
}
.pb-notice-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.pb-notice-warn { background: #fff7ed; border-color: #fdba74; color: #9a3412; }
.pb-notice-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.pb-split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: center;
  margin: 0 0 28px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 18px;
}
.pb-split-left { direction: rtl; }
.pb-split-left > * { direction: ltr; }
.pb-split h2 { margin: 0 0 8px; }
.pb-split p { color: var(--muted); line-height: 1.5; }
.pb-split-media img, .pb-image img { width: 100%; border-radius: 12px; display: block; }
.pb-image-ph {
  aspect-ratio: 4/3; border-radius: 12px; background: #eef2f7; display: grid; place-items: center;
  color: var(--muted); font-weight: 700;
}
.pb-image { margin: 0 0 28px; }
.pb-image figcaption { font-size: .8rem; color: var(--muted); margin-top: 6px; }

.pb-kpis { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 20px; }
.pb-kpi {
  min-width: 90px; padding: 10px 14px; border-radius: 12px; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
}
.pb-kpi strong { display: block; font-size: 1.1rem; }
.pb-kpi small { font-size: .65rem; text-transform: uppercase; color: var(--muted); font-weight: 700; }

.pb-richtext { margin: 0 0 20px; line-height: 1.55; color: var(--ink); }

@media (max-width: 720px) {
  .pb-split { grid-template-columns: 1fr; }
  .pb-split-left { direction: ltr; }
  .pb-cta.has-img { grid-template-columns: 1fr; }
}

/* Page editor */
.pe-bar {
  position: sticky; top: 0; z-index: 80; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; background: #0f172a; color: #e2e8f0; border-radius: 0 0 14px 14px;
  margin: -32px -22px 20px; box-shadow: 0 8px 24px rgba(15,23,42,.2);
}
.pe-bar .ttl { font-weight: 800; font-size: .92rem; }
.pe-bar .spacer { flex: 1; }
.pe-bar select {
  background: #1e293b; color: #e2e8f0; border: 1px solid #334155; border-radius: 8px;
  padding: 7px 10px; font: inherit; font-size: .8rem;
}
.pe-bar button, .pe-bar a.b {
  border: none; cursor: pointer; padding: 8px 14px; border-radius: 8px; font: inherit;
  font-size: .74rem; font-weight: 700; text-decoration: none; color: inherit;
}
.pe-bar .save { background: #0d8a7c; color: #fff; }
.pe-bar .add { background: #fff; color: #0f172a; }
.pe-bar .ghost { background: transparent; border: 1px solid #475569; color: #cbd5e1; }
.pe-bar .status { font-size: .78rem; color: #94a3b8; min-width: 140px; }

.pe-frame {
  position: relative; margin-bottom: 14px; border: 1px dashed transparent; border-radius: 14px;
  transition: outline .15s, border-color .15s; background: var(--surface); border: 1px solid var(--border);
  padding: 14px;
}
.pe-frame:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.pe-frame.hidden-block { opacity: .45; }
.pe-frame.dragging { opacity: .5; }
.pe-tools {
  position: absolute; top: 8px; right: 8px; z-index: 5; display: flex; gap: 3px;
  background: rgba(15,23,42,.92); border-radius: 8px; padding: 3px; opacity: 0; transition: opacity .15s;
}
.pe-frame:hover .pe-tools { opacity: 1; }
.pe-tools button {
  border: none; background: transparent; color: #fff; cursor: pointer;
  font-size: .85rem; padding: 4px 7px; border-radius: 5px;
}
.pe-tools button:hover { background: rgba(255,255,255,.15); }
.pe-tools .tag {
  color: #94a3b8; font-size: .62rem; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 7px; align-self: center;
}
.pe-edit {
  outline: none; cursor: text; border-radius: 4px; min-width: 24px;
  transition: background .12s;
}
.pe-edit:hover { background: rgba(59,91,219,.08); }
.pe-edit:focus { background: rgba(59,91,219,.12); box-shadow: 0 0 0 2px rgba(59,91,219,.25); }
.pe-edit:empty::before { content: attr(data-ph); color: var(--muted); opacity: .65; }

.pe-itemctl { display: flex; gap: 4px; justify-content: center; padding: 6px 0; }
.pe-itemctl button, .pe-additem button {
  border: 1px solid var(--border); background: #fff; cursor: pointer; border-radius: 6px;
  padding: 4px 9px; font-size: .78rem;
}
.pe-additem { margin-top: 8px; }
.pe-additem button {
  border-style: dashed; color: var(--accent); width: 100%; padding: 8px;
}

.pe-modal {
  position: fixed; inset: 0; z-index: 200; background: rgba(15,23,42,.5);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.pe-modal.open { display: flex; }
.pe-modal .box {
  background: var(--surface); border-radius: 14px; max-width: 560px; width: 100%;
  max-height: 80vh; overflow: auto; padding: 20px;
}
.pe-modal h3 { margin: 0 0 14px; }
.pe-typelist { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.pe-typelist button {
  border: 1px solid var(--border); background: #fff; cursor: pointer; border-radius: 10px;
  padding: 14px 10px; font-size: .82rem; text-align: center;
}
.pe-typelist button:hover { border-color: var(--accent); }
.pe-modal .row { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; flex-wrap: wrap; }
.pe-modal .row button {
  border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 8px 14px; cursor: pointer;
}

.pe-img-slot {
  position: relative; margin: 10px 0; border-radius: 12px; overflow: hidden;
  border: 1px dashed var(--border); background: #f8fafc; min-height: 100px;
  display: grid; place-items: center;
}
.pe-img-slot img { width: 100%; max-height: 180px; object-fit: contain; display: block; background: #fff; }
.pe-img-slot .ph { color: var(--muted); font-size: .82rem; font-weight: 600; padding: 24px; }
.pe-img-slot .pe-imgbtn {
  position: absolute; top: 8px; left: 8px; z-index: 2; border: none; cursor: pointer;
  background: rgba(15,23,42,.88); color: #fff; padding: 7px 12px; border-radius: 8px; font-size: .72rem; font-weight: 700;
}
.pe-img-slot .pe-imgbtn:hover { background: var(--accent); }

.pe-img-upload { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.pe-upload-btn {
  display: inline-flex; align-items: center; padding: 9px 14px; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: .82rem; cursor: pointer;
}
.pe-img-url-row { display: flex; gap: 8px; margin-bottom: 14px; }
.pe-img-url-row input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; font: inherit; font-size: .84rem;
}
.pe-img-url-row button {
  border: 1px solid var(--border); background: #fff; border-radius: 9px; padding: 9px 12px;
  font-weight: 700; font-size: .78rem; cursor: pointer; white-space: nowrap;
}
.pe-img-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px;
  max-height: 320px; overflow: auto; margin-bottom: 4px;
}
.pe-img-grid .pick {
  cursor: pointer; border: 2px solid transparent; border-radius: 10px; overflow: hidden;
  background: #f1f5f9; aspect-ratio: 1; position: relative;
}
.pe-img-grid .pick:hover { border-color: var(--accent); }
.pe-img-grid .pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pe-img-grid .pick .del {
  position: absolute; top: 4px; right: 4px; border: none; background: rgba(0,0,0,.65); color: #fff;
  border-radius: 6px; width: 24px; height: 24px; cursor: pointer; font-size: .7rem; display: none;
}
.pe-img-grid .pick:hover .del { display: grid; place-items: center; }
.pe-img-grid .empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 24px; font-size: .86rem; }

body.page-editor .app-main { max-width: 960px; }
