/* ============================================================
   css/chat/chat-actions.css — 多选栏 / 引用栏 / 右键菜单 / 删除确认
   设计系统: 毛玻璃 · 多层阴影 · 弹性动画
   ============================================================ */

/* ---- Multi-select 模式 ---- */
.msg-checkbox {
    display: none;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-right: 12px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--surface-solid);
    transition: all 0.18s ease;
    position: relative;
    outline: none;
}
.multi-select-mode {
    padding-bottom: 80px;
}
.multi-select-mode .msg {
    align-items: center !important;
    align-self: stretch !important;
    max-width: 100% !important;
    width: 100%;
}
.multi-select-mode .msg-checkbox {
    display: block;
    order: -1;
    margin-right: 10px;
    margin-left: 0;
}
.msg-checkbox:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.msg-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 7px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.multi-select-mode .msg.selected .bubble {
    outline: 2.5px solid var(--accent);
    outline-offset: 3px;
    box-shadow: var(--shadow-glow);
}

/* ---- 多选操作栏 ---- */
#multi-bar {
    display: none;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    position: sticky;
    bottom: 0;
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    z-index: 10;
    box-shadow:
        0 -1px 0 rgba(255,255,255,0.4) inset,
        0 -4px 20px rgba(160,145,130,0.06);
}
#multi-bar.show { display: flex; }
#multi-bar .count {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
    margin: 0 4px;
}
#multi-bar .cancel-multi {
    display: flex; align-items: center; gap: 4px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 13px; cursor: pointer;
    background: var(--surface-solid);
    color: var(--text-secondary);
    font-family: inherit;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
#multi-bar .cancel-multi:hover {
    background: var(--accent-light);
    color: var(--accent);
}
#multi-bar .cancel-multi:active { transform: scale(0.96); }
#multi-bar .actions {
    display: flex;
    gap: 6px;
    flex: 1;
    justify-content: flex-end;
    flex-wrap: nowrap;
    overflow-x: auto;
}
#multi-bar .actions button {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 6px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 12px; cursor: pointer;
    font-weight: 600; white-space: nowrap;
    font-family: inherit;
    transition: all 0.15s ease;
    min-height: 32px;
    flex-shrink: 0;
    background: var(--accent-light);
    color: var(--accent);
}
#multi-bar .actions button:hover {
    background: rgba(201,176,168,0.22);
}
#multi-bar .actions button:active { transform: scale(0.94); }
/* 删除选中 — 红色危险操作，唯一区分 */
#multi-bar .actions .delete-selected {
    background: var(--danger, #E07070);
    color: #fff;
    border-color: var(--danger, #E07070);
    box-shadow: 0 2px 6px rgba(224,100,100,0.25);
}
#multi-bar .actions .delete-selected:hover {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(224,100,100,0.35);
}

/* 窄屏适配 */
@media (max-width: 360px) {
    #multi-bar { padding: 8px 8px; gap: 4px; }
    #multi-bar .actions { gap: 4px; }
    #multi-bar .actions button { padding: 7px 10px; font-size: 11px; }
    #multi-bar .cancel-multi { padding: 7px 10px; font-size: 12px; }
    #multi-bar .count { font-size: 11px; margin: 0 2px; }
}

/* ---- 引用栏 — 浮动圆角气泡卡片 ---- */
#quote-bar {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 12px;
    width: calc(100% - 24px);
    max-width: calc(100% - 24px);
    background: var(--surface);
    opacity: 0.87;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px 10px 6px 12px;
    margin-bottom: 6px;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.3) inset,
        0 2px 12px rgba(160,145,130,0.06),
        0 0 0 1px rgba(201,168,168,0.08);
    z-index: 20;
    animation: popIn 0.22s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.quote-bar-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}
.quote-bar-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.quote-bar-close {
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-muted);
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.15s ease;
    padding: 0;
    /* ★ ✕ 与文字保持独立间距（gap 之外再加边距），贴框最右侧、绝不贴字 */
    margin-left: 6px;
    margin-right: 2px;
}
.quote-bar-close:hover {
    color: var(--danger);
    background: var(--accent-light);
    border-color: var(--accent-rose);
}

/* 窄屏引用条适配 */
@media (max-width: 370px) {
    #quote-bar {
        left: 6px;
        width: calc(100% - 12px);
        padding: 5px 8px 5px 10px;
    }
    .quote-bar-content { gap: 4px; }
    .quote-bar-text { font-size: 11px; }
}

/* ---- 编辑消息弹窗（问题8：design-system毛玻璃+多层阴影+线条图标）---- */
/* ★ 防闪烁同 pins：基类 opacity:0 + 仅 close 方向 transition；.show 里 transition:none + animation 独占。
   键盘弹出时 --kbd-h 由 socket-nav 实时更新 → 卡片随 padding-bottom 平滑上移，不跳位。 */
.edit-msg-overlay {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(0,0,0,0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    padding-bottom: calc(20px + var(--kbd-h, 0px));
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}
.edit-msg-overlay.show {
    opacity: 1;
    pointer-events: auto;
    transition: none;
    animation: editFadeIn 0.18s ease;
}
@keyframes editFadeIn { from { opacity: 0; } to { opacity: 1; } }

.edit-msg-card {
    background: var(--surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border, rgba(255,255,255,0.3));
    border-radius: 12px;
    padding: 20px;
    width: 100%; max-width: 440px;
    max-height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.4) inset,
        var(--shadow-lg);
    animation: editCardIn 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes editCardIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.edit-msg-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.edit-msg-title {
    font-size: 15px; font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}
.edit-msg-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 4px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s ease;
}
.edit-msg-close:hover { color: var(--text-primary); background: var(--accent-light); }

.edit-msg-textarea {
    width: 100%; min-height: 100px; max-height: 280px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--input-bg, rgba(255,255,255,0.5));
    color: var(--text-primary);
    font-family: inherit; font-size: 14px; line-height: 1.55;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}
.edit-msg-textarea:focus {
    border-color: var(--accent);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04), 0 0 0 3px var(--accent-light);
}

.edit-msg-actions {
    display: flex; justify-content: flex-end; gap: 10px;
    margin-top: 14px;
}
.edit-msg-cancel {
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-solid);
    color: var(--text-secondary);
    font-family: inherit; font-size: 13px; cursor: pointer;
    transition: all 0.15s ease;
}
.edit-msg-cancel:hover { background: var(--accent-light); color: var(--accent); }
.edit-msg-cancel:active { transform: scale(0.96); }

.edit-msg-confirm {
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    background: var(--accent-gradient);
    color: #fff;
    font-family: inherit; font-size: 13px; font-weight: 600;
    cursor: pointer;
    display: flex; align-items: center; gap: 5px;
    box-shadow: 0 2px 8px var(--accent-glow);
    transition: all 0.15s ease;
}
.edit-msg-confirm:hover { transform: translateY(-1px); box-shadow: 0 4px 14px var(--accent-glow); }
.edit-msg-confirm:active { transform: scale(0.96); }

/* ---- 右键菜单·编辑按钮 ---- */
.ctx-edit-btn {
    background: var(--card-bg, rgba(255,255,255,0.55));
    color: var(--text-primary);
}
