* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }

body {
    background: #ECE9E1;
    color: #17140F;
}

a { color: #D34B24; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    flex-wrap: wrap;
    gap: 12px;
    background: #fff;
    border-bottom: 1px solid rgba(23,20,15,.08);
    position: relative;
    z-index: 30;
}

.topbar h1 { font-size: 18px; }
.topbar .sub { font-size: 12px; opacity: .6; margin-top: 2px; }

.topbar__sections { display: flex; gap: 8px; flex-wrap: wrap; }
.topbar__sections button {
    background: #fff;
    border: 1px solid rgba(23,20,15,.15);
    color: #17140F;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-transform: capitalize;
    cursor: pointer;
}
.topbar__sections button:hover { border-color: #D34B24; color: #D34B24; }

.btn {
    display: inline-block;
    background: #D34B24;
    color: #fff !important;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
}

.btn.secondary {
    background: transparent;
    color: #17140F !important;
    border: 1px solid rgba(23,20,15,.2);
}

.actions { display: flex; gap: 8px; align-items: center; }

.empty { padding: 40px; text-align: center; opacity: .6; background: #fff; border-radius: 12px; }

/* ---- Full-bleed live page + slide-in section sidebar ---- */
/* The editor no longer shows a shrunk-down preview pane next to a form —
   the real page fills the screen and clicking a section on it (matched to
   a content.json key by class name, see admin.js wireIframeSections())
   opens a sidebar with just that section's fields. */

.editor-live {
    position: fixed;
    top: 61px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #17140F;
}

.editor-live iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #fff;
}

.editor-sidebar {
    position: fixed;
    top: 61px;
    right: 0;
    bottom: 0;
    width: min(440px, 100vw);
    background: #ECE9E1;
    box-shadow: -8px 0 30px rgba(0,0,0,.15);
    transform: translateX(100%);
    transition: transform .25s ease;
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.editor-sidebar.is-open { transform: translateX(0); }

.editor-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    background: #fff;
    border-bottom: 1px solid rgba(23,20,15,.08);
}

.editor-sidebar__header h2 { font-size: 17px; text-transform: capitalize; }

.editor-sidebar__close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    opacity: .5;
    cursor: pointer;
    padding: 4px 8px;
}
.editor-sidebar__close:hover { opacity: 1; }

.editor-sidebar__body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px 60px;
}

.saved-msg { color: #1BA84A; font-weight: 600; font-size: 13px; }
.error-msg { color: #D34B24; font-weight: 600; font-size: 13px; }

.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    opacity: .55;
    margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="url"],
.field input[type="email"],
.field textarea,
.field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(23,20,15,.15);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.field textarea { resize: vertical; min-height: 60px; }

.field-color { display: flex; align-items: center; gap: 10px; }
.field-color input[type="color"] {
    width: 44px;
    height: 38px;
    border: 1px solid rgba(23,20,15,.15);
    border-radius: 8px;
    padding: 2px;
    background: #fff;
    cursor: pointer;
}
.field-color input[type="text"] { flex: 1; font-family: monospace; }

.field-image img {
    display: block;
    max-width: 220px;
    max-height: 140px;
    object-fit: cover;
    border-radius: 8px;
    margin-top: 8px;
    background: rgba(23,20,15,.05);
}
.field-image .upload-row { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.field-image input[type="file"] { font-size: 13px; }
.field-image .upload-status { font-size: 12px; opacity: .6; }

/* ---- Repeaters (arrays) ---- */

.repeater { border-left: 2px solid rgba(211,75,36,.25); padding-left: 16px; margin-bottom: 10px; }

.repeater__item {
    background: #FFFDF5;
    border: 1px solid rgba(23,20,15,.08);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
    position: relative;
}

.remove-btn {
    background: none;
    border: none;
    color: #D34B24;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    opacity: .7;
}
.remove-btn:hover { opacity: 1; }

.repeater__item .remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
}

.repeater__add {
    background: none;
    border: 1px dashed rgba(23,20,15,.3);
    color: #17140F;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.repeater__add:hover { border-color: #D34B24; color: #D34B24; }

.repeater-string-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.repeater-string-row input[type="text"] {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid rgba(23,20,15,.15);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}
.repeater-string-row .remove-btn { position: static; }

/* A row whose input is labeled with its table-column header (e.g. a
   schedule cell labeled with its day) stacks label-above-input like a
   regular .field, so the remove button needs to anchor to the input's
   baseline instead of the row's vertical center. */
.repeater-string-row--labeled { align-items: flex-end; }
.repeater-string-row__field.field { flex: 1; margin-bottom: 0; }

/* ---- Narrow viewports: sidebar takes the full screen instead of a side panel ---- */
@media (max-width: 700px) {
    .topbar { padding: 10px 14px; }
    .topbar h1 { font-size: 16px; }
    .topbar__sections button { padding: 7px 11px; font-size: 12px; }
    .editor-sidebar { width: 100vw; }
}
