/**
 * CMS styles (agent: cms). Loaded on storefront AND admin.
 * Storefront rules are scoped under body.cms-editing so normal mode is untouched.
 * Admin rules are scoped under .cms-website (Managing Website section wrapper).
 */

/* ================= Storefront edit mode (inside iframe) ================= */
body.cms-editing .cms-block {
  cursor: text;
  outline: 2px dashed transparent;
  outline-offset: 2px;
  transition: outline-color .12s ease;
}
body.cms-editing .cms-block:hover {
  outline: 2px dashed #19c3d4;
}
body.cms-editing .cms-block.cms-block-editing {
  outline: 2px solid #ff2f92;
  background: #fff;
  color: #191919;
  min-width: 1ch;
}
body.cms-editing .cms-block.cms-block-editing:focus { outline: 2px solid #ff2f92; }
body.cms-editing .cms-block.cms-block-saving { opacity: .65; }
body.cms-editing .cms-block.cms-block-saved {
  animation: cmsSavedFlash 1s ease;
}
@keyframes cmsSavedFlash {
  0%   { outline: 3px solid #2fbf71; outline-offset: 2px; box-shadow: 0 0 0 6px rgba(47,191,113,.25); }
  70%  { outline: 3px solid #2fbf71; outline-offset: 2px; box-shadow: 0 0 0 6px rgba(47,191,113,0); }
  100% { outline: 2px dashed transparent; box-shadow: none; }
}

/* Top hint bar */
.cms-edit-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 9px 16px;
  background: #ff2f92;
  color: #fff;
  font: 600 .82rem/1.35 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  box-shadow: 0 4px 14px rgba(25,20,18,.18);
}
.cms-edit-bar.error { background: #b84545; }
.cms-edit-bar-text { flex: 1 1 auto; min-width: 0; }
.cms-edit-bar-msg { font-weight: 800; }
.cms-edit-bar-msg:empty { display: none; }
.cms-edit-bar-exit {
  color: #fff;
  font-weight: 800;
  text-decoration: underline;
  padding: 3px 10px;
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 999px;
  white-space: nowrap;
}
.cms-edit-bar-exit:hover { background: rgba(255,255,255,.16); }

/* ================= Admin: Managing Website section ================= */
.cms-website .cms-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.cms-website .cms-page-label {
  font-weight: 800;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--a-muted, #6d6d70);
}
.cms-website .cms-page-select {
  padding: 9px 12px;
  border: 1px solid var(--a-line, #e4e1dd);
  border-radius: 11px;
  background: #fff;
  font: inherit;
  font-weight: 650;
  min-width: 160px;
}
.cms-website .cms-hint { margin: 10px 0 0; font-size: .85rem; }
.cms-website .cms-toolbar-panel { margin-bottom: 14px; }

.cms-website .cms-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}
.cms-website .cms-frame-wrap { min-width: 0; }
.cms-website .cms-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 260px);
  min-height: 480px;
  border: 1px solid var(--a-line, #e4e1dd);
  border-radius: 14px;
  background: #fff;
}
.cms-website .cms-recent-list { display: grid; gap: 10px; }
.cms-website .cms-empty { font-size: .85rem; }
.cms-website .cms-edit-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--a-line, #e4e1dd);
}
.cms-website .cms-edit-row:last-child { border-bottom: 0; }
.cms-website .cms-edit-info { flex: 1 1 auto; min-width: 0; }
.cms-website .cms-edit-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.cms-website .cms-edit-key {
  font-size: .76rem;
  font-weight: 700;
  background: #f6f4f1;
  border: 1px solid var(--a-line, #e4e1dd);
  border-radius: 6px;
  padding: 1px 6px;
  word-break: break-all;
}
.cms-website .cms-edit-page {
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #b54865;
  background: rgba(181,72,101,.08);
  border-radius: 999px;
  padding: 2px 8px;
}
.cms-website .cms-edit-excerpt {
  font-size: .84rem;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.cms-website .cms-edit-meta { font-size: .72rem; margin-top: 3px; }
.cms-website .cms-reset-btn { flex: 0 0 auto; }

/* Wide screens: recent edits sit beside the preview. */
@media (min-width: 1200px) {
  .cms-website .cms-layout { grid-template-columns: minmax(0, 1fr) 330px; }
  .cms-website .cms-recent {
    max-height: calc(100vh - 260px);
    min-height: 480px;
    overflow: auto;
  }
}
/* Mobile (375px): toolbar wraps, iframe full width, recent edits below. */
@media (max-width: 640px) {
  .cms-website .cms-page-select { flex: 1 1 100%; }
  .cms-website .cms-frame { height: 70vh; min-height: 420px; }
}
