/* ==========================================================================
   弹窗 / 命令面板 / 留言区 / 批量栏 等组件
   ========================================================================== */

/* ---------- 通用模态框 ---------- */
.tb-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 14, 22, .55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.tb-modal-overlay.show {
    display: flex;
}

.tb-modal {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 86vh;
    overflow: auto;
    padding: 22px 24px 24px;
    border-radius: var(--radius-l);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-3);
    color: var(--text);
    animation: tb-pop .22s var(--ease);
}

@keyframes tb-pop {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tb-modal h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 650;
    margin-bottom: 16px;
    padding-right: 34px;
}

.tb-modal h3 i {
    color: var(--accent);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--text-3);
    font-size: 18px;
    line-height: 1;
    float: none;
    transition: all var(--dur) var(--ease);
}

.modal-close:hover {
    background: var(--surface-3);
    color: var(--text);
}

.announce-modal {
    max-width: 520px;
}

/* ---------- 使用统计 ---------- */
.stat-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.stat-card {
    padding: 14px 12px;
    border-radius: var(--radius-m);
    background: var(--surface-2);
    border: 1px solid var(--border);
    text-align: center;
}

.stat-card .num {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.stat-card .lbl {
    margin-top: 3px;
    font-size: 11.5px;
    color: var(--text-3);
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    margin-bottom: 6px;
    border-radius: var(--radius-s);
    background: var(--surface-2);
}

.stat-rank {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--text-2);
    font-size: 11px;
    font-weight: 700;
}

.stat-rank.top1 {
    background: linear-gradient(135deg, #ffd76a, #f0a500);
    color: #5a3d00;
}

.stat-rank.top2 {
    background: linear-gradient(135deg, #e2e8f0, #b8c4d2);
    color: #3d4b5c;
}

.stat-rank.top3 {
    background: linear-gradient(135deg, #e3b07a, #c9814b);
    color: #4a2a10;
}

.stat-name {
    flex: 1;
    min-width: 0;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-bar {
    flex: 2;
    height: 5px;
    border-radius: 3px;
    background: var(--surface-3);
    overflow: hidden;
}

.stat-bar > span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.stat-count {
    width: 34px;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
}

/* ---------- 分享二维码 ---------- */
.qr-box {
    text-align: center;
    padding: 6px 0 2px;
}

.qr-box img {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    padding: 10px;
    border-radius: var(--radius-m);
    background: #fff;
    border: 1px solid var(--border);
}

.qr-tip {
    margin-top: 12px;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--text-2);
    word-break: break-all;
}

.qr-copy {
    margin-top: 12px;
}

/* ---------- 公告 ---------- */
.announce-body {
    max-height: 48vh;
    overflow: auto;
    font-size: 13.5px;
    line-height: 1.8;
    color: var(--text);
    white-space: pre-wrap;
}

.announce-time {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-3);
}

/* ---------- 会员申请 ---------- */
.member-modal {
    max-width: 460px;
}

.member-benefits {
    margin: 4px 0 16px;
}

.mb-item {
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--text-2);
    margin: 7px 0;
}

.mb-item i {
    color: var(--ok);
    margin-right: 6px;
}

.member-label {
    display: block;
    margin: 12px 0 5px;
    font-size: 12px;
    color: var(--text-3);
}

.member-input {
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--radius-s);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
    transition: all var(--dur) var(--ease);
}

.member-input:focus {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--glow);
}

.member-submit {
    width: 100%;
    height: 40px;
    margin-top: 16px;
    border-radius: var(--radius-s);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--on-accent);
    font-size: 13.5px;
    font-weight: 600;
    transition: all var(--dur) var(--ease);
}

.member-submit:hover {
    box-shadow: 0 6px 18px var(--glow);
}

.member-msg {
    margin-top: 10px;
    font-size: 12.5px;
}

.member-msg.err {
    color: var(--danger);
}

.member-done {
    padding: 10px 0;
    text-align: center;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-2);
}

/* ---------- 留言弹窗 ---------- */
.msg-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 14, 22, .55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.msg-modal-overlay.show {
    display: flex;
}

.msg-modal {
    position: relative;
    width: 100%;
    max-width: 500px;
    padding: 22px 24px 24px;
    border-radius: var(--radius-l);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-3);
    color: var(--text);
}

.msg-modal h3 {
    font-size: 16.5px;
    font-weight: 650;
    margin-bottom: 14px;
    color: var(--text);
}

.msg-modal textarea {
    width: 100%;
    height: 130px;
    padding: 11px 12px;
    border-radius: var(--radius-s);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
    line-height: 1.7;
    resize: vertical;
    transition: all var(--dur) var(--ease);
}

.msg-modal textarea::placeholder {
    color: var(--text-3);
}

.msg-modal textarea:focus {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--glow);
}

.msg-modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.msg-modal .modal-actions button {
    height: 36px;
    padding: 0 18px;
    border-radius: var(--radius-s);
    font-size: 13px;
    font-weight: 600;
    transition: all var(--dur) var(--ease);
}

.msg-modal .btn-cancel {
    background: var(--surface-3);
    color: var(--text-2);
}

.msg-modal .btn-cancel:hover {
    background: var(--border);
    color: var(--text);
}

.msg-modal .btn-submit {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--on-accent);
}

.msg-modal .btn-submit:hover {
    box-shadow: 0 5px 16px var(--glow);
}

.msg-modal .btn-submit:disabled {
    opacity: .5;
    cursor: not-allowed;
    box-shadow: none;
}

.msg-modal .msg-status {
    display: none;
    margin-top: 10px;
    font-size: 12.5px;
    text-align: center;
}

.msg-modal .msg-status.success {
    display: block;
    color: var(--ok);
}

.msg-modal .msg-status.error {
    display: block;
    color: var(--danger);
}

/* ---------- 最近留言 ---------- */
.recent-messages-section {
    margin-top: 28px;
    padding: 20px;
    border-radius: var(--radius-l);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-1);
}

.recent-messages-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 15px;
    font-weight: 650;
    color: var(--text);
}

.recent-messages-section h3 i {
    color: var(--accent);
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message-item {
    padding: 13px 14px;
    border-radius: var(--radius-m);
    border: 1px solid var(--border);
    background: var(--surface-2);
    transition: all var(--dur) var(--ease);
}

.message-item:hover {
    border-color: var(--accent-line);
}

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 12px;
}

.message-author {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: var(--text);
}

.message-author i {
    color: var(--accent);
}

.message-time {
    font-size: 11.5px;
    color: var(--text-3);
}

.message-content {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-2);
    word-break: break-word;
}

.message-reply {
    margin-top: 9px;
    padding: 9px 12px;
    border-radius: var(--radius-s);
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
    font-size: 12.5px;
    line-height: 1.65;
    color: var(--text);
}

.message-reply-label {
    margin-bottom: 3px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--accent);
}

.message-empty {
    padding: 28px;
    text-align: center;
    font-size: 13px;
    color: var(--text-3);
}

.message-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.msg-reply-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-xs);
    color: var(--text-3);
    font-size: 11.5px;
    transition: all var(--dur) var(--ease);
}

.msg-reply-btn:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

.reply-inline {
    display: none;
    gap: 8px;
    margin-top: 9px;
}

.reply-inline.show {
    display: flex;
}

.reply-inline input {
    flex: 1;
    height: 32px;
    padding: 0 11px;
    border-radius: var(--radius-s);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 12.5px;
}

.reply-inline input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--glow);
}

.reply-inline button {
    height: 32px;
    padding: 0 14px;
    border-radius: var(--radius-s);
    font-size: 12.5px;
    font-weight: 600;
}

.reply-inline .btn-reply-send {
    background: var(--accent);
    color: var(--on-accent);
}

.reply-inline .btn-reply-cancel {
    background: var(--surface-3);
    color: var(--text-2);
}

.reply-threads {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 9px;
    margin-left: 14px;
}

.reply-thread-item {
    padding: 9px 12px;
    border-radius: var(--radius-s);
    border: 1px solid var(--border);
    background: var(--surface-3);
    font-size: 12.5px;
    line-height: 1.6;
}

.reply-thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
    font-size: 11.5px;
}

.reply-thread-name {
    font-weight: 600;
    color: var(--text);
}

.reply-thread-time {
    color: var(--text-3);
}

.reply-thread-text {
    color: var(--text-2);
}

/* ---------- 悬停预览 ---------- */
.tool-tip {
    position: fixed;
    z-index: 9999;
    max-width: 300px;
    padding: 11px 13px;
    border-radius: var(--radius-m);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-2);
    font-size: 12.5px;
    line-height: 1.6;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s var(--ease);
}

.tool-tip.show {
    opacity: 1;
}

.tool-tip .tt-name {
    margin-bottom: 4px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
}

.tool-tip .tt-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 7px;
}

.tool-tip .tt-tags span {
    padding: 1px 6px;
    border-radius: var(--radius-xs);
    background: var(--surface-3);
    color: var(--text-3);
    font-size: 10.5px;
}

/* ---------- 命令面板 ---------- */
.cmd-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    background: rgba(8, 14, 22, .5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.cmd-overlay.hidden {
    display: none;
}

.cmd-box {
    width: 600px;
    max-width: 92vw;
    overflow: hidden;
    border-radius: var(--radius-l);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-3);
}

.cmd-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
}

.cmd-input-wrap .fa-search {
    color: var(--text-3);
}

.cmd-input {
    flex: 1;
    font-size: 14.5px;
    color: var(--text);
    background: transparent;
}

.cmd-input::placeholder {
    color: var(--text-3);
}

.cmd-results {
    max-height: 52vh;
    overflow-y: auto;
    padding: 6px;
}

.cmd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-s);
    color: var(--text);
    cursor: pointer;
}

.cmd-item.active {
    background: var(--accent);
    color: var(--on-accent);
}

.cmd-item .ci-icon {
    font-size: 15px;
    flex-shrink: 0;
}

.cmd-item .ci-name {
    font-weight: 600;
    font-size: 13px;
}

.cmd-item .ci-desc {
    max-width: 340px;
    overflow: hidden;
    font-size: 11.5px;
    opacity: .75;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.cmd-item .ci-cat {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 10.5px;
    opacity: .6;
}

.cmd-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-3);
    font-size: 13px;
}

/* ---------- 搜索历史 ---------- */
.search-history {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 60;
    display: none;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    border-radius: var(--radius-m);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-2);
}

.search-history.show {
    display: block;
}

.search-history .sh-title {
    display: flex;
    justify-content: space-between;
    padding: 6px 10px;
    font-size: 11.5px;
    color: var(--text-3);
}

.search-history .sh-title a {
    color: var(--accent);
    cursor: pointer;
}

.search-history .sh-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-s);
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}

.search-history .sh-item:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.search-history .sh-item i {
    color: var(--text-3);
    font-size: 12px;
}

.search-history .sh-empty {
    padding: 12px;
    text-align: center;
    font-size: 12.5px;
    color: var(--text-3);
}

/* ---------- 快捷键面板 ---------- */
.shortcuts-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 14, 22, .55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.shortcuts-overlay.show {
    display: flex;
}

.shortcuts-box {
    width: 100%;
    max-width: 520px;
    max-height: 82vh;
    overflow-y: auto;
    padding: 22px 24px;
    border-radius: var(--radius-l);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-3);
}

.shortcuts-box h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 16px;
    font-weight: 650;
    color: var(--text);
}

.shortcuts-box h3 i {
    color: var(--accent);
}

.shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12.5px;
}

.shortcut-row:last-child {
    border-bottom: none;
}

.shortcut-row .sc-desc {
    color: var(--text-2);
}

.shortcut-row .sc-keys {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.sc-key {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 11px;
}

/* ---------- 批量工具栏 ---------- */
.batch-toolbar {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 1500;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-3);
    transform: translateX(-50%) translateY(140px);
    transition: transform .28s var(--ease);
}

.batch-toolbar.show {
    transform: translateX(-50%) translateY(0);
}

.batch-toolbar .batch-count {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.batch-toolbar button {
    height: 30px;
    padding: 0 13px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transition: all var(--dur) var(--ease);
}

.batch-toolbar .bt-fav {
    background: var(--accent);
    color: var(--on-accent);
}

.batch-toolbar .bt-fav:hover {
    background: var(--accent-2);
}

.batch-toolbar .bt-cancel {
    background: var(--surface-3);
    color: var(--text-2);
}

.batch-toolbar .bt-cancel:hover {
    background: var(--border);
    color: var(--text);
}
