/**
 * 聊天窗口面板 - 输入区域样式
 * 包含：工具架、输入框、发送按钮、禁用状态
 * 独立样式（仅本面板使用，不与其他面板通用）
 * 字体：Microsoft YaHei（符合项目字体规范）
 */

/* 输入区域：底色与上方聊天内容区一致，整体一条横条，无底框 */
.chat-window-panel .chat-window-input-area {
    flex-shrink: 0;
    padding: 10px 16px 14px;
    background: var(--cw-bg-deep);
    border-top: 1px solid var(--cw-border-subtle);
}

/* 工具架：无底框、无单独背景，图标直接排在输入区上 */
.chat-window-panel .chat-window-input-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.chat-window-panel .chat-window-input-toolbar .chat-window-tool-icon {
    width: 22px;
    height: 22px;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    border: none;
}
.chat-window-panel .chat-window-tool-btn {
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.chat-window-panel .chat-window-tool-btn:hover {
    background: transparent;
}
.chat-window-panel .chat-window-tool-svg {
    display: block;
    color: var(--cw-text-muted);
}
.chat-window-panel .chat-window-tool-btn:hover .chat-window-tool-svg {
    color: var(--cw-text);
}
.chat-window-panel .chat-window-file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
}

.chat-window-panel .chat-window-input-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}
.chat-window-panel .chat-window-input-wrap {
    flex: 1;
    min-width: 0;
}
/* 输入框：无边框、与背景融为一体，参考截图 */
.chat-window-panel .chat-window-input-text {
    width: 100%;
    min-height: 72px;
    max-height: 200px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--cw-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    overflow-y: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
    /* 锁定布局，防止截图影响布局 */
    box-sizing: border-box;
    display: block;
}

/* contenteditable 输入框样式 */
.chat-window-panel .chat-window-input-text[contenteditable="true"] {
    outline: none;
    cursor: text;
}

/* placeholder 效果（使用 data-placeholder） */
.chat-window-panel .chat-window-input-text[contenteditable="true"]:empty:before {
    content: attr(data-placeholder);
    color: var(--cw-text-muted);
    pointer-events: none;
}

.chat-window-panel .chat-window-input-text:focus {
    outline: none;
}

/* 输入框中的表情图片样式 */
.chat-window-panel .chat-window-input-text .chat-window-input-emoji {
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin: 0 2px;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
    max-width: 20px;
    max-height: 20px;
    flex-shrink: 0;
}

/* 输入框中的截图缩略图样式 */
.chat-window-panel .chat-window-input-text .chat-window-input-screenshot {
    display: inline-block;
    position: relative;
    vertical-align: middle;
    margin: 4px 6px;
    flex-shrink: 0;
    user-select: none;
    border: 1px solid var(--cw-border, #2e2e2e);
    border-radius: 4px;
    overflow: hidden;
    background: var(--cw-bg-deep, #141414);
}

.chat-window-panel .chat-window-input-text .chat-window-input-screenshot-img {
    display: block;
    width: 80px;
    height: 80px;
    object-fit: cover;
    pointer-events: none;
    max-width: 80px;
    max-height: 80px;
}

.chat-window-panel .chat-window-input-text .chat-window-input-screenshot-delete {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: auto;
    z-index: 10;
}

.chat-window-panel .chat-window-input-text .chat-window-input-screenshot:hover .chat-window-input-screenshot-delete {
    opacity: 1;
}

.chat-window-panel .chat-window-input-text .chat-window-input-screenshot-delete:hover {
    background: rgba(220, 53, 69, 0.8);
}

.chat-window-panel .chat-window-input-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.chat-window-panel .chat-window-input-calls {
    display: flex;
    gap: 6px;
}
.chat-window-panel .chat-window-input-calls .chat-window-tool-icon {
    width: 26px;
    height: 26px;
    background: var(--cw-icon-bg);
    border-radius: 4px;
    cursor: pointer;
    border: none;
}
.chat-window-panel .chat-window-send-btn {
    padding: 10px 20px;
    background: var(--cw-btn-send);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}
.chat-window-panel .chat-window-send-btn:hover {
    background: var(--cw-btn-send-hover);
}

/* 禁用输入框样式 */
.chat-window-panel .chat-window-input-text[contenteditable="false"] {
    background: var(--cw-bg-deep, #141414);
    opacity: 0.5;
    cursor: not-allowed;
    user-select: none;
}

.chat-window-panel .chat-window-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==================== 引用消息预览区域（输入区下方，仅本面板使用） ==================== */
.chat-window-panel .chat-window-input-reference {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    border: 1px solid var(--cw-border-subtle);
}

.chat-window-panel .chat-window-input-reference[hidden] {
    display: none;
}

.chat-window-panel .chat-window-input-reference-bar {
    display: none;
}

.chat-window-panel .chat-window-input-reference-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-window-panel .chat-window-input-reference-user {
    font-size: 12px;
    font-weight: bold;
    color: var(--cw-text-muted);
}

.chat-window-panel .chat-window-input-reference-body {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-window-panel .chat-window-input-reference-thumb-wrap {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--cw-bg-panel);
    flex-shrink: 0;
    display: none;
}

.chat-window-panel .chat-window-input-reference-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    display: block;
}

.chat-window-panel .chat-window-input-reference-text {
    font-size: 12px;
    color: var(--cw-text-muted);
    max-height: 36px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.chat-window-panel .chat-window-input-reference-close {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--cw-text-muted);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.chat-window-panel .chat-window-input-reference-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--cw-text);
}

