/* ============================================================
 * 工具留言板 / 需求反馈
 * ------------------------------------------------------------
 * 用于两处：
 *   1. 工具页底部的留言区（views/home/layout/_feedback.html）
 *   2. 统一入口页 /feedback.html（views/home/addenergy/pub/feedback.html）
 *
 * 设计取向：像留言墙，不像工单系统。
 *   - 没有分类选择、没有"待审核"这类字眼压在用户头上
 *   - 保留站长的处理状态（处理中 / 已采纳 / 已上线），但做成一枚小徽章
 *   - 站长回复是淡绿气泡，读起来像有人在回你
 * 故意不依赖 Tailwind：这套样式自包含，避免为几个类重建 tailwind.css。
 * ============================================================ */

.fb,
.fb * {
    box-sizing: border-box;
}

.fb {
    background: #fff;
    /* border: 1px solid #e5e7eb; */
    border-radius: 12px;
    padding: 18px 20px 6px;
    margin: 2rem 0 ;
}

/* ---------- 头部 ---------- */
.fb-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.fb-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
}

.fb-num {
    font-size: 12px;
    font-weight: 400;
    color: #9ca3af;
}

.fb-all {
    font-size: 12px;
    color: #3bb346;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.fb-all:hover {
    text-decoration: underline;
}

.fb-sub {
    margin: 4px 0 14px;
    font-size: 12.5px;
    color: #6b7280;
    line-height: 1.6;
}

/* ---------- 输入区 ----------
 * 灰卡里从上到下三块，各司其职：
 *   1. 留言框（白底带边框的 textarea，一眼看出是主输入区）
 *   2. 昵称行：标签 + 白底带边框的输入框（不填就默认「游客」）
 *   3. 计数 + 发送按钮，靠右
 */
.fb-form {
    margin: 0;
    max-width: 35rem;
}

.fb-compose {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: #fafafa;
    border: 1px solid #eef0f2;
    border-radius: 10px;
}

.fb-ta {
    display: block;
    width: 100%;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: #111827;
    padding: 9px 11px;
    min-height: 72px;
    transition: border-color 0.15s;
}

.fb-ta::placeholder {
    color: #b6bcc6;
}

.fb-ta:focus,
.fb-nick:focus {
    border-color: #3bb346;
}

.fb-ta:hover,
.fb-nick:hover {
    border-color: #d8dce2;
}

.fb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* 昵称：带「昵称」标签的真实输入框；选填，不逼人填 */
.fb-nick-field {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 240px;
    min-width: 0;
}

.fb-nick-label {
    font-size: 12.5px;
    color: #6b7280;
    white-space: nowrap;
    flex-shrink: 0;
}

.fb-nick {
    flex: 1;
    min-width: 0;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 8px;
    outline: none;
    font-family: inherit;
    font-size: 13px;
    color: #374151;
    padding: 6px 10px;
    transition: border-color 0.15s;
}

.fb-nick::placeholder {
    color: #b6bcc6;
}

.fb-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.fb-len {
    font-size: 12px;
    color: #c3c8d0;
    margin-left: auto;
}

.fb-send {
    border: none;
    border-radius: 8px;
    background: #3bb346;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.fb-send:hover {
    background: #34a03f;
}

/* 没写内容时置灰，不做红字报错 */
.fb-send.is-off {
    background: #e5e7eb;
    color: #b6bcc6;
    font-weight: 500;
    cursor: default;
}

.fb-send.is-off:hover {
    background: #e5e7eb;
}

.fb-msg {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.5;
    display: none;
}

.fb-msg.is-ok {
    display: block;
    color: #27500a;
}

.fb-msg.is-err {
    display: block;
    color: #a32d2d;
}

/* ---------- 头像 ---------- */
.fb-av {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    user-select: none;
    overflow: hidden;
}

.fb-av-guest {
    background: #eef0f2;
    color: #9ca3af;
}

/* ---------- 留言列表 ---------- */
.fb-list {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
}

.fb-item {
    display: flex;
    gap: 10px;
    padding: 13px 0;
    border-top: 1px solid #f3f4f6;
}

.fb-item:first-child {
    border-top: none;
}

.fb-main {
    flex: 1;
    min-width: 0;
}

.fb-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.5;
}

.fb-name {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.fb-sep {
    color: #d6dae0;
}

.fb-text {
    margin: 3px 0 0;
    font-size: 14px;
    line-height: 1.7;
    color: #1f2937;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---------- 站长处理标记 ----------
 * 0 无状态：一枚徽章都不显示（这是常态，随手留的一句话不需要被标记）
 * 1 处理中 / 2 已采纳 / 3 已上线 / 4 不采纳：可选标记，越往后颜色越"重"
 */
.fb-status {
    font-size: 11px;
    line-height: 1.6;
    padding: 0 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* 仅自己可见：别人还看不到的那条，故意做得比处理标记轻 */
.fb-status-self {
    background: #f7f8f9;
    color: #8b93a1;
    box-shadow: inset 0 0 0 1px #e7eaee;
}

.fb-status-1 {
    background: #faeeda;
    color: #854f0b;
}

.fb-status-2 {
    background: #eaf3de;
    color: #27500a;
}

.fb-status-3 {
    background: #3bb346;
    color: #fff;
    font-weight: 600;
}

.fb-status-4 {
    background: #f1efe8;
    color: #5f5e5a;
}

/* ---------- 站长回复 ---------- */
.fb-reply {
    margin-top: 8px;
    background: #f4f9ec;
    border-radius: 8px;
    padding: 8px 11px;
}

.fb-reply-who {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #3d7a15;
    margin-bottom: 2px;
}

.fb-reply p {
    margin: 0;
    font-size: 13px;
    line-height: 1.65;
    color: #3f4a35;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---------- 自己刚发、还没放给别人的那条 ---------- */
.fb-item.is-mine .fb-text {
    color: #6b7280;
}

/* ---------- 底部提示 / 空态 ---------- */
.fb-more {
    border-top: 1px solid #f3f4f6;
    padding: 11px 0 10px;
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
}

.fb-empty {
    list-style: none;
    border-top: 1px solid #f3f4f6;
    padding: 22px 0 26px;
    text-align: center;
}

.fb-empty-line {
    margin: 0 0 4px;
    font-size: 14px;
    color: #6b7280;
}

.fb-empty-sub {
    margin: 0;
    font-size: 12px;
    color: #b6bcc6;
}

/* ---------- 统一入口页 ---------- */
.fb-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

.fb-page-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
}

.fb-page-sub {
    margin: 8px 0 20px;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.6;
}

.fb-select {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 12.5px;
    color: #374151;
    background: #fff;
    font-family: inherit;
    outline: none;
    max-width: 190px;
}

.fb-select:focus {
    border-color: #3bb346;
}

.fb-block {
    margin-top: 26px;
}

.fb-block-title {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

/* ---------- 工具页：留言板与工具容器的位置关系 ----------
 * 留言板原先嵌在 .tool-container（浅灰圆角大卡）里面，视觉上像是工具本体的一部分。
 * 现在把 {{template "./home/layout/_feedback.html" .}} 移到工具容器的 </div> 之后，
 * 它成为 .main-content 的直接子节点、紧跟在容器下面：不再吃容器的内边距和灰底，
 * 是一张独立的白色卡片，左右宽度与工具容器对齐。
 * 这里只补「与容器之间的间距」；选择器限定 .main-content>.fb ——
 * 即工具页那种直接挂在页面主体下的留言板，不影响 /feedback.html 里嵌套在 .fb-page 内的 .fb。
 */
.main-content>.fb {
    margin-top: 16px;
}

@media (max-width: 767px) {
    /* 手机端 .tool-container 只有 5px 内边距，留言板此前被它收进来 5px；
       剥离之后若不补这 5px，卡片边框会直接贴住屏幕边缘。 */
    .main-content>.fb {
        margin: 10px 5px 0;
    }
}

/* ---------- 移动端 ---------- */
@media (max-width: 767px) {

    .fb {
        padding: 15px 14px 4px;
    }

    .fb-av {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .fb-text {
        font-size: 13.5px;
    }

    .fb-row {
        flex-wrap: wrap;
    }

    /* 手机端昵称独占一行，计数/发送换行后靠右 */
    .fb-nick-field {
        flex-basis: 100%;
    }

    .fb-select {
        max-width: 100%;
        order: -1;
        flex-basis: 100%;
    }

    .fb-page {
        padding: 16px 12px 32px;
    }

    .fb-page-title {
        font-size: 19px;
    }
}
