/* 前台可视化编辑器样式 —— 仅在 body.is-editing 或弹窗存在时生效，不影响正常访客 */

/* ---------- 编辑态元素 ---------- */
body.is-editing [contenteditable="true"].eb-item {
    outline: 1px dashed rgba(37, 99, 235, .55);
    outline-offset: 3px;
    cursor: text;
    border-radius: 2px;
    transition: outline-color .15s;
}
body.is-editing [contenteditable="true"].eb-item:hover,
body.is-editing [contenteditable="true"].eb-item:focus {
    outline: 2px solid #2563EB;
    background: rgba(37, 99, 235, .05);
}
body.is-editing a { cursor: pointer; }
body.is-editing img[data-img] { cursor: pointer; }

/* 背景图编辑浮标（hero 右下角） */
.eb-bg-btn {
    position: absolute;
    right: 14px; bottom: 14px;
    z-index: 30;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, .55);
    background: rgba(0, 0, 0, .45);
    color: #fff;
    cursor: pointer;
    display: none;
}
body.is-editing .eb-bg-btn { display: inline-block; }
.eb-bg-btn:hover { background: #2563EB; border-color: #2563EB; }

/* ---------- 顶部工具条 ---------- */
.eb-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 99990;
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    background: #111827;
    color: #fff;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
}
body.is-editing .eb-bar { display: flex; }
.eb-bar .eb-bar-title { font-weight: 600; letter-spacing: 1px; }
.eb-bar .eb-bar-user { color: #9CA3AF; font-size: 13px; }
.eb-bar .eb-bar-tip { color: #FBBF24; font-size: 13px; margin-left: auto; }
.eb-bar .eb-btn {
    padding: 7px 18px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, .35);
    background: transparent;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}
.eb-bar .eb-btn-primary { background: #2563EB; border-color: #2563EB; font-weight: 600; }
.eb-bar .eb-btn-primary:hover { background: #1D4ED8; }
.eb-bar .eb-btn:hover { border-color: #fff; }
body.eb-has-changes .eb-bar-tip { display: inline; }
body:not(.eb-has-changes) .eb-bar-tip { display: none; }

body.is-editing { padding-top: 54px; }
body.is-editing .site-header { top: 54px; }

/* ---------- 遮罩 + 面板 ---------- */
.eb-mask {
    position: fixed;
    inset: 0;
    z-index: 99995;
    background: rgba(15, 23, 42, .55);
    display: none;
    align-items: center;
    justify-content: center;
}
.eb-mask.eb-open { display: flex; }
.eb-panel {
    width: min(420px, calc(100vw - 40px));
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
.eb-panel h3 {
    margin: 0 0 6px;
    font-size: 18px;
    color: #111827;
}
.eb-panel .eb-sub {
    margin: 0 0 18px;
    font-size: 13px;
    color: #6B7280;
    line-height: 1.6;
}
.eb-field { margin-bottom: 14px; }
.eb-field label {
    display: block;
    font-size: 13px;
    color: #374151;
    margin-bottom: 6px;
    font-weight: 600;
}
.eb-field input[type="text"],
.eb-field input[type="password"],
.eb-field input[type="url"] {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 14px;
}
.eb-field input:focus { outline: none; border-color: #2563EB; }
.eb-field input[type="file"] { font-size: 13px; }
.eb-panel-foot {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}
.eb-panel-foot button {
    padding: 9px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid #D1D5DB;
    background: #fff;
    color: #374151;
}
.eb-panel-foot .eb-btn-primary {
    background: #2563EB;
    border-color: #2563EB;
    color: #fff;
    font-weight: 600;
}
.eb-panel-foot .eb-btn-primary:hover { background: #1D4ED8; }
.eb-error {
    display: none;
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #B91C1C;
    font-size: 13px;
}
.eb-error.eb-show { display: block; }

/* 图片预览 */
.eb-img-preview {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #E5E7EB;
    margin-bottom: 12px;
    background: #F3F4F6;
    display: block;
}

/* ---------- Toast ---------- */
.eb-toast {
    position: fixed;
    bottom: 28px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 99999;
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 14px;
    color: #fff;
    background: #111827;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
    opacity: 0;
    pointer-events: none;
    transition: all .25s;
}
.eb-toast.eb-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.eb-toast.eb-success { background: #059669; }
.eb-toast.eb-error { background: #DC2626; }
