/* input.css - 输入容器、输入框、提示、发送按钮、取消按钮 */

/* ===== Input ===== */
.input-container {
    padding: 16px 0 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-primary);
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-sketch);
    border-radius: 16px;
    transition: all var(--transition);
    box-shadow: var(--shadow-sketch);
    position: relative;
}

.input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(107, 127, 198, 0.12), var(--shadow-sketch);
}

.input-hints {
    display: flex;
    gap: 8px;
    position: absolute;
    top: -28px;
    left: 18px;
}

.input-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px dashed var(--border-color);
}

.input-hint code {
    color: var(--accent-primary);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 11px;
}

.runtime-queue-panel {
    margin-bottom: 10px;
    padding: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-sketch);
}

.runtime-queue-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.runtime-queue-head strong {
    display: block;
    font-size: 13px;
    color: var(--text-primary);
}

.runtime-queue-head span {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-tertiary);
}

.runtime-queue-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

.runtime-queue-actions svg {
    width: 14px;
    height: 14px;
}

.runtime-queue-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.runtime-queue-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--bg-primary);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
}

.runtime-queue-item.editing {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: stretch;
}

.runtime-queue-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 62px;
    color: var(--text-tertiary);
    font-size: 11px;
}

.runtime-queue-meta span:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.runtime-queue-text {
    min-width: 0;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.runtime-queue-edit {
    width: 100%;
    min-height: 42px;
    resize: vertical;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
}

.runtime-queue-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.runtime-queue-actions button {
    min-width: 28px;
    min-height: 28px;
    padding: 0 6px;
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.runtime-queue-actions button[data-queue-action="kind"] {
    min-width: 62px;
}

.runtime-queue-actions button:hover:not(:disabled) {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.runtime-queue-actions button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.runtime-queue-empty {
    padding: 8px;
    color: var(--text-tertiary);
    font-size: 12px;
}

.runtime-queue-placeholder {
    min-height: 40px;
    border: 1px dashed var(--accent-primary);
    border-radius: 8px;
    background: rgba(107, 127, 198, 0.08);
}

.message-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    resize: none;
    max-height: 120px;
    line-height: 1.6;
    padding: 0;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.message-input::-webkit-scrollbar {
    display: none;
}

.message-input:focus {
    outline: none;
}

.message-input::placeholder {
    color: var(--text-tertiary);
    font-style: italic;
}

.send-btn {
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    border: 2px solid var(--accent-primary);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 500;
    color: white;
    align-self: flex-end;
    margin-bottom: 2px;
    box-shadow: var(--shadow-sketch);
}

.send-btn:hover:not(:disabled) {
    background: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: 3px 4px 0px rgba(107, 127, 198, 0.25);
}

.send-btn:disabled {
    background: var(--bg-hover);
    border-color: var(--border-color);
    color: var(--text-tertiary);
    cursor: not-allowed;
    box-shadow: none;
}

.send-btn.processing {
    background: var(--warning);
    border-color: var(--warning);
    color: white;
    cursor: not-allowed;
}

.send-btn.processing:not(:disabled) {
    cursor: pointer;
}

.cancel-btn {
    padding: 8px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--error);
    border: 2px solid var(--error);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 500;
    color: white;
    align-self: flex-end;
    margin-bottom: 2px;
    box-shadow: var(--shadow-sketch);
}

.cancel-btn:hover {
    background: #b55858;
    transform: translateY(-1px);
}

.cancel-btn svg {
    width: 16px;
    height: 16px;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .input-container {
        padding: 10px 0 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        padding-left: 10px;
        padding-right: 10px;
        margin-left: -10px;
        margin-right: -10px;
    }

    .input-wrapper {
        align-items: center;
        padding: 10px 12px;
        border-radius: 12px;
        gap: 8px;
    }

    .message-input {
        min-width: 0;
        height: 36px;
        min-height: 36px;
        flex: 1 1 0;
        font-size: 16px;
        line-height: 22px;
        padding: 7px 0;
        box-sizing: border-box;
        /* 防止 iOS 自动缩放 */
    }

    .upload-btn {
        width: 36px;
        height: 36px;
        align-self: center;
    }

    .send-btn {
        min-width: 58px;
        min-height: 36px;
        padding: 6px 10px;
        font-size: 13px;
        border-radius: 8px;
        align-self: center;
        margin-bottom: 0;
    }

    .cancel-btn {
        width: auto;
        min-width: 68px;
        height: 36px;
        padding: 0 10px;
        gap: 4px;
        font-size: 13px;
        border-radius: 8px;
        align-self: center;
        margin-bottom: 0;
    }

    .cancel-btn span {
        display: inline;
    }

    .input-wrapper.input-multiline {
        align-items: flex-end;
    }

    .input-wrapper.input-multiline .upload-btn,
    .input-wrapper.input-multiline .send-btn,
    .input-wrapper.input-multiline .cancel-btn {
        align-self: flex-end;
    }

    .runtime-queue-head {
        align-items: flex-start;
        justify-content: flex-start;
        text-align: left;
        flex-direction: column;
    }

    .runtime-queue-item,
    .runtime-queue-item.editing {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
        padding: 8px;
    }

    .runtime-queue-item:not(.editing) {
        touch-action: none;
        user-select: none;
    }

    .runtime-queue-meta {
        justify-content: flex-start;
        min-width: 58px;
    }

    .runtime-queue-text {
        text-align: left;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .runtime-queue-actions {
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 4px;
        width: auto;
    }

    .runtime-queue-actions button {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        padding: 0;
    }

    .runtime-queue-actions button[data-queue-action="kind"] {
        width: auto;
        min-width: 50px;
        padding: 0 8px;
    }

    .runtime-queue-actions button[data-queue-action="up"],
    .runtime-queue-actions button[data-queue-action="down"] {
        display: none;
    }

    .runtime-queue-item.dragging {
        box-sizing: border-box;
        opacity: 0.96;
        border-color: var(--accent-primary);
        background: var(--bg-primary);
        box-shadow: var(--shadow-sketch);
    }

    /* 隐藏输入提示，移动端空间有限 */
    .input-hints {
        display: none;
    }
}
