/**
 * Frontend CSS
 */
.sgf-widget-container {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 24px;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    max-width: 100%;
}

.sgf-widget-header { margin-bottom: 20px; border-bottom: 1px solid #f3f4f6; padding-bottom: 12px; }
.sgf-title { font-size: 24px; font-weight: 700; color: #111827; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

/* 前台高颜值标签模块 */
.sgf-frontend-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.sgf-tag {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px; /* 胶囊圆角 */
    line-height: 1.2;
}

/* 语言标签 - 蓝色系 */
.sgf-tag-lang { background-color: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
/* 授权标签 - 绿色系 */
.sgf-tag-license { background-color: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
/* 格式标签 - 紫色系 */
.sgf-tag-fmt { background-color: #f3e8ff; color: #6b21a8; border: 1px solid #e9d5ff; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

.sgf-live-input {
    width: 100%;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 16px;
    min-height: 90px;
    margin-bottom: 10px; /* 减小间距给提示框腾出空间 */
    resize: vertical;
    transition: border-color 0.2s;
    outline: none;
    box-sizing: border-box;
}
.sgf-live-input:focus { border-color: #3b82f6; }

/* 核心修改：输入提示框样式 */
.sgf-input-notice {
    display: none; /* 默认隐藏 */
    font-size: 13px;
    margin-bottom: 20px;
    padding: 8px 12px;
    border-radius: 6px;
    line-height: 1.4;
}
.sgf-input-notice[data-type="warn"] {
    background-color: #fff7ed;
    color: #c2410c;
    border: 1px solid #ffedd5;
}
.sgf-input-notice[data-type="info"] {
    background-color: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #dbeafe;
}

.sgf-toolbar { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-end; margin-bottom: 24px; }
.sgf-tool-group label { display: block; font-size: 13px; font-weight: 600; color: #4b5563; margin-bottom: 8px; }

/* 自定义滑块 UI */
.sgf-slider-group { flex: 1; min-width: 150px; }
.sgf-size-slider {
    -webkit-appearance: none; width: 100%; height: 6px; background: #e5e7eb; border-radius: 5px; outline: none; margin: 10px 0;
}
.sgf-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #3b82f6; cursor: pointer; border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.2); transition: transform 0.1s;
}
.sgf-size-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.sgf-size-val { float: right; color: #3b82f6; }

/* 配色 */
.sgf-theme-presets { display: flex; gap: 10px; }
.sgf-theme-pill {
    width: 32px; height: 32px; border-radius: 50%; border: 2px solid #e5e7eb; cursor: pointer; transition: transform 0.1s; padding: 0;
}
.sgf-theme-pill:hover { transform: scale(1.1); border-color: #9ca3af; }

.sgf-color-picker-wrap {
    position: relative; width: 32px; height: 32px; border-radius: 50%; border: 2px solid #e5e7eb; overflow: hidden; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.sgf-color-picker-wrap input[type="color"] {
    position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; padding: 0; margin: 0; border: none; cursor: pointer; background: transparent;
}

/* 预览区域 */
.sgf-preview-area {
    position: relative;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    min-height: 240px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    padding: 10px;
}
.sgf-preview-img { max-width: 100%; height: auto; display: block; opacity: 1; transition: opacity 0.2s; border-radius: 4px; }
.sgf-preview-area.is-loading .sgf-preview-img { opacity: 0.5; }

/* Loader */
.sgf-loader {
    position: absolute; top: 50%; left: 50%; margin-left: -18px; margin-top: -18px; width: 36px; height: 36px;
    border: 4px solid rgba(0,0,0,0.1); border-top-color: #3b82f6; border-radius: 50%; animation: sgf-spin 1s infinite linear; display: none; z-index: 10;
}
.sgf-preview-area.is-loading .sgf-loader { display: block; }
@keyframes sgf-spin { to { transform: rotate(360deg); } }

.sgf-fallback-msg { padding: 40px; color: #ef4444; font-weight: bold; display: none; text-align: center; width: 100%; }
.sgf-error { color: red; border: 1px solid red; padding: 10px; border-radius: 4px; background: #fff1f1; }