/* ==========================================================================
   插件界面统一层 · plugin-polish.css
   --------------------------------------------------------------------------
   目标：把「个性尾巴」(art_signature) 与「风信子·改名」(fxz_rename) 两个插件
   在会员中心里的页面，统一到全站现行的视觉语言：
     · 方正直角（square.css 已全局处理，这里不再写 radius）
     · 青蓝品牌色 + 轻边框 + 无阴影、无渐变横幅
     · 字号/间距与「拓展 → 背景设置」等既有页面一致
     · 颜色全部走 --mjj-* 令牌，浅色/深色自动成立

   为什么全部带 !important：
     两个插件把样式写在页面内的 <style> 块里（正文中、位置在 head 之后），
     同等特异性下永远后加载者胜出，所以必须用 html body / html[data-theme]
     前缀提高特异性，并逐条 !important 覆盖。
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 共用按钮基元（保存 / 免费修改）
   -------------------------------------------------------------------------- */
html body .signature-card .btn-submit,
html body .rename-page .ren-submit {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: auto !important;
    min-width: 112px !important;
    height: 34px !important;
    padding: 0 18px !important;
    border: 1px solid #0f7fb8 !important;
    background: #0f7fb8 !important;
    background-image: none !important;
    color: #fff !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    line-height: 32px !important;
    letter-spacing: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    transition: background-color .15s ease, border-color .15s ease !important;
}

html body .signature-card .btn-submit:hover,
html body .rename-page .ren-submit:hover,
html body .signature-card .btn-submit:focus,
html body .rename-page .ren-submit:focus {
    background: #0c6fa2 !important;
    border-color: #0c6fa2 !important;
    color: #fff !important;
    box-shadow: none !important;
    transform: none !important;
}

html[data-theme="dark"] .signature-card .btn-submit,
html[data-theme="dark"] .rename-page .ren-submit {
    background: #1d6fb8 !important;
    border-color: #1d6fb8 !important;
    color: #fff !important;
}

html[data-theme="dark"] .signature-card .btn-submit:hover,
html[data-theme="dark"] .rename-page .ren-submit:hover,
html[data-theme="dark"] .signature-card .btn-submit:focus,
html[data-theme="dark"] .rename-page .ren-submit:focus {
    background: #2580cc !important;
    border-color: #2580cc !important;
}

/* ==========================================================================
   2. 个性尾巴 /my-signature.htm
   ========================================================================== */

/* 2.1 卡片外壳：去掉投影与圆角带来的“悬浮感”，改成与会员中心一致的平面卡 */
html body .signature-card {
    padding: 0 !important;
    background: var(--mjj-surface) !important;
    border: 1px solid var(--mjj-border) !important;
    box-shadow: none !important;
    overflow: visible !important;
    margin-bottom: 14px !important;
}

html body .signature-card::before {
    content: none !important;
    display: none !important;
}

/* 2.2 卡片标题栏 */
html body .signature-card__header {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 13px 16px !important;
    margin: 0 !important;
    border-bottom: 1px solid var(--mjj-border) !important;
}

html body .signature-card__icon {
    width: 28px !important;
    height: 28px !important;
    border: 1px solid var(--mjj-border) !important;
    background: var(--mjj-surface-3) !important;
    color: var(--mjj-brand) !important;
    font-size: 14px !important;
    flex-shrink: 0 !important;
}

html body .signature-card__title {
    margin: 0 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    color: var(--mjj-text-strong) !important;
    letter-spacing: 0 !important;
}

html body .signature-card__content {
    padding: 14px 16px 16px !important;
}

/* 2.3 编辑器区域：拆掉灰底套盒，让内容和卡片同层 */
html body .signature-card .editor-wrap {
    padding: 0 !important;
    margin-bottom: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

html body .signature-card .editor-hint {
    align-items: center !important;
    gap: 8px !important;
    padding: 9px 12px !important;
    margin-bottom: 12px !important;
    background: var(--mjj-surface-2) !important;
    border: 1px solid var(--mjj-border) !important;
    border-left: 2px solid var(--mjj-brand) !important;
    color: var(--mjj-text-muted) !important;
    font-size: 12.5px !important;
    line-height: 1.7 !important;
}

html body .signature-card .editor-hint i {
    color: var(--mjj-brand) !important;
    margin-top: 0 !important;
}

/* 2.4 表单行改网格：标签在左、计数在右、按钮/输入各占一行 */
html body .signature-card .form-group.position-relative {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    grid-template-areas:
        "label   counter"
        "actions actions"
        "input   input" !important;
    align-items: center !important;
    gap: 6px 10px !important;
    margin-bottom: 0 !important;
}

html body .signature-card .form-label {
    grid-area: label;
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin: 0 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--mjj-text-strong) !important;
}

html body .signature-card .form-label .text-muted {
    font-size: 12px !important;
    font-weight: 400 !important;
    color: var(--mjj-text-muted) !important;
}

/* 会员才有的「插入超链接」按钮：与站点次级按钮同规格 */
html body .signature-card .action-bar {
    grid-area: actions;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin: 0 0 2px !important;
    padding: 0 !important;
}

/* 非会员没有按钮时整行让位给输入框 */
html body .signature-card .action-bar:not(:has(.btn-insert)) {
    display: none !important;
}

html body .signature-card .action-bar .text-muted {
    display: none !important;
}

html body .signature-card .btn-insert {
    height: 30px !important;
    padding: 0 12px !important;
    background: var(--mjj-surface) !important;
    border: 1px solid var(--mjj-border) !important;
    color: var(--mjj-text) !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}

html body .signature-card .btn-insert:hover {
    background: var(--mjj-surface-3) !important;
    border-color: var(--mjj-brand) !important;
    color: var(--mjj-brand) !important;
}

/* 输入框 */
html body .signature-card textarea.form-control {
    grid-area: input;
    width: 100% !important;
    min-height: 132px !important;
    padding: 10px 12px !important;
    background: var(--mjj-surface) !important;
    border: 1px solid var(--mjj-border) !important;
    color: var(--mjj-text) !important;
    font-size: 13.5px !important;
    line-height: 1.8 !important;
    box-shadow: none !important;
    resize: vertical !important;
}

html body .signature-card textarea.form-control:focus {
    border-color: var(--mjj-brand) !important;
    box-shadow: none !important;
    outline: 0 !important;
}

/* 字数计数：从输入框里飘着的黑色胶囊，改成右上角的灰色小字 */
html body .signature-card .char-count {
    grid-area: counter;
    position: static !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    color: var(--mjj-text-muted) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    font-variant-numeric: tabular-nums;
    text-align: right !important;
    white-space: nowrap;
}

/* 超限反馈（配合 plugin-ui.js 加上的 .is-over） */
html body .signature-card textarea.form-control.is-over {
    border-color: #d9534f !important;
}

html body .signature-card .char-count.is-over {
    color: #d9534f !important;
}

/* 2.5 预览区：虚线框 → 平铺面板 */
html body .signature-card .signature-preview {
    margin-top: 12px !important;
    padding: 10px 12px 12px !important;
    background: var(--mjj-surface-2) !important;
    border: 1px solid var(--mjj-border) !important;
}

html body .signature-card .signature-preview > .d-flex {
    align-items: center !important;
    margin-bottom: 8px !important;
}

html body .signature-card .signature-preview strong {
    font-size: 12.5px !important;
    font-weight: 600 !important;
    color: var(--mjj-text-muted) !important;
}

html body .signature-card #refresh-preview {
    height: 26px !important;
    padding: 0 10px !important;
    background: transparent !important;
    border: 1px solid var(--mjj-border) !important;
    color: var(--mjj-text-muted) !important;
    font-size: 12px !important;
    line-height: 24px !important;
}

html body .signature-card #refresh-preview:hover {
    background: var(--mjj-surface-3) !important;
    border-color: var(--mjj-brand) !important;
    color: var(--mjj-brand) !important;
}

html body .signature-card #preview-content {
    min-height: 48px !important;
    padding: 10px 12px !important;
    background: var(--mjj-surface) !important;
    border: 1px solid var(--mjj-border) !important;
    color: var(--mjj-text) !important;
    font-size: 13.5px !important;
    line-height: 1.8 !important;
}

/* 2.6 底部操作条：右对齐的常规按钮，不再是整条大蓝条 */
html body .signature-card .signature-card__content > form {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
}

html body .signature-card .signature-card__content > form > br {
    display: none !important;
}

html body .signature-card .signature-card__content > form > .btn-submit {
    align-self: flex-end !important;
    margin-top: 14px !important;
}

/* 2.7 插入超链接弹窗 */
html body .apple-modal-overlay {
    background: rgba(4, 6, 10, .62) !important;
}

html body .apple-modal {
    padding: 0 !important;
    background: var(--mjj-surface) !important;
    border: 1px solid var(--mjj-border) !important;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .32) !important;
    max-width: 400px !important;
}

html body .apple-modal-header {
    padding: 16px 18px 0 !important;
    margin-bottom: 12px !important;
    text-align: left !important;
}

html body .apple-modal-icon {
    display: none !important;
}

html body .apple-modal-title {
    margin: 0 0 4px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: var(--mjj-text-strong) !important;
}

html body .apple-modal-desc {
    font-size: 12.5px !important;
    color: var(--mjj-text-muted) !important;
    line-height: 1.6 !important;
}

html body .apple-modal .modal-body {
    padding: 0 18px !important;
}

html body .apple-modal .form-label {
    font-size: 12.5px !important;
    margin-bottom: 5px !important;
    color: var(--mjj-text) !important;
}

html body .apple-modal .form-control {
    height: 38px !important;
    padding: 0 12px !important;
    background: var(--mjj-surface) !important;
    border: 1px solid var(--mjj-border) !important;
    color: var(--mjj-text) !important;
    font-size: 13.5px !important;
}

html body .apple-modal .form-control:focus {
    border-color: var(--mjj-brand) !important;
    box-shadow: none !important;
}

html body .apple-modal-footer {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    padding: 14px 18px 16px !important;
    margin-top: 4px !important;
    border-top: 1px solid var(--mjj-border) !important;
}

html body .apple-modal-btn {
    flex: 0 0 auto !important;
    min-width: 84px !important;
    height: 34px !important;
    padding: 0 16px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    border: 1px solid var(--mjj-border) !important;
    box-shadow: none !important;
}

html body .apple-modal-btn.cancel {
    background: var(--mjj-surface) !important;
    color: var(--mjj-text) !important;
}

html body .apple-modal-btn.cancel:hover {
    background: var(--mjj-surface-3) !important;
}

html body .apple-modal-btn.confirm {
    background: #0f7fb8 !important;
    border-color: #0f7fb8 !important;
    color: #fff !important;
}

html body .apple-modal-btn.confirm:hover {
    background: #0c6fa2 !important;
    border-color: #0c6fa2 !important;
}

html[data-theme="dark"] .apple-modal-btn.confirm {
    background: #1d6fb8 !important;
    border-color: #1d6fb8 !important;
}

/* ==========================================================================
   3. 风信子·改名 /my-name.htm
   ========================================================================== */

html body .rename-page {
    color: var(--mjj-text) !important;
    --jan-primary: var(--mjj-brand);
    --jan-primary-soft: var(--mjj-surface-3);
    --jan-primary-border: var(--mjj-border);
    --jan-text-main: var(--mjj-text-strong);
    --jan-text: var(--mjj-text);
    --jan-text-muted: var(--mjj-text-muted);
    --jan-bg: var(--mjj-surface);
    --jan-bg-soft: var(--mjj-surface-2);
    --jan-border: var(--mjj-border);
    --jan-success: #2e7d32;
    --jan-success-soft: #eef8ef;
    --jan-success-border: #c3e3c5;
    --jan-danger: #d64545;
    --jan-danger-soft: #fdf1f1;
    --jan-danger-border: #f2cfcf;
}

html body .rename-page .ren-card {
    background: var(--mjj-surface) !important;
    border: 1px solid var(--mjj-border) !important;
    box-shadow: none !important;
    margin-bottom: 14px !important;
}

html body .rename-page .ren-card__head {
    gap: 10px !important;
    padding: 13px 16px !important;
    background: transparent !important;
    background-image: none !important;
    border-bottom: 1px solid var(--mjj-border) !important;
}

html body .rename-page .ren-card__icon {
    width: 28px !important;
    height: 28px !important;
    background: var(--mjj-surface-3) !important;
    border: 1px solid var(--mjj-border) !important;
    color: var(--mjj-brand) !important;
    font-size: 14px !important;
    box-shadow: none !important;
}

html body .rename-page .ren-card__title {
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    color: var(--mjj-text-strong) !important;
}

html body .rename-page .ren-card__body {
    padding: 16px !important;
}

/* 3.1 当前用户名：居中的大块 → 紧凑的左对齐信息条 */
html body .rename-page .ren-current {
    align-items: flex-start !important;
    text-align: left !important;
    gap: 4px !important;
    padding: 12px 14px !important;
    margin-bottom: 16px !important;
    background: var(--mjj-surface-2) !important;
    border: 1px solid var(--mjj-border) !important;
}

html body .rename-page .ren-current__label {
    margin: 0 0 2px !important;
    font-size: 12.5px !important;
    color: var(--mjj-text-muted) !important;
}

html body .rename-page .ren-current__name {
    font-size: 20px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    color: var(--mjj-text-strong) !important;
    letter-spacing: 0 !important;
}

html body .rename-page .ren-current__name--vip {
    color: #fb7299 !important;
}

/* 3.2 表单：去掉第二层白盒与表单一整块蓝 */
html body .rename-page .ren-form {
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
}

html body .rename-page .ren-form .form-group {
    margin-bottom: 12px !important;
}

html body .rename-page .ren-label {
    margin-bottom: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--mjj-text-strong) !important;
}

html body .rename-page .ren-input {
    height: 40px !important;
    padding: 0 12px !important;
    background: var(--mjj-surface) !important;
    border: 1px solid var(--mjj-border) !important;
    color: var(--mjj-text) !important;
    font-size: 13.5px !important;
    box-shadow: none !important;
}

html body .rename-page .ren-input:hover {
    border-color: var(--mjj-border) !important;
}

html body .rename-page .ren-input:focus {
    border-color: var(--mjj-brand) !important;
    box-shadow: none !important;
}

html body .rename-page .ren-help {
    margin-top: 6px !important;
    font-size: 12px !important;
    line-height: 1.6 !important;
    color: var(--mjj-text-muted) !important;
}

html body .rename-page .ren-tip {
    gap: 8px !important;
    padding: 9px 12px !important;
    margin-bottom: 14px !important;
    background: var(--mjj-surface-2) !important;
    border: 1px solid var(--mjj-border) !important;
    border-left: 2px solid var(--mjj-brand) !important;
    color: var(--mjj-text-muted) !important;
    font-size: 12.5px !important;
    line-height: 1.7 !important;
}

html body .rename-page .ren-tip i {
    color: var(--mjj-brand) !important;
    margin-top: 1px !important;
}

/* 提示条图标：插件用的是图标字体（icon-info-sign），这套字体里没有该字形，
   实际渲染成 0×0 的空盒子。这里改成内联 SVG 背景，保证深浅两套都看得见。 */
html body .rename-page .ren-tip > i.icon {
    flex: 0 0 14px !important;
    width: 14px !important;
    height: 14px !important;
    margin-top: 3px !important;
    font-size: 0 !important;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16'%3E%3Ccircle cx='8' cy='8' r='6.3' fill='none' stroke='%231294d7' stroke-width='1.5'/%3E%3Cpath d='M8 7.3v3.9' stroke='%231294d7' stroke-width='1.6' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='5' r='.95' fill='%231294d7'/%3E%3C/svg%3E") center/14px 14px no-repeat !important;
}

html[data-theme="dark"] body .rename-page .ren-tip > i.icon {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16'%3E%3Ccircle cx='8' cy='8' r='6.3' fill='none' stroke='%233aa0e0' stroke-width='1.5'/%3E%3Cpath d='M8 7.3v3.9' stroke='%233aa0e0' stroke-width='1.6' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='5' r='.95' fill='%233aa0e0'/%3E%3C/svg%3E") center/14px 14px no-repeat !important;
}

html body .rename-page .ren-tip strong {
    color: var(--mjj-text) !important;
    font-weight: 600 !important;
}

/* 提交按钮右对齐 */
html body .rename-page .ren-submit {
    display: flex !important;
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* 3.3 状态提示条：22px 大标题 → 紧凑提示 */
html body .rename-page .ren-alert {
    align-items: flex-start !important;
    gap: 10px !important;
    padding: 11px 13px !important;
    margin-bottom: 14px !important;
    border-width: 1px !important;
}

html body .rename-page .ren-alert__icon {
    flex: 0 0 26px !important;
    width: 26px !important;
    height: 26px !important;
    font-size: 13px !important;
    margin-top: 0 !important;
}

html body .rename-page .ren-alert__top {
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 3px !important;
}

html body .rename-page .ren-alert__title {
    font-size: 13.5px !important;
    font-weight: 600 !important;
}

html body .rename-page .ren-alert__meta {
    min-height: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
}

html body .rename-page .ren-alert__meta-num {
    font-size: 14px !important;
}

html body .rename-page .ren-alert__text,
html body .rename-page .ren-alert__text p {
    font-size: 12.5px !important;
    line-height: 1.7 !important;
    font-weight: 400 !important;
}

/* 三种色调：浅色用半透明底，深色自动跟随（令牌里的 soft 色在深色下过亮，这里另给一套） */
html body .rename-page .ren-alert--warning {
    background: rgba(245, 158, 11, .10) !important;
    border-color: rgba(245, 158, 11, .30) !important;
    color: #a9560a !important;
}

html body .rename-page .ren-alert--success {
    background: rgba(34, 154, 66, .10) !important;
    border-color: rgba(34, 154, 66, .28) !important;
    color: #1e6b32 !important;
}

html body .rename-page .ren-alert--danger {
    background: rgba(217, 83, 79, .10) !important;
    border-color: rgba(217, 83, 79, .30) !important;
    color: #b03a37 !important;
}

html[data-theme="dark"] .rename-page .ren-alert--warning {
    background: rgba(245, 158, 11, .12) !important;
    border-color: rgba(245, 158, 11, .26) !important;
    color: #f0b46a !important;
}

html[data-theme="dark"] .rename-page .ren-alert--success {
    background: rgba(34, 154, 66, .14) !important;
    border-color: rgba(34, 154, 66, .28) !important;
    color: #6cc98a !important;
}

html[data-theme="dark"] .rename-page .ren-alert--danger {
    background: rgba(217, 83, 79, .14) !important;
    border-color: rgba(217, 83, 79, .30) !important;
    color: #f08e8b !important;
}

/* ==========================================================================
   4. 窄屏
   ========================================================================== */
@media (max-width: 767.98px) {
    html body .signature-card__header,
    html body .rename-page .ren-card__head {
        padding: 12px 14px !important;
    }

    html body .signature-card__content,
    html body .rename-page .ren-card__body {
        padding: 12px 14px 14px !important;
    }

    html body .signature-card .signature-card__content > form > .btn-submit,
    html body .rename-page .ren-submit {
        align-self: stretch !important;
        width: 100% !important;
        margin-left: 0 !important;
    }

    html body .rename-page .ren-current {
        padding: 10px 12px !important;
    }

    html body .rename-page .ren-current__name {
        font-size: 18px !important;
    }

    html body .apple-modal {
        max-width: none !important;
    }
}
