/* ============================================================
 * SVG 模板图片替换面板样式
 * 独立模块，随 index.php 引入；不影响其它页面
 * ============================================================ */

/* 编辑区 iframe 内浮动的“换图”按钮由 JS 注入，样式内联，这里不写 */

/* 遮罩层 */
#svgReplaceOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
}
#svgReplaceOverlay.show { display: flex; }

/* 面板主体 */
#svgReplacePanel {
    width: 860px;
    max-width: 94vw;
    max-height: 88vh;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, .28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: svgReplacePop .18s ease;
}
@keyframes svgReplacePop {
    from { transform: translateY(14px) scale(.98); opacity: 0; }
    to   { transform: translateY(0)    scale(1);   opacity: 1; }
}

/* 头部 */
.svg-rp-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eef0f3;
    background: linear-gradient(90deg, #f6d365 0%, #fda085 100%);
}
.svg-rp-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #4a2b00;
    display: flex;
    align-items: center;
    gap: 8px;
}
.svg-rp-close {
    border: none;
    background: rgba(255, 255, 255, .35);
    color: #4a2b00;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s;
}
.svg-rp-close:hover { background: rgba(255, 255, 255, .7); }

/* 主体两栏 */
.svg-rp-body {
    display: flex;
    gap: 0;
    flex: 1;
    min-height: 0;
}

/* 左侧：图片清单 */
.svg-rp-list {
    width: 420px;
    max-width: 50%;
    padding: 16px;
    overflow-y: auto;
    border-right: 1px solid #eef0f3;
}
.svg-rp-list-title {
    font-size: 13px;
    color: #8a8f99;
    margin: 0 0 12px;
}
.svg-rp-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid #eef0f3;
    border-radius: 10px;
    margin-bottom: 12px;
    background: #fbfcfd;
}
.svg-rp-thumb {
    width: 74px;
    height: 74px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    flex-shrink: 0;
    border: 1px solid #e6e8ec;
    background-color: #f0f2f5;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.svg-rp-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.svg-rp-thumb.svg-thumb-error::before {
    content: "🖼";
    font-size: 22px;
    opacity: .35;
}
.svg-rp-item-main { flex: 1; min-width: 0; }
.svg-rp-item-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}
.svg-rp-item-label .warn {
    font-weight: 400;
    color: #e6853f;
    font-size: 12px;
    margin-left: 6px;
}
.svg-rp-btn-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.svg-rp-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: linear-gradient(90deg, #fda085, #f6d365);
    color: #4a2b00;
    font-weight: 600;
    transition: filter .15s;
}
.svg-rp-upload-btn:hover { filter: brightness(1.05); }
.svg-rp-upload-btn.loading { opacity: .6; pointer-events: none; }
.svg-rp-fit {
    font-size: 12px;
    padding: 5px 6px;
    border: 1px solid #d8dbe0;
    border-radius: 6px;
    color: #444;
    background: #fff;
    cursor: pointer;
}
.svg-rp-url {
    width: 100%;
    margin-top: 8px;
    font-size: 12px;
    padding: 6px 8px;
    border: 1px solid #e2e5ea;
    border-radius: 6px;
    color: #666;
    box-sizing: border-box;
}

/* 右侧：实时预览 */
.svg-rp-preview {
    flex: 1;
    padding: 16px;
    overflow: auto;
    background: #f4f5f7;
    display: flex;
    flex-direction: column;
}
.svg-rp-preview-title {
    font-size: 13px;
    color: #8a8f99;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.svg-rp-replay {
    border: 1px solid #d8dbe0;
    background: #fff;
    color: #555;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
}
.svg-rp-replay:hover { background: #f0f2f5; }
.svg-rp-preview-stage {
    flex: 1;
    background: #fff;
    border-radius: 10px;
    padding: 14px;
    border: 1px solid #e6e8ec;
    overflow: auto;
    display: flex;
    justify-content: center;
}
.svg-rp-preview-stage > * {
    max-width: 100%;
}

/* 底部按钮 */
.svg-rp-foot {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid #eef0f3;
    background: #fff;
}
.svg-rp-cancel, .svg-rp-confirm {
    padding: 9px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}
.svg-rp-cancel {
    background: #f0f2f5;
    color: #555;
}
.svg-rp-cancel:hover { background: #e6e8ec; }
.svg-rp-confirm {
    background: linear-gradient(90deg, #fda085, #f6d365);
    color: #4a2b00;
}
.svg-rp-confirm:hover { filter: brightness(1.05); }

/* 响应式 */
@media (max-width: 720px) {
    .svg-rp-body { flex-direction: column; }
    .svg-rp-list { width: 100%; max-width: 100%; border-right: none; border-bottom: 1px solid #eef0f3; }
}
